[Openal-devel] Get part of a source / buffer

Chris Robinson chris.kcat at gmail.com
Mon May 25 07:09:09 PDT 2009


On Monday 25 May 2009 6:53:41 am Niall09 wrote:
> Hi,
>
> I keep trying your example, but &data[(ALuint)(pos*freq) * channels] keeps
> returning 0.

You need to set the variables to the proper values.. data points to the PCM 
sound data you want to play, frames is the number of frames (number of samples 
divided by the number of channels; note that OpenAL's use of 'sample' actually 
means 'frame'), channels is the number of channels, and freq is the sample 
rate.

If those values are correct and you meant
(ALuint)(pos*freq) * channels
keeps giving 0, that should only happen if pos is 0.0, meaning the source 
isn't playing.


More information about the Openal-devel mailing list