stereo audio from memory

Posted By: Kartoffel

stereo audio from memory - 04/30/18 18:08

Hey there! I'd like to open/play a stereo audio file from memory (for ingame music). It sounds trivial but everything I've tested didn't work so far.
snd_play doesn't support stereo files and media_play for some reason is unable to stream from memory.

Is there any other way to accomplish this?

regrads, Kartoffel
Posted By: Superku

Re: stereo audio from memory - 04/30/18 18:24

2 alternatives that support playing from memory:
1) Get an irrKlang license for 65€. Writing a wrapper for that is easy and quick.
2) Write your own DirectSound implementation.

Both options require a non-zero amount of work but the results will be way beyond what the very limited acknexs sound engine has to offer.
Posted By: Kartoffel

Re: stereo audio from memory - 04/30/18 18:29

okay, I'll take a look at them. thanks for the recommendations.
Posted By: txesmi

Re: stereo audio from memory - 04/30/18 21:29

I use to play two balanced mono sounds. I have played long songs with no desynchronization but the risk is there, I think.
Posted By: Kartoffel

Re: stereo audio from memory - 05/01/18 08:16

That's what I'm afraid of. But interesting to hear that you managed to make it work that way.
Posted By: Kartoffel

Re: stereo audio from memory - 05/03/18 14:21

As far as I know there's a way to automatically link all dll functions, right?
Does anyone know how this works? I don't want to spend a ton of time to link all functions of my wrapper manually.

Edit: I did it manually now but I can't seem to link a single function even though I did it the same way I usually do confused
Edit2: oops, I didn't see that irrklang had some dependencies (the irrklang dll, duh). The linking works now.
Posted By: Kartoffel

Re: stereo audio from memory - 05/03/18 18:11

Originally Posted By: Superku
1) Get an irrKlang license for 65€. Writing a wrapper for that is easy and quick.
Well, I wouldn't say it was that quick and easy, but definitely more convinient than writing everything using low level audio APIs.

Anyway, looks like everything is working right now. Music files are decrypted at runtime (not during playback, though) and can be loaded straight from memory into irrKlang. Thanks again.
Posted By: Superku

Re: stereo audio from memory - 05/03/18 18:46

Yeah, the whole container -> memory -> playback stuff takes a while. The initial setup or getting it running/ irrKlang init + playing a file is quick and easy, comparatively. O:-)
© 2024 lite-C Forums