• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: aggregate device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: aggregate device


  • Subject: Re: aggregate device
  • From: "Christoph Teschner" <email@hidden>
  • Date: Sat, 29 Apr 2006 21:06:20 +0200

Jeff,

thanks a lot for your help.
I was able to remove the mistakes I've made in my code and I've done the work around you suggested in order to create the aggregate device.
I am no longer getting any errors, however I'm not sure if everything is working as it should be. The newly generated aggregate device appears in Audio MIDI Setup, but it still has 0 In and Out channels and the Build-In Audio is not selected for use (instead an unnamed device without channels is selected for use).
Any further advice would be great.


thanks again,
Christoph

This is the newly modified code:

// 2. Create a CFDictionary that describes the aggregate device you want to create...
// the keys are in <CoreAudio/AudioHardware.h> -> unique UID


CFMutableDictionaryRef myDict = CFDictionaryCreateMutable(kCFAllocatorDefault,0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

CFDictionarySetValue(myDict, CFSTR( "uid" ),CFSTR( "ChristophAggregate2" ));
CFDictionarySetValue(myDict, CFSTR( "name" ),CFSTR( "ChristophAggregate2" ));


SInt32 privateKey = 0;
CFDictionarySetValue(myDict, CFSTR( "private" ),CFNumberCreate(NULL, kCFNumberSInt32Type, &privateKey));


	// 3. Tell the base plug-in to create the aggregate device using
	//		kAudioPlugInCreateAggregateDevice.

	UInt32 outDataSize;

	AudioObjectPropertyAddress theAddress;
	theAddress.mSelector = kAudioPlugInCreateAggregateDevice;
	theAddress.mScope = kAudioObjectPropertyScopeGlobal;
	theAddress.mElement = kAudioObjectPropertyElementMaster;

result = AudioObjectGetPropertyDataSize(theID, &theAddress, 0, NULL, &outDataSize);

AudioObjectID theNewPsoidoID;
result = AudioObjectGetPropertyData(theID, &theAddress, sizeof(CFDictionaryRef), &myDict, &outDataSize, &theNewPsoidoID);
if(result != kAudioHardwareNoError) NSLog(@"AudioObjectGetPropertyData error");



//get list of all audio devices -> Build-In Audio is in deviceList[0]
int numDevices;
AudioDeviceID * deviceList;
AudioHardwareGetPropertyInfo ( kAudioHardwarePropertyDevices, &theSize, NULL );
numDevices = theSize / sizeof(AudioDeviceID);
deviceList = (AudioDeviceID *) malloc ( theSize );
AudioHardwareGetProperty ( kAudioHardwarePropertyDevices, &theSize, deviceList );


	//workaround: kAudioAggregateDevicePropertyFullSubDeviceList

	CFMutableArrayRef mySubDeviceList = CFArrayCreateMutable(NULL,0,NULL);

CFStringRef mySubdevice = CFStringCreateWithFormat(NULL, NULL, CFSTR("%i"), deviceList[0]);
CFArrayAppendValue(mySubDeviceList,mySubdevice);


	theAddress.mSelector = kAudioAggregateDevicePropertyFullSubDeviceList;
	theAddress.mScope = kAudioObjectPropertyScopeGlobal;
	theAddress.mElement = kAudioObjectPropertyElementMaster;

result = AudioObjectSetPropertyData(theNewPsoidoID, &theAddress,0,NULL,sizeof(CFArrayRef), &mySubDeviceList);
if(result != kAudioHardwareNoError) NSLog(@"AudioObjectGetPropertyData error");


//workaround kAudioAggregateDevicePropertyMasterSubDevice
CFStringRef myMasterSubdevice = CFStringCreateWithFormat(NULL, NULL, CFSTR("%i"), deviceList[0]);


	theAddress.mSelector = kAudioAggregateDevicePropertyMasterSubDevice;
	theAddress.mScope = kAudioObjectPropertyScopeGlobal;
	theAddress.mElement = kAudioObjectPropertyElementMaster;

result = AudioObjectSetPropertyData(theNewPsoidoID, &theAddress,0,NULL,sizeof(CFStringRef), &myMasterSubdevice);
if(result != kAudioHardwareNoError) NSLog(@"AudioObjectGetPropertyData error");



_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: aggregate device (From: Jeff Moore <email@hidden>)

  • Prev by Date: Re: atexit and kAudioDevicePropertyDeviceIsRunning problem
  • Next by Date: inOffsetSampleFrame?
  • Previous by thread: Re: aggregate device
  • Next by thread: PlayFile to file stream
  • Index(es):
    • Date
    • Thread