FamiStudio
FamiStudio copied to clipboard
Combined duplicate channels in sound engine
If two channels are unused, then they very likely have the exact same data. This change will detect when a channel's data is already in the file, and point the header pointer to the previous channel data to reduce size for no extra cost
Example:
Consider the following header
music_data_oddity:
.byte 7
.word @instruments
.word @instruments_exp
.word @samples-4
.word @song0ch0,@song0ch1,@song0ch2 ; 00 : EPSM Detected
@song0ch0:
.byte $ff, $ff
@song0ch1:
.byte $ff, $ff
@song0ch2:
.byte $ff, $ff
With this patch, the export code will detect that the data is exactly the same between the channels and merge them like so
music_data_oddity:
.byte 7
.word @instruments
.word @instruments_exp
.word @samples-4
.word @song0ch0,@song0ch1,@song0ch2 ; 00 : EPSM Detected
@song0ch2:
@song0ch1:
@song0ch0:
.byte $ff, $ff
The header remains the same, and the data is still there for one channel, but all the "unused" channels will be merged into one.
This one well put on hold until 4.3.0. Too risky.