Chris Robinson-5 wrote:
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.
Im trying alBufferData(buffer, AL_FORMAT_STEREO16,data,frames*channels*2, freq) but when i run it, i get a error:
malloc: *** mmap(size=3143925760) failed (error code=12)
*** error: can't allocate region
and when i debug it, by making it output the frames*channels and frames*channels*2 to the console, frames*channels is 1571962880 (frames is 5292032 and channels is 4355) and frames*channels*2 is -1151041536.