jdm / mzxplay

A program to allow playing MegaZeux games.
https://vault.digitalmzx.net/index.php
2 stars 2 forks source link

Implement sam playback #64

Open jdm opened 5 years ago

jdm commented 5 years ago

This requires mixing the openmpt playback with the sam buffers. Possibly there should be a vector of playing sams and every callback just mix as much of the sam data as possible with the openmpt data?

jdm commented 5 years ago

Given https://www.digitalmzx.net/wiki/index.php?title=SAM, it should be possible to use this code to convert the sample buffer to the target frequency, then use the resampled data in the audio callback. The trick is still doing the mixing manually.

jdm commented 5 years ago

Also it's not clear what to put as the src_rate. Probably just need to figure out what a default frequency is.

jdm commented 5 years ago

https://dsp.stackexchange.com/questions/3581/algorithms-to-mix-audio-signals-without-clipping https://wiki.libsdl.org/SDL_MixAudioFormat http://www.vttoth.com/CMS/index.php/technical-notes/68