| 
 | 
| Q: How can I disable specific audio channels when recording?A: Use the  IMPORTANT: The  To use the attribute, run the session (start capturing data) and then observe when the format description of the connection changes. Applications can be notified of changes to a connection’s format by registering to receive the  Listing 1: Registering for the   // Register for changes to a connection's format
  [[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(connectionFormatDidChange:) 
    name:QTCaptureConnectionFormatDescriptionDidChangeNotification 
    object:nil];Once this change notification fires, you should first check if the attribute is writable, and then use it to enable the desired audio channels on the connection. Listing 2: Using the   // This method called when the connection format changes
  - (void)connectionFormatDidChange:(NSNotification *)notification
  {
    // You may now use the QTCaptureConnectionEnabledAudioChannelsAttribute
    // attribute to enable audio channels for the connection
    [self enableAudioChannelsForConnection:[self myAudioCaptureConnection]];
  }
  // Specify the audio channels that should be used on the connection
  -(void) enableAudioChannelsForConnection:(QTCaptureConnection *)captureConnection
  {
    // Make sure attribute is writeable before we use it
    if ([captureConnection attributeIsReadOnly:
      QTCaptureConnectionEnabledAudioChannelsAttribute] == NO)
    {
      NSRange channelIndexes;
      channelIndexes.location = 0;
      channelIndexes.length = 2;
      NSIndexSet *channelIndexSet = 
        [NSIndexSet indexSetWithIndexesInRange:channelIndexes];
      // Example: enable audio channels 1,2 (only) for the connection
      [captureConnection setAttribute:channelIndexSet 
        forKey:QTCaptureConnectionEnabledAudioChannelsAttribute];
    }
  }ReferencesTechnical Q&A QA1607 QTKit Capture - Disabling Audio Or Video When Capturing From a Muxed Device Document Revision History
 Posted: 2008-10-13 | 
| 
 |