https://en.wikipedia.org/wiki/Gryazev-Shipunov_GSh-23 Here is a link to the page for the former Soviet aircraft mounted gun. Click on one of the pictures that provide the best view of the article. In the second paragraph, there is a link to the page to the Gast Gun for a more wordy description of the mechanism.
Railguns actually uses two 'rails' of magnetically opposite metal (in relation to each other) while what you are describing would be called a coil gun (because there is an actual coil in the barrel.)
Firearms using differing methods to load rounds (the projectile, the casing with the propellant and primer in this case) do not convert (at least in the 20th century) the kinetic energy into electrical energy (this actually loses some of it as waste) but simply directly uses it in the mechanical action of the loading system (20th century machines in some cases don't even have any electrical components as far as I am aware of mostly the early half of it.) Thus far, I have not seen any gun that is two barrels and fires in tandem as one gun (if they do, they are two different guns linked to each other except maybe the mass drivers on the Karuna-class Frigate.)
What would be even better, and this would be such a monstrous piece, would be to have it as a rotary gun (at least three barrels or more) self-powered (not just externally) using the recoil to augment the loading with the whole system and pelt the enemy with a visible stream of major-caliber artillery shells. (This would not be cheap across the board.)
Concluding, in any multi-barreled system, the main point is to give the barrel(s) that is/are not firing a chance to cool down
more than in a single barrel system while increasing the rate of fire. (The power shunt system aboard would have been, back to blue planet, designed to or modified to meet the "do more with less" concept (actually necessity), given the demands presented.) Torpedoes would just simply be jettisoned and then power themselves out.