Problem loading Cocoa AU view
Problem loading Cocoa AU view
- Subject: Problem loading Cocoa AU view
- From: Michael Hanna <email@hidden>
- Date: Tue, 15 Mar 2005 15:14:32 -0500
Hello all, I'm developing the Cocoa UI and I'm having trouble after
adding my own parameters. The trouble arises in the _addListener
callback. It appears that it's registering each parameter with the
mParameterListener. It's in a loop, so I'm not sure why it'd 'work
fine' with the single default parameter, but not multiple ones. Any
suggestions?
On a side-note, this AU has Properties also. Is there a way to register
the two states of the NSPopUpButton to set the NSSliders to their
appropriate states and make sure that the proper changes are noted via
the listeners?
Michael
*** Assertion failure in -[CocoaView _addListeners],
/Users/tao/tmp/checkout/unitapdelay/trunk/CocoaView.m:161
[CocoaView _addListeners] AUListenerAddParameter()
*** Assertion failure in -[CocoaView _addListeners],
/Users/tao/tmp/checkout/unitapdelay/trunk/CocoaView.m:161
[CocoaView _addListeners] AUListenerAddParameter()
- (void)_addListeners {
NSAssert ( AUListenerCreate( ParameterListenerDispatcher, self,
CFRunLoopGetCurrent(),
kCFRunLoopDefaultMode, 0.100, // 100 ms
&mParameterListener ) == noErr,
@"[CocoaView _addListeners] AUListenerCreate()");
int i;
for (i = 0; i < kNumberOfParameters; ++i) {
parameter[i].mAudioUnit = mAU;
NSAssert ( AUListenerAddParameter (mParameterListener, NULL,
¶meter[i]) == noErr,
@"[CocoaView _addListeners]
AUListenerAddParameter()"); // fails here
}
}
related constructs ~~~~~~~
enum {
kParam_DelayLevel =0,
kParam_DelayTime =1,
kParam_DryWetMix =2,
kNumberOfParameters =3
};
#pragma mark ____ LISTENER CALLBACK DISPATCHER ____
AudioUnitParameter parameter[] = { { 0, kParam_DelayLevel,
kAudioUnitScope_Global, 0 },
{ 0, kParam_DelayTime, kAudioUnitScope_Global, 0 },
{ 0, kParam_DelayTime, kAudioUnitScope_Global, 0 }
};
[...]
#pragma mark ____ LISTENER CALLBACK DISPATCHEE ____
- (void)_parameterListener:(void *)inObject parameter:(const
AudioUnitParameter *)inParameter value:(Float32)inValue {
//inObject ignored in this case.
switch (inParameter->mParameterID) {
case kParam_DelayLevel:
[uiDelayLevelSlider setFloatValue:inValue];
[uiDelayLevelTextField setStringValue:[[NSNumber
numberWithFloat:inValue] stringValue]];
break;
case kParam_DelayTime:
[uiDelayTimeSlider setFloatValue:inValue];
[uiDelayTimeTextField setStringValue:[[NSNumber
numberWithFloat:inValue] stringValue]];
break;
case kParam_DryWetMix:
[uiDryWetMixSlider setFloatValue:inValue];
[uiDryWetMixTextField setStringValue:[[NSNumber
numberWithFloat:inValue] stringValue]];
break;
}
}
_______________________________________________
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