Re: Problem loading Cocoa AU view
Re: Problem loading Cocoa AU view
- Subject: Re: Problem loading Cocoa AU view
- From: Luke Bellandi <email@hidden>
- Date: Tue, 15 Mar 2005 13:54:25 -0800
Hi Michael,
On Mar 15, 2005, at 12:14 PM, Michael Hanna wrote:
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?
Have you added your parameters to the AudioUnit itself, or just in
the view code -- it's not clear from the code snippets below. Also,
1 typo I notice is:
#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 }
};
It looks like you've got a cut-and-paste error for the 3rd parameter
(should be kParam_DryWetMix instead of kParam_DelayTime again)
Luke
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
_______________________________________________
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