I have been working on sound support for the 32X, and mmutil seems like the perfect preprocessor for music and sound effects. While making a few changes to make the 32X handle it easier (like changing the endianness of words and longs), I believe I ran across a pretty substantial bug.
Look at when you tell it to out put a MAS file:
Code: Select all
output_size = Write_MAS( &mod, v_flag, false );
and when you tell it to make a soundbank:
Now look at the proto for Write_MAS():
Code: Select all
int Write_MAS( MAS_Module* mod, bool verbose, bool msl_dep )
Clearly we have a boolean flag we pass to tell the difference between just writing a MAS file in general versus one written as part of a soundbank. Why? Because when you create a soundbank, all the samples in the music and any sound effects get put in a separate temporary file, while the music goes in a different temporary file. The soundbank is made by outputting the two files along with the appropriate parapointers to the samples and songs. A MAS file by itself must have the samples in the music since it won't have the separate sample file.
The problem is Write_MAS() ignores the bool and outputs the samples anyway. So now you have extra samples in your soundbank. The Write_MAS() function should be checking msl_dep before outputting the samples, and the sample parapointers should instead be the msl_index. What's funny is the MAS flags byte DOES have the msl_dep flag:
Code: Select all
write8( (u8)((mod->link_gxx ? 1 : 0) | (mod->old_effects ? 2 : 0) | (mod->freq_mode ? 4 : 0) | (mod->xm_mode ? 8 : 0) | (msl_dep ? 16 : 0) | (mod->old_mode ? 32 : 0)) );
This at least doubles the samples from the music, and depending on how many samples are identical between songs, could be SUBSTANTIALLY higher! If you had ten songs with all the same instruments for each, you're actually using ELEVEN times the space!