[openal] Offtopic: How can I create buffers from encrypted files?

Chris Robinson chris.kcat at gmail.com
Wed Nov 4 10:31:05 EST 2020

On Wed, 4 Nov 2020 17:08:00 +0300
Sean <s.tolstoyevski at gmail.com> wrote:

> Hello,
> I used OpenAL-Soft and libsndfile in my game.
> I have finished it now.
> I want to encrypt audio files.
> I'm thinking of doing this with AES.
> But I don't know how to create new buffers from encrypted files.
> I guess sndfile doesn't have a function to *decode* audio from
> sources other than disk.

OpenAL buffers only work with decoded PCM samples. If you have
encrypted files, you'll need to decrypt them for libsndfile to handle,
then the decoded PCM samples can be loaded into an OpenAL buffer like
normal. libsndfile can use custom I/O methods if you need to decrypt
files on the fly, see sf_open_virtual.

More information about the openal mailing list