Page 1 of 1

What does the value returned by 'LoadSound()' represent?

Posted: Mon Jun 14, 2021 4:15 am
by Axeman
Hi. I'd like to find out what the value returned by LoadSound() represents, if anyone knows (this is for the Windows x64 version of PureBasic). I assume that it's a handle\address pointer to a DirectSound object or buffer?

The reason that I'm asking is that I'm in the middle of porting an OpenAL wrapper library I wrote in BlitzMax to PureBasic and I need to get the buffer pointer, buffer size, sound format ID, etc for a loaded sound so that I can use them with the 'alBufferData' OpenAL command. I'm looking for a way to use the system ID returned by LoadSound() to obtain this information.

Re: What does the value returned by 'LoadSound()' represent?

Posted: Sat Jun 19, 2021 10:12 pm
by infratec
Wouldn't it be easier to simply load the file into a memory buffer?

It is easy to load a WAV file and find the buffer.
If you need other fileformats it gets complicated.

Re: What does the value returned by 'LoadSound()' represent?

Posted: Wed Jun 23, 2021 7:10 am
by Axeman
Yes, the code for a WAV loader seems to be very simple and would give me the details I need to work with OpenAL. I was planning to use that method to convert my OpenAL library for BlitzMax to PureBasic, but now I'm hitting other issues with PureBasic's 3D library that make me think that I'm better off just switching my project back to BlitzMax.

Re: What does the value returned by 'LoadSound()' represent?

Posted: Wed Jan 12, 2022 10:22 pm
by bfernhout
I do not know if i do this on the right way. But if you want to know the adress of a loaded sound. But i use the following methode:

Code: Select all

#My_Sound = 1
Global Position.i
LoadSound(#My_Sound,"The_Sound.wav")
*Position = @#My_Sound
*Position is now a memeory pointer to the sound file.