Currently we keep the entire song in memory, including the sample data blocks even though once they’re uploaded to sample memory they’re never needed again.
If we would only keep the actual song data in memory and discard the sample data as it’s being loaded, we could reduce the memory requirement of VGMPlay for tracks with sample data.
This would mean that VGMPlay needs to move to a pipelined processing method, rather than loading the entire file into memory before processing it. For plain VGM files this is relatively simple, for compressed VGZ files this is more complex and would involve something like coroutines.
Since the sample data blocks are embedded in the command stream, any commands prior to the data blocks (which can unfortunately occur, e.g. on OPNA) need to be kept, and if the loop point is set prior to the data block this needs to be adjusted as well.