Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
811 stars 66 forks source link

Stream cutscene audio #194

Closed donnierussellii closed 6 years ago

donnierussellii commented 6 years ago

Convert and stream chunks of cutscene audio instead of converting it all at once.

Audiologs stream the same way. Commits done.

Interrupt commented 6 years ago

It's kind of weird having the SDL Mixer callback in the XMI file in this case where it could be streaming either cutscene audio or music - maybe it should get moved to a more generalized place?

Interrupt commented 6 years ago

Found a function that could help us out a lot, SDL_mixer has a Mix_HookMusic callback which is a callback stream used exclusively for music: https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_60.html

I think we could use that for music streaming with the added benefit of being able to control the music volume simply with Mix_VolumeMusic, and also free us up to use the other mixer callback exclusively for Cutscene / Audiolog streaming.

donnierussellii commented 6 years ago

Moved functions around to appropriate places. Using separate music and cutscene audio callbacks (both can play at once), but Mix_VolumeMusic doesn't seem to work with the callback (it takes over too much) so still using adlmidi to control music volume.

Interrupt commented 6 years ago

Thanks for being patient with this PR, ended up with some bad food poisoning this last weekend so I haven't been able to really dig into this yet.

donnierussellii commented 6 years ago

Hope you're feeling better.

This seems to work well. I listened to most of the audiologs and barks throughout a playthrough with no problems. I put up a video on my youtube channel of levels 1 and 2. I love how fast the audio starts now.