Replace audio-API instead of forking an old one #145
Labels
No Label
RGSS accuracy
bug
compilation
discussion
documentation
duplicate
enhancement
invalid
performance issue
port request
question
ruby incompatibility
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MapleShrine/mkxp#145
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Dear Ancurio,
The SDL_sound API is now unmaintained by its author. It's now a little old and you have to patch it.
So, there is some alternative like SDL_mixer that do the same job than SDL_sound and it still maintained. But it still can't play WMA files.
I think the best solution is to use "libav" to decode audio files and also video files.
The purpose of this change is to make compilation easier and to not have to share patched version of library. So, final user can use his own system library.
Regards.
Please read #36 and #109 for the reasons behind this decision.
OK. As I understand, the main reason of the use of SDL_sound instead anything else is for decoding sound format (ogg, WAV..) and play it via OpenAL.
But at the end of the homepage project, one goal is to be able to play WMA files. SDL_sound can't play WMA so Ancurio should patch it again with WMA support.
I suggest to use libav because it can decode anything (images, sound & videos). Also, for shared builds, you can limit formats to decode.
Changing to this would be a lot of work but I think it will be easier to add new functionnalities After.
Regards.
Yes, I've tried a few times looking over the ffmpeg WMA decoder code, thinking about how to port it to SDL_sound. But it's not very well commented, and lossy audio decoding algorithms are definitely not something I'm comfortable with, so it goes kinda over my head.
Hmmm, you make an interesting point. I assume libav delegates the decoding to respective satellite libs (libpng, libjpeg, libvorbis etc.) for this? Or is it all statically included? Switching to libav sounds just like replacing one lib with another, and the scope of SDL_sound/image is a lot smaller, so it's kinda easier to deal with them.
It would only add WMA support, which is nice, but really low on priority because so few games even have wma files (and those can be easily converted if need be).
As for Theora video playback, I was thinking of using TheoraPlay due to its extreme minimalism and focus on games. Not sure how it measures up against full blown ffmpeg/libav.
On the other hand, switching something as integral as decoding libs would really have to justify the cost. I don't think SDL_sound not being well maintained is a good argument, and I'm trying to fix this as well.
Not for all codec. For example, png, jpg, mpg, mp3 and h263 is natively decoded by libav/ffmpeg but it needs libvorbis, libtheora or libx264 for decoding their respective format.
Maybe I'm wrong about libvorbis, libtheora ans libx264. Maybe libav needs those libs only for encoding but can decode it natively.
Edit: I've checked I WAS WRONG. libav can decode natively all you need and the shared library is less than 5MB.
As an information from the "partner project" for RPG2k/2k3: We used SDL_mixer since years and we always had problems with it's brokeness. Resampling was flawed, MP3 was broken for most cases, no pitch changes... BUT we found a solution which works without patching SDL_mixer and allows us to alter the buffer before SDL_mixer sends it to the soundcard:
Mix_HookMusic
https://github.com/EasyRPG/Player/blob/master/src/audio_sdl.cpp#L54
This callback replaces the music playback of SDL2 mixer and you can use it to play anything you want. The only problem is that you lose all of SDL2s decoding functionality (which usually decodes to noise :p), you have to write your own decoders... We have written them for WAV (libsndfile), MP3 (mpg123), OGG (libvorbis), MIDI (fmmidi & wildmidi) and do arbitrary resampling with speexdsp. All problems solved 👍
Though we also have no WMA playback yet (not supported by the engine ;))
This is a very interesting idea in all honesty... Could open up a lot of formats and maybe simplify things for the developer (eg, someone making local builds with special features not upstream).