Added optional dependency to libsndfile and libspeexdsp #908

merged 10 commits into from Jun 17, 2016


None yet

3 participants



As explained before in the forum these are two additions to the audio layer of the player:

  • decoder_libsndfile to enable wav playback without sdl (depends on libsndfile)
  • audio_resampler to enable arbitrary resampling (depends on libspeexdsp, or libsamplerate)

The AudioResampler is meant to wrap any AudioDecoder and intersects if SetFormat or SetPitch are called.

I haven't changed anything in the sdl audio files so these changes only affect background music as sound effects don't use the AudioDecoder class.

Ghabry commented Jun 11, 2016 edited

Jenkins: Test this please

For Sound effects it's fine. SDL is able to play most of them. We only get resampler issues when streaming data because sounds are played in one go but no music.

Thanks, looks really great. Much better than the code I have to review at my company 👍 Going to test it :)

This will need adjustments for Windows (Visual Studio) but I will do this with another pull request after merging this one because it's ugly ;)

Ghabry commented Jun 11, 2016 edited

Works perfect in SDL, even with nonsense rates like 10000 or 23456

Only one thing: In AudioResampler.cpp you have

*                                                                *



blocks. This doesn't match the coding style (and you only use it in one of your files)

@ChristianBreitwieser ChristianBreitwieser (audio) coding style: added license header to decoder_libsndfile d4264cf
@ChristianBreitwieser ChristianBreitwieser (audio) coding style: added license header to audio_resampler and rem…
…oved block separating comments

Thanks for the kind reply!
The block seperating comments are removed.


btw. is there a reason you guarded only the internal stuff from the libraries in audio_resampler.h and decoder_libsndfile.h? It will not link without the libs (if using the functions) anyway, so it would make sense to empty the files when the preprocessor macros are not defined imo.

ChristianBreitwieser commented Jun 14, 2016 edited

No there is no "real" reason - I just tried to follow the style of the two existing decoders (fmmidi and mpg123).

In fact the header files aren't used anyway if the macros aren't defined. The inclusion in audio_decoder.cpp is macro dependent as well.

Should i change it?

@ChristianBreitwieser ChristianBreitwieser (audio) coding style: Empty decoder_libsndfile.h if HAVE_LIBSNDFILE i…
…s not defined
@ChristianBreitwieser ChristianBreitwieser (audio) coding style: Empty audio_resampler.h if HAVE_LIBSPEEXDSP or …
…HAVE_LIBSAMPLERATE is not defined
Ghabry commented Jun 17, 2016

Finnally found time to test the tempo. Works great 👍

@Ghabry Ghabry merged commit 306992e into EasyRPG:master Jun 17, 2016

5 checks passed

Android Build finished.
Linux Build finished.
OSX Build finished.
Windows Build finished.
web Build finished.
@ChristianBreitwieser ChristianBreitwieser deleted the ChristianBreitwieser:audio branch Jun 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment