Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MatrixMixer input bus connection info




On Mar 8, 2007, at 3:03 PM, email@hidden wrote:

I am dynamically connecting and disconnecting AudioUnits to a MatrixMixer
and I am looking for a way to find the first "free" input bus that is
currently not connected.

FWIW, I do this but I do it with basic foundation classes, e.g:

NSMutableDictionary *_usedBusToSound; ///< Map from bus number to Sound object pointer.
NSMutableDictionary *_soundToUsedBus; ///< Map from Sound object pointer to bus number.
NSMutableArray *_freeBusses; ///< List of free bus numbers.


And just update the maps and lists when I make changes to the MatrixMixer.

e.g.:

- (OSStatus) attachSound: (id) sound
{
OSStatus err = noErr;
NSValue *soundAddress = [NSValue valueWithPointer:sound];
NSNumber *bus;

@synchronized(self) {
@synchronized(_usedBusToSound) {
bus = [_soundToUsedBus objectForKey:soundAddress];
if (bus != nil)
return noErr;

#if SOUND_DEVICE_DEBUG
NSLog( @"Attaching %@ to %@", sound, [self deviceName] );
#endif
if ([_freeBusses count] == 0) {
NSLog( @"WARNING: No busses left for device '%@'!", [self deviceName] );
return -1;
}

bus = [_freeBusses objectAtIndex:0];
[_usedBusToSound setObject:soundAddress forKey:bus];
[_soundToUsedBus setObject:bus forKey:soundAddress];
[_freeBusses removeObjectAtIndex:0];
}

[self setInputEnabled:YES forBus:[bus intValue]];
err = AUGraphStart(_graph);
}

return err;
}



I don't recall if you can query the MatrixMixer directly for the info you want.


Christopher
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/coreaudio-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.