Re: Re: blocking / non-blocking capturing

Eric Wing <[email protected]> Wed, 8 Aug 2012 01:05:26 -0700
Newsgroups gmane.comp.lib.openal
Message-ID <CA+Q62MAMULpg_4hxgKRHTB18in0d27RqqcqWnOoJ64RBHDje5Q@mail.gmail.com>
On 8/8/12, Chris Robinson <[email protected]> wrote:
> On 08/07/2012 05:58 AM, Philipp Kraus wrote:
>> in the ctor I create the device
>>
>> m_device is a pointer to ALCdevice and p_device the capture device name.
>>
>> m_device( alcOpenDevice( p_device.c_str() ) )
>>
>> in my capture methode I call this
>> ALCdevice* l_capturedevice = alcCaptureOpenDevice(
>> alcGetString(m_device, ALC_CAPTURE_DEVICE_SPECIFIER),
>> (ALCuint)p_samplefrequency,     AL_FORMAT_MONO8, (ALCsizei)p_buffersize)
>> alcCaptureStart(l_capturedevice);
>> // here I will read the samples with a blocking structure
>>
>> Is this correct?
>
> Unfortunately that's not correct.
>
> You can't rely on capture devices having the same name as playback
> devices, or a capture device even having a corresponding playback
> device. You would need to call alcCaptureOpenDevice with the name passed
> in, while making sure the name came from the list of enumerated capture
> device names.
>
> It's also not technically valid to get the ALC_CAPTURE_DEVICE_SPECIFIER
> string on a playback device, as far as I'm aware.

If I recall, it is even worse than that. On Mac, it used to be the
case that you could not programmatically select a capture device via
OpenAL and only the user's default device could be opened (via passing
NULL as the parameter). The user would have to change this in System
Preferences for their account. I had an open bug and a preliminary
patch to Apple's implementation to fix this, but it went nowhere. (My
patch didn't handle USB devices coming and going on the fly which is
why it was not accepted and to my knowledge, Apple has not added this
functionality over the past years since I first reported that bug.)


You mentioned Core Audio which means Mac or iOS, so I will plug my
book :) I have an OpenAL capture example in my book in Chapter 12 for
both Mac and iOS. You can find a link to the source code here:
http://playcontrol.net/iphonegamebook/links.html

-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal