It's possible, but not practical.
If we think of early gunpowder weapons, there are a couple of practical limitations:
Metallurgy. The metals of the time are not strong enough, and the machining ability of the time is not precise enough, to build a working breech loading weapon. That requires a strong metal if the breech action isn't overly heavy, and precise machining to achieve a proper gas seal. All early gunpowder weapons were muzzle loaders.
Fouling. Black powder is dirty. It not only produces a cloud of sulfur dioxide smoke, it also leaves a lot of gummy residue behind. That's what hampered the first breech loading rifles - the screw breeches clogged up from black powder residue. I have an accurate (and expensive) reproduction of a British Ferguson rifle (used once in battle in 1776), the first military breechloader. Even with lots of grease on the threads, I can get off maybe four shots before the screw action freezes up from the black powder residue, and has to be cleaned off. As well, the Ferguson uses a flintlock ignition - percussion ignition didn't come along until the early 1800's. Getting flint or slow match to fire rapidly would be just about impossible.
Breechloading firearms did not become practical until the invention of the revolving cylinder that is sealed at the breech, and finaly the metallic cartridge, which contained the fouling to within the barrel and away from the breechloading action.
With kinetic weapons like bows and crossbows, one lacks a reliable power source. A water wheel might work... if you only fight where you have a water wheel. Human power struggles to pull a bow or crossbow for a single shot, so multiple shots is too much for one person. You could use five or six people to power it, but you could also give those five or six people their own bows or crossbows and get the same rate of fire. And the materials of the time may not stand up to the rigorous demands of rapid fire.
One final wrinkle: ruggedness. Battles occur wherever two armies meet, often in unexpected locations, on unknown terrain. A military weapon must be rugged enough to be carried across rough ground, and simple enough for a moderately trained soldier to operate. Rube Goldberg style devices just won't hold up under battlefield conditions.
The practical reality: It is far simpler to train more archers than to try to develop a rapid fire arrow projecting weapon. especially with the materials and machining ability of those days. A platoon of archers is very mobile, and it can withstand damage to parts of it without losing effectiveness (casualties). Gunpowder weapons of that day were far too crude to be considered candidates for rapid fire.
Automatic weapons were developed when the components: the action, the ignition method, and the cartridge method, had evolved to make them practical and rugged enough to withstand battlefield conditions: first the Gatling Gun that appeared not long after the metallic cartridge was developed, and then the Maxim recoil powered machine gun.