martincameron / micromod

Music player libraries for MOD, S3M and XM formats.
BSD 3-Clause "New" or "Revised" License
159 stars 28 forks source link

Added a SDL Player for the IBXM library #18

Closed wel97459 closed 4 years ago

wel97459 commented 4 years ago

SDL Player for IBXM library based off of the one used with the Micromod library. I added a function to the IBXM library to provides the length that will be returned when calling the replay_get_audio() function. This was needed for Initialising the SDL_AudioSpec->samples value.

martincameron commented 4 years ago

Ah, you can't assume replay_get_audio() will always generate the same number of samples, because it depends on the tempo of the song, which can change during playback. The maximum for a particular sampling rate is given by calculate_mix_buf_len(), which is roughly 1/6 of a second.

I've checked-in an SDL player that uses the buffering routine from the Javascript port, which has a similar output mechanism.

wel97459 commented 4 years ago

Sweet, I'll have a look at it.