pt2-clone
pt2-clone copied to clipboard
Mod2wav command-line rendering
Hello, I added a command-line option that allows the user to render a MOD file to WAV without going through the GUI.
Usage:
pt2-clone example.mod --mod2wav
A WAV file called "example.mod.wav" is then created and rendered using the existing mod2wav code. To do this, the program skips SDL initialization and runs the program in a "headless" mode.
I'm using a global bool called "headless" which is set to true when using "--mod2wav" and it is used to skip over SDL code that would otherwise cause a crash if SDL is uninitialized.
I'm sure you are probably going to have objections to the way I implemented some things. If this mod2wav command-line feature is something you'd like to keep, I'd be happy to fix things if you have any suggestions.
Yeah I don't really like the way you're doing this. I think it would make more sense to break down the stuff in setupAudio() into own functions, so that you can call what's needed in your argv-checking code instead. This way you can make your own mod2wav-section in the main file without having to mess with existing routines. I'll try to come up with something myself at some point, and commit it. Thanks for the idea though, definitely worth implementing!
You're right. The audio and UI code is pretty tightly coupled with the sound generation code, so creating a "headless" console mode that isn't a hacky solution might require a good deal of refactoring and I'm not familiar enough with your code to do that. So maybe this is better as a proof of concept.
Sorry for the long delay, but I've decided to not have command-line support for MOD2WAV. The main reason is that I don't want people to batch-render huge amount of modules and upload them to f.ex. YouTube, without verifying that everything is right. With an automated approach for rendering modules, comes more laziness in verifying that each and every module sound like they should. We already have way too many bad renders of music online, and this is (in my opinion) not fair to the original composer.
EDIT: Yes, I'm aware that my replayer ports on GitHub have a command-line option for rendering to WAVs, but those are considered "enthusiast tools", not being as popular as my tracker clones. In other words, it's unlikely that someone will render a ton of songs with them in a careless way.