LWJGL Forum

Programming => OpenAL => Topic started by: AGP on March 17, 2014, 07:28:14

Title: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: AGP on March 17, 2014, 07:28:14
What is the current equivalent to that line? Thanks in advance.
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: quew8 on March 17, 2014, 21:47:16
Well I don't know if it's the exact equivalent but you can load a sound with the WaveData util class then that'll give you all the formatting options to give OpenAL.

In this example I'm just assuming you have an InputStream but there are all kinds of ways of getting a WaveData instance.
Code: [Select]
WaveData wd = WaveData.create(inputStream);
IntBuffer idBuff = BufferUtils.createIntBuffer(1);
AL10.alGenBuffers(idBuff);
int id = idBuff.get(0);
AL10.alBufferData(id, wd.format, wd.data, wd.samplerate);
wd.dispose();

Edit: Fixed error that AGP noticed.
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: AGP on March 20, 2014, 05:50:30
Thanks very much. I'll try it out and report back.
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: AGP on March 26, 2014, 23:36:59
The following line doesn't compile. I tried add, but that doesn't work, either:

Code: [Select]
buffers.put(bufferID, idBuff);
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: quew8 on March 26, 2014, 23:39:49
Yeah. Sorry. I essentially copied this from one of my utility classes must have forgot to get rid of that line. You can just delete it, doesn't do anything relevant here.
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: AGP on March 27, 2014, 00:03:34
Cool, thanks. By the way, do you know the equivalent (or closest thing) of the old StreamPlaylist class?
Title: Re: int bufferID = org.lwjgl.audio.vorbis.Util.CreateALBufferFromFile(path, 16);
Post by: quew8 on March 27, 2014, 06:57:23
I'm afraid I started with LWJGL way after all this stuff so I have no idea what that is.