Aaannnd five shots in 88 steps. Cadence of my magma cannon is now the load time, this should be the optimum possible for the given base concept. Design:
WFFFW
☼RRRW .╔══#
WRW▲W #║#╚#
WRW▲W #║#╚#
WRW▲W #║#╚#
W▼W▲W #║#╚#
W▲W▲W #╗#╚#
W▲W▲W #╗#╚#
[x15...]
☼RRRW .╚═╝#
WWWSW ###║#
W - Wall
R - Roller (medium and high speed at the top, highest at the bottom, always in line with the exit directions of the track tiles)
F - Fortification, for shooting through. Since carts get pulled away after the collision via rollers, they can smack directly into the fortification, no need for extra "trigger" carts. The rollers give a slight westward slant to the shots, but at the high incoming speed, that means the angle shifts by about eight degrees, which is easy enough to adjust for.
▲ - Impulse ramps to provide acceleration
▼ - "loading pond, full of pumped magma, with straight track engraved on the pseudo-ramp (doesn't provide acceleration/deceleration)
S - hauling route stop with order to "push north when empty", to get the carts into the circuit.
☼ - gear assemblies transmitting power to the rollers. Both assemblies and rollers should be magma-proof.
Carts must be entered via dwarven push, they don't space out properly otherwise. The acceleration path is pretty long, resulting in very high shot speed. Each cart takes 88 steps for a full cycle, and there are five in the barrel. I've no idea yet how good this thing is militarily, but it's quite effective at starting forest fires. The elves will be delighted.