Update a comment
[openal-soft.git] / Alc / backends / coreaudio.c
blobb38cc4eef34a087bacc77631243cc6b2a2082b31
1 /**
2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2007 by authors.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
21 #include "config.h"
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <alloca.h>
28 #include "alMain.h"
29 #include "alu.h"
31 #include <CoreServices/CoreServices.h>
32 #include <unistd.h>
33 #include <AudioUnit/AudioUnit.h>
34 #include <AudioToolbox/AudioToolbox.h>
37 typedef struct {
38 AudioUnit audioUnit;
40 ALuint frameSize;
41 ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate
42 AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD
44 AudioConverterRef audioConverter; // Sample rate converter if needed
45 AudioBufferList *bufferList; // Buffer for data coming from the input device
46 ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling
48 RingBuffer *ring;
49 } ca_data;
51 static const ALCchar ca_device[] = "CoreAudio Default";
54 static void destroy_buffer_list(AudioBufferList* list)
56 if(list)
58 UInt32 i;
59 for(i = 0;i < list->mNumberBuffers;i++)
60 free(list->mBuffers[i].mData);
61 free(list);
65 static AudioBufferList* allocate_buffer_list(UInt32 channelCount, UInt32 byteSize)
67 AudioBufferList *list;
69 list = calloc(1, sizeof(AudioBufferList) + sizeof(AudioBuffer));
70 if(list)
72 list->mNumberBuffers = 1;
74 list->mBuffers[0].mNumberChannels = channelCount;
75 list->mBuffers[0].mDataByteSize = byteSize;
76 list->mBuffers[0].mData = malloc(byteSize);
77 if(list->mBuffers[0].mData == NULL)
79 free(list);
80 list = NULL;
83 return list;
86 static OSStatus ca_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp,
87 UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
89 ALCdevice *device = (ALCdevice*)inRefCon;
90 ca_data *data = (ca_data*)device->ExtraData;
92 aluMixData(device, ioData->mBuffers[0].mData,
93 ioData->mBuffers[0].mDataByteSize / data->frameSize);
95 return noErr;
98 static OSStatus ca_capture_conversion_callback(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets,
99 AudioBufferList *ioData, AudioStreamPacketDescription **outDataPacketDescription, void* inUserData)
101 ALCdevice *device = (ALCdevice*)inUserData;
102 ca_data *data = (ca_data*)device->ExtraData;
104 // Read from the ring buffer and store temporarily in a large buffer
105 ReadRingBuffer(data->ring, data->resampleBuffer, (ALsizei)(*ioNumberDataPackets));
107 // Set the input data
108 ioData->mNumberBuffers = 1;
109 ioData->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame;
110 ioData->mBuffers[0].mData = data->resampleBuffer;
111 ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * data->format.mBytesPerFrame;
113 return noErr;
116 static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,
117 const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
118 UInt32 inNumberFrames, AudioBufferList *ioData)
120 ALCdevice *device = (ALCdevice*)inRefCon;
121 ca_data *data = (ca_data*)device->ExtraData;
122 AudioUnitRenderActionFlags flags = 0;
123 OSStatus err;
125 // fill the bufferList with data from the input device
126 err = AudioUnitRender(data->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, data->bufferList);
127 if(err != noErr)
129 ERR("AudioUnitRender error: %d\n", err);
130 return err;
133 WriteRingBuffer(data->ring, data->bufferList->mBuffers[0].mData, inNumberFrames);
135 return noErr;
138 static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
140 ComponentDescription desc;
141 Component comp;
142 ca_data *data;
143 OSStatus err;
145 if(!deviceName)
146 deviceName = ca_device;
147 else if(strcmp(deviceName, ca_device) != 0)
148 return ALC_INVALID_VALUE;
150 /* open the default output unit */
151 desc.componentType = kAudioUnitType_Output;
152 desc.componentSubType = kAudioUnitSubType_DefaultOutput;
153 desc.componentManufacturer = kAudioUnitManufacturer_Apple;
154 desc.componentFlags = 0;
155 desc.componentFlagsMask = 0;
157 comp = FindNextComponent(NULL, &desc);
158 if(comp == NULL)
160 ERR("FindNextComponent failed\n");
161 return ALC_INVALID_VALUE;
164 data = calloc(1, sizeof(*data));
166 err = OpenAComponent(comp, &data->audioUnit);
167 if(err != noErr)
169 ERR("OpenAComponent failed\n");
170 free(data);
171 return ALC_INVALID_VALUE;
174 /* init and start the default audio unit... */
175 err = AudioUnitInitialize(data->audioUnit);
176 if(err != noErr)
178 ERR("AudioUnitInitialize failed\n");
179 CloseComponent(data->audioUnit);
180 free(data);
181 return ALC_INVALID_VALUE;
184 al_string_copy_cstr(&device->DeviceName, deviceName);
185 device->ExtraData = data;
186 return ALC_NO_ERROR;
189 static void ca_close_playback(ALCdevice *device)
191 ca_data *data = (ca_data*)device->ExtraData;
193 AudioUnitUninitialize(data->audioUnit);
194 CloseComponent(data->audioUnit);
196 free(data);
197 device->ExtraData = NULL;
200 static ALCboolean ca_reset_playback(ALCdevice *device)
202 ca_data *data = (ca_data*)device->ExtraData;
203 AudioStreamBasicDescription streamFormat;
204 AURenderCallbackStruct input;
205 OSStatus err;
206 UInt32 size;
208 err = AudioUnitUninitialize(data->audioUnit);
209 if(err != noErr)
210 ERR("-- AudioUnitUninitialize failed.\n");
212 /* retrieve default output unit's properties (output side) */
213 size = sizeof(AudioStreamBasicDescription);
214 err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size);
215 if(err != noErr || size != sizeof(AudioStreamBasicDescription))
217 ERR("AudioUnitGetProperty failed\n");
218 return ALC_FALSE;
221 #if 0
222 TRACE("Output streamFormat of default output unit -\n");
223 TRACE(" streamFormat.mFramesPerPacket = %d\n", streamFormat.mFramesPerPacket);
224 TRACE(" streamFormat.mChannelsPerFrame = %d\n", streamFormat.mChannelsPerFrame);
225 TRACE(" streamFormat.mBitsPerChannel = %d\n", streamFormat.mBitsPerChannel);
226 TRACE(" streamFormat.mBytesPerPacket = %d\n", streamFormat.mBytesPerPacket);
227 TRACE(" streamFormat.mBytesPerFrame = %d\n", streamFormat.mBytesPerFrame);
228 TRACE(" streamFormat.mSampleRate = %5.0f\n", streamFormat.mSampleRate);
229 #endif
231 /* set default output unit's input side to match output side */
232 err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size);
233 if(err != noErr)
235 ERR("AudioUnitSetProperty failed\n");
236 return ALC_FALSE;
239 if(device->Frequency != streamFormat.mSampleRate)
241 device->UpdateSize = (ALuint)((ALuint64)device->UpdateSize *
242 streamFormat.mSampleRate /
243 device->Frequency);
244 device->Frequency = streamFormat.mSampleRate;
247 /* FIXME: How to tell what channels are what in the output device, and how
248 * to specify what we're giving? eg, 6.0 vs 5.1 */
249 switch(streamFormat.mChannelsPerFrame)
251 case 1:
252 device->FmtChans = DevFmtMono;
253 break;
254 case 2:
255 device->FmtChans = DevFmtStereo;
256 break;
257 case 4:
258 device->FmtChans = DevFmtQuad;
259 break;
260 case 6:
261 device->FmtChans = DevFmtX51;
262 break;
263 case 7:
264 device->FmtChans = DevFmtX61;
265 break;
266 case 8:
267 device->FmtChans = DevFmtX71;
268 break;
269 default:
270 ERR("Unhandled channel count (%d), using Stereo\n", streamFormat.mChannelsPerFrame);
271 device->FmtChans = DevFmtStereo;
272 streamFormat.mChannelsPerFrame = 2;
273 break;
275 SetDefaultWFXChannelOrder(device);
277 /* use channel count and sample rate from the default output unit's current
278 * parameters, but reset everything else */
279 streamFormat.mFramesPerPacket = 1;
280 streamFormat.mFormatFlags = 0;
281 switch(device->FmtType)
283 case DevFmtUByte:
284 device->FmtType = DevFmtByte;
285 /* fall-through */
286 case DevFmtByte:
287 streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
288 streamFormat.mBitsPerChannel = 8;
289 break;
290 case DevFmtUShort:
291 device->FmtType = DevFmtShort;
292 /* fall-through */
293 case DevFmtShort:
294 streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
295 streamFormat.mBitsPerChannel = 16;
296 break;
297 case DevFmtUInt:
298 device->FmtType = DevFmtInt;
299 /* fall-through */
300 case DevFmtInt:
301 streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
302 streamFormat.mBitsPerChannel = 32;
303 break;
304 case DevFmtFloat:
305 streamFormat.mFormatFlags = kLinearPCMFormatFlagIsFloat;
306 streamFormat.mBitsPerChannel = 32;
307 break;
309 streamFormat.mBytesPerFrame = streamFormat.mChannelsPerFrame *
310 streamFormat.mBitsPerChannel / 8;
311 streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame;
312 streamFormat.mFormatID = kAudioFormatLinearPCM;
313 streamFormat.mFormatFlags |= kAudioFormatFlagsNativeEndian |
314 kLinearPCMFormatFlagIsPacked;
316 err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription));
317 if(err != noErr)
319 ERR("AudioUnitSetProperty failed\n");
320 return ALC_FALSE;
323 /* setup callback */
324 data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
325 input.inputProc = ca_callback;
326 input.inputProcRefCon = device;
328 err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct));
329 if(err != noErr)
331 ERR("AudioUnitSetProperty failed\n");
332 return ALC_FALSE;
335 /* init the default audio unit... */
336 err = AudioUnitInitialize(data->audioUnit);
337 if(err != noErr)
339 ERR("AudioUnitInitialize failed\n");
340 return ALC_FALSE;
343 return ALC_TRUE;
346 static ALCboolean ca_start_playback(ALCdevice *device)
348 ca_data *data = (ca_data*)device->ExtraData;
349 OSStatus err;
351 err = AudioOutputUnitStart(data->audioUnit);
352 if(err != noErr)
354 ERR("AudioOutputUnitStart failed\n");
355 return ALC_FALSE;
358 return ALC_TRUE;
361 static void ca_stop_playback(ALCdevice *device)
363 ca_data *data = (ca_data*)device->ExtraData;
364 OSStatus err;
366 err = AudioOutputUnitStop(data->audioUnit);
367 if(err != noErr)
368 ERR("AudioOutputUnitStop failed\n");
371 static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
373 AudioStreamBasicDescription requestedFormat; // The application requested format
374 AudioStreamBasicDescription hardwareFormat; // The hardware format
375 AudioStreamBasicDescription outputFormat; // The AudioUnit output format
376 AURenderCallbackStruct input;
377 ComponentDescription desc;
378 AudioDeviceID inputDevice;
379 UInt32 outputFrameCount;
380 UInt32 propertySize;
381 UInt32 enableIO;
382 Component comp;
383 ca_data *data;
384 OSStatus err;
386 if(!deviceName)
387 deviceName = ca_device;
388 else if(strcmp(deviceName, ca_device) != 0)
389 return ALC_INVALID_VALUE;
391 desc.componentType = kAudioUnitType_Output;
392 desc.componentSubType = kAudioUnitSubType_HALOutput;
393 desc.componentManufacturer = kAudioUnitManufacturer_Apple;
394 desc.componentFlags = 0;
395 desc.componentFlagsMask = 0;
397 // Search for component with given description
398 comp = FindNextComponent(NULL, &desc);
399 if(comp == NULL)
401 ERR("FindNextComponent failed\n");
402 return ALC_INVALID_VALUE;
405 data = calloc(1, sizeof(*data));
406 device->ExtraData = data;
408 // Open the component
409 err = OpenAComponent(comp, &data->audioUnit);
410 if(err != noErr)
412 ERR("OpenAComponent failed\n");
413 goto error;
416 // Turn off AudioUnit output
417 enableIO = 0;
418 err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint));
419 if(err != noErr)
421 ERR("AudioUnitSetProperty failed\n");
422 goto error;
425 // Turn on AudioUnit input
426 enableIO = 1;
427 err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint));
428 if(err != noErr)
430 ERR("AudioUnitSetProperty failed\n");
431 goto error;
434 // Get the default input device
435 propertySize = sizeof(AudioDeviceID);
436 err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propertySize, &inputDevice);
437 if(err != noErr)
439 ERR("AudioHardwareGetProperty failed\n");
440 goto error;
443 if(inputDevice == kAudioDeviceUnknown)
445 ERR("No input device found\n");
446 goto error;
449 // Track the input device
450 err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID));
451 if(err != noErr)
453 ERR("AudioUnitSetProperty failed\n");
454 goto error;
457 // set capture callback
458 input.inputProc = ca_capture_callback;
459 input.inputProcRefCon = device;
461 err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct));
462 if(err != noErr)
464 ERR("AudioUnitSetProperty failed\n");
465 goto error;
468 // Initialize the device
469 err = AudioUnitInitialize(data->audioUnit);
470 if(err != noErr)
472 ERR("AudioUnitInitialize failed\n");
473 goto error;
476 // Get the hardware format
477 propertySize = sizeof(AudioStreamBasicDescription);
478 err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize);
479 if(err != noErr || propertySize != sizeof(AudioStreamBasicDescription))
481 ERR("AudioUnitGetProperty failed\n");
482 goto error;
485 // Set up the requested format description
486 switch(device->FmtType)
488 case DevFmtUByte:
489 requestedFormat.mBitsPerChannel = 8;
490 requestedFormat.mFormatFlags = kAudioFormatFlagIsPacked;
491 break;
492 case DevFmtShort:
493 requestedFormat.mBitsPerChannel = 16;
494 requestedFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
495 break;
496 case DevFmtInt:
497 requestedFormat.mBitsPerChannel = 32;
498 requestedFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
499 break;
500 case DevFmtFloat:
501 requestedFormat.mBitsPerChannel = 32;
502 requestedFormat.mFormatFlags = kAudioFormatFlagIsPacked;
503 break;
504 case DevFmtByte:
505 case DevFmtUShort:
506 case DevFmtUInt:
507 ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType));
508 goto error;
511 switch(device->FmtChans)
513 case DevFmtMono:
514 requestedFormat.mChannelsPerFrame = 1;
515 break;
516 case DevFmtStereo:
517 requestedFormat.mChannelsPerFrame = 2;
518 break;
520 case DevFmtQuad:
521 case DevFmtX51:
522 case DevFmtX51Rear:
523 case DevFmtX61:
524 case DevFmtX71:
525 ERR("%s not supported\n", DevFmtChannelsString(device->FmtChans));
526 goto error;
529 requestedFormat.mBytesPerFrame = requestedFormat.mChannelsPerFrame * requestedFormat.mBitsPerChannel / 8;
530 requestedFormat.mBytesPerPacket = requestedFormat.mBytesPerFrame;
531 requestedFormat.mSampleRate = device->Frequency;
532 requestedFormat.mFormatID = kAudioFormatLinearPCM;
533 requestedFormat.mReserved = 0;
534 requestedFormat.mFramesPerPacket = 1;
536 // save requested format description for later use
537 data->format = requestedFormat;
538 data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType);
540 // Use intermediate format for sample rate conversion (outputFormat)
541 // Set sample rate to the same as hardware for resampling later
542 outputFormat = requestedFormat;
543 outputFormat.mSampleRate = hardwareFormat.mSampleRate;
545 // Determine sample rate ratio for resampling
546 data->sampleRateRatio = outputFormat.mSampleRate / device->Frequency;
548 // The output format should be the requested format, but using the hardware sample rate
549 // This is because the AudioUnit will automatically scale other properties, except for sample rate
550 err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat));
551 if(err != noErr)
553 ERR("AudioUnitSetProperty failed\n");
554 goto error;
557 // Set the AudioUnit output format frame count
558 outputFrameCount = device->UpdateSize * data->sampleRateRatio;
559 err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount));
560 if(err != noErr)
562 ERR("AudioUnitSetProperty failed: %d\n", err);
563 goto error;
566 // Set up sample converter
567 err = AudioConverterNew(&outputFormat, &requestedFormat, &data->audioConverter);
568 if(err != noErr)
570 ERR("AudioConverterNew failed: %d\n", err);
571 goto error;
574 // Create a buffer for use in the resample callback
575 data->resampleBuffer = malloc(device->UpdateSize * data->frameSize * data->sampleRateRatio);
577 // Allocate buffer for the AudioUnit output
578 data->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * data->frameSize * data->sampleRateRatio);
579 if(data->bufferList == NULL)
580 goto error;
582 data->ring = CreateRingBuffer(data->frameSize, (device->UpdateSize * data->sampleRateRatio) * device->NumUpdates);
583 if(data->ring == NULL)
584 goto error;
586 al_string_copy_cstr(&device->DeviceName, deviceName);
588 return ALC_NO_ERROR;
590 error:
591 DestroyRingBuffer(data->ring);
592 free(data->resampleBuffer);
593 destroy_buffer_list(data->bufferList);
595 if(data->audioConverter)
596 AudioConverterDispose(data->audioConverter);
597 if(data->audioUnit)
598 CloseComponent(data->audioUnit);
600 free(data);
601 device->ExtraData = NULL;
603 return ALC_INVALID_VALUE;
606 static void ca_close_capture(ALCdevice *device)
608 ca_data *data = (ca_data*)device->ExtraData;
610 DestroyRingBuffer(data->ring);
611 free(data->resampleBuffer);
612 destroy_buffer_list(data->bufferList);
614 AudioConverterDispose(data->audioConverter);
615 CloseComponent(data->audioUnit);
617 free(data);
618 device->ExtraData = NULL;
621 static void ca_start_capture(ALCdevice *device)
623 ca_data *data = (ca_data*)device->ExtraData;
624 OSStatus err = AudioOutputUnitStart(data->audioUnit);
625 if(err != noErr)
626 ERR("AudioOutputUnitStart failed\n");
629 static void ca_stop_capture(ALCdevice *device)
631 ca_data *data = (ca_data*)device->ExtraData;
632 OSStatus err = AudioOutputUnitStop(data->audioUnit);
633 if(err != noErr)
634 ERR("AudioOutputUnitStop failed\n");
637 static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples)
639 ca_data *data = (ca_data*)device->ExtraData;
640 AudioBufferList *list;
641 UInt32 frameCount;
642 OSStatus err;
644 // If no samples are requested, just return
645 if(samples == 0)
646 return ALC_NO_ERROR;
648 // Allocate a temporary AudioBufferList to use as the return resamples data
649 list = alloca(sizeof(AudioBufferList) + sizeof(AudioBuffer));
651 // Point the resampling buffer to the capture buffer
652 list->mNumberBuffers = 1;
653 list->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame;
654 list->mBuffers[0].mDataByteSize = samples * data->frameSize;
655 list->mBuffers[0].mData = buffer;
657 // Resample into another AudioBufferList
658 frameCount = samples;
659 err = AudioConverterFillComplexBuffer(data->audioConverter, ca_capture_conversion_callback,
660 device, &frameCount, list, NULL);
661 if(err != noErr)
663 ERR("AudioConverterFillComplexBuffer error: %d\n", err);
664 return ALC_INVALID_VALUE;
666 return ALC_NO_ERROR;
669 static ALCuint ca_available_samples(ALCdevice *device)
671 ca_data *data = device->ExtraData;
672 return RingBufferSize(data->ring) / data->sampleRateRatio;
676 static const BackendFuncs ca_funcs = {
677 ca_open_playback,
678 ca_close_playback,
679 ca_reset_playback,
680 ca_start_playback,
681 ca_stop_playback,
682 ca_open_capture,
683 ca_close_capture,
684 ca_start_capture,
685 ca_stop_capture,
686 ca_capture_samples,
687 ca_available_samples
690 ALCboolean alc_ca_init(BackendFuncs *func_list)
692 *func_list = ca_funcs;
693 return ALC_TRUE;
696 void alc_ca_deinit(void)
700 void alc_ca_probe(enum DevProbe type)
702 switch(type)
704 case ALL_DEVICE_PROBE:
705 AppendAllDevicesList(ca_device);
706 break;
707 case CAPTURE_DEVICE_PROBE:
708 AppendCaptureDeviceList(ca_device);
709 break;