[Openal] Segfault on alcCaptureOpenDevice

Jason Champion jchampion at dsci-usa.com
Wed Sep 27 15:34:00 PDT 2006


I'm working on an application to do full-duplex audio: capturing data from
the soundcard while simultaneously playing back a different set of data
received over the network.  I get an access violation error when I call
alcCaptureOpenDevice.  Below is the exact code I'm using:

 

  ALCdevice* _device = alcOpenDevice(NULL);

  ALCcontext* _context = alcCreateContext(_device, NULL);

  alcMakeContextCurrent(_context);

  alGenSources( 1, &_playbackHandle );

  alSourcef ( _playbackHandle, AL_PITCH, 1.0 );

  alSourcef ( _playbackHandle, AL_GAIN, 1.0 );

  alSource3f( _playbackHandle, AL_POSITION, 0.0f, 0.0f, 0.0f );

  alSource3f( _playbackHandle, AL_VELOCITY, 0.0f, 0.0f, 0.0f );

  alSourcef( _playbackHandle, AL_ROLLOFF_FACTOR,  0.0f );

  alSource3f(_playbackHandle, AL_DIRECTION, 0.0, 0.0, 0.0);

  ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };

  ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };

  ALfloat ListenerOri[] = { 0.0, 0.0, -1.0,  0.0, 1.0, 0.0 };

  alListenerfv(AL_POSITION,    ListenerPos);

  alListenerfv(AL_VELOCITY,    ListenerVel);

  alListenerfv(AL_ORIENTATION, ListenerOri);

  alGenBuffers( 2, _playbackBuffer );

  const ALCchar* captureDeviceString = alcGetString( _device,
ALC_DEFAULT_DEVICE_SPECIFIER );

  ALCdevice* _captureDevice = alcCaptureOpenDevice( captureDeviceString,
_captureSampleRate, AL_FORMAT_MONO16, (_recordBufferLength / 2) );

 

In the call to alcCaptureOpenDevice, the variables have the following
values:

 

captureDeviceString = "NVIDIA(R) nForce(TM) Audio"

_captureSampleRate = 44100

_recordBufferLength = 88200 (we divide by two because we're capturing
two-byte data and we convert from bytes to samples)

 

What could I possibly be doing wrong?

 

As far as I can tell I'm using valid values in the alcCaptureOpenDevice
call.  I was originally using alcGetString( _device,
ALC_DEFAULT_CAPTURE_DEVICE_SPECIFIER) but it was returning NULL, and the
documentation I have actually mentions that you should use
ALC_DEFAULT_DEVICE_SPECIFIER to get the device name to pass to the function.

 

I have pruned out all of my error checks for ease of reading, but I do check
OpenAL for errors after every call and no calls are unsuccessful.

 

Any help would be greatly appreciated.

 

Thank you,

Jason Champion

Compiler/OS: Win32/VC.Net2003

There are two kinds of people: 1) those who start arrays with one and 1)
those who start them with zero.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal/attachments/20060927/faf7f76a/attachment.html


More information about the Openal mailing list