kcat / alure

Alure is a utility library for OpenAL, providing a C++ API and managing common tasks that include file loading, caching, and streaming
zlib License
70 stars 20 forks source link

Added support for loop points on the sndfile decoder. #27

Closed LAGonauta closed 6 years ago

LAGonauta commented 6 years ago

I wanted to use the stream decoder to simulate "AL_EXT_loop_points" on drivers that does not support this extension, but I noticed there seems to be no way to set the decoder loop points manually from the application and the standard WAV decoder does not yet support reading the cue points from the files I am using (the cue points are at the end after the audio data).

As I would eventually want to decode OGG and FLAC files, I simply added loop point support to the built-in libsndfile decoder.

This PR also has a compiler fix that I had to use in another commit, however I couldn't test GCC yet to see if it can compile with this fix (or should I have cast "pos" to a "size_t" instead?).

LAGonauta commented 6 years ago

It seems that libsndfile is too old on Ubuntu 14.04 to support cue points... I guess this PR will need to wait.

LAGonauta commented 6 years ago

Now it should compile and work on older library versions, thanks kcat. I added an underline at the start of the type name to differentiate from the one from the library, if you believe there is a better naming scheme I will change to it.

kcat commented 6 years ago

Names starting with an underscore and uppercase letter (or double-underscore and lowercase letter) are reserved for the compiler. I don't imagine these would be too big of a deal (it's unlikely the compiler would need these specific names), but I would prefer them to not be in the sndfile.hpp header. They'd be better off in the source, and if you're going to move them, perhaps the names can be changed too.

LAGonauta commented 6 years ago

@kcat I moved to the source in a local scope, I hope this is enough.