Note that there are some explanatory texts on larger screens.

plurals
  1. POAudioQueue | Change audio device while audioQueue is running
    primarykey
    data
    text
    <p>i am using audio queue for playback and for record on OSX | Mac and have a use case,<br> Its something like, user may change the Audiodevice ( Input and output both ) while audio queue is running either for playback or for record, </p> <p>This is what i have done so far, </p> <pre><code>OSStatus result = noErr; // get the device list AudioObjectPropertyAddress thePropertyAddress = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; UInt32 thePropSize; CFStringRef theDeviceName; // get the device name thePropSize = sizeof(CFStringRef); thePropertyAddress.mSelector = kAudioObjectPropertyName; thePropertyAddress.mScope = kAudioObjectPropertyScopeGlobal; thePropertyAddress.mElement = kAudioObjectPropertyElementMaster; // get the name of the device result = AudioObjectGetPropertyData( (AudioObjectID)input, &amp;thePropertyAddress, 0, NULL, &amp;thePropSize, &amp;theDeviceName); if ( result != noErr){ log("Error while getting property"); return; } // get the uid of the device CFStringRef theDeviceUID; thePropertyAddress.mSelector = kAudioDevicePropertyDeviceUID; result = AudioObjectGetPropertyData( (AudioObjectID)input, &amp;thePropertyAddress, 0, NULL, &amp;thePropSize, &amp;theDeviceUID); try{ XThrowIfError(AudioQueueSetProperty(mQueue,kAudioQueueProperty_CurrentDevice,&amp;theDeviceUID, sizeof(CFStringRef)),"set input device"); } catch (CAXException e) { char buf[256]; fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf)); } </code></pre> <p>but its throwing an exception <strong>kAudioQueueErr_InvalidRunState</strong> , <a href="https://developer.apple.com/library/ios/documentation/MusicAudio/Reference/AudioQueueReference/Reference/reference.html#//apple_ref/doc/uid/TP40005117-CH5g-RCM0127" rel="nofollow">reference</a>saying its can't be done while queue is running; </p> <p>Is there any other way to achieve the same ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload