OpenAl Problem on Mac OsX 10.5 Is it a bug?
BlitzMax Forums/BlitzMax Programming/OpenAl Problem on Mac OsX 10.5 Is it a bug?
| ||
| I wrote a recording software which takes the signal from microphone and works with the samples afterwards (fft etc...) On Windows it is working perfect, but on Mac it crashed. Now I reduced the code to a minimum to find the error and noticed that a OpenAl Function is working different to the PC-Version. On the PC the function "alcCaptureSamples" fetches some samples from the device and reduces the number of remaining samples. On the MAC the function does not reduce the number of remaining samples. What Do I do wrong or is ot a bug? the code demontrates the behavior without crashing. Normaly "alcCaptureSamples" should reduce the amount of remaining samples:
If OpenALInstalled()=False
Print " no open al installed"
End
EndIf
EnableOpenALAudio()
SetAudioDriver("OpenAL")
Global Device: Int
Global CaptureDevice:Int
Global NumSamples:Int
Global VoidSample:TAudioSample=CreateAudioSample(44100*2,44100,SF_MONO16LE)
Global Zeit%
Device=alcOpenDevice(Null)
If Device=Null Then RuntimeError "No access to OpenAL Device !"
Local flag%=InitCapture()
If flag=False Then RuntimeError "No access to OpenAL capture Device !"
Graphics 800,600,0
alcCaptureStart(CaptureDevice)
Repeat
If zeit<MilliSecs() Then
zeit=MilliSecs()+500
Print " i am ok " + MilliSecs()
alcGetIntegerv(CaptureDevice, ALC_CAPTURE_SAMPLES, 4, Varptr(NumSamples))
Print "amount of samples : " + numsamples
If numsamples>10000 Then
numsamples=10000
Print "only fetching " + numsamples
alcCaptureSamples(CaptureDevice, VoidSample.Samples, NumSamples)
' check how much remai samples
alcGetIntegerv(CaptureDevice, ALC_CAPTURE_SAMPLES, 4, Varptr(NumSamples))
Print "remaining samples : " + numsamples
EndIf
EndIf
Until KeyHit(key_escape)
ShutdownOpenAL
End
Function InitCapture%()
If (alcIsExtensionPresent(Device, "ALC_EXT_CAPTURE") = AL_FALSE) Then Return False
CaptureDevice = alcCaptureOpenDevice(Null, 44100, AL_FORMAT_MONO16, 44100*5*2);
If Not(CaptureDevice) Then Return False
Return True
EndFunction
Function ShutdownOpenAL()
alcCaptureStop(CaptureDevice)
alcCloseDevice(CaptureDevice)
alcCloseDevice(Device)
EndFunction
|