• 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: Audio Units: calling SetParameter from within Process()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio Units: calling SetParameter from within Process()


  • Subject: Re: Audio Units: calling SetParameter from within Process()
  • From: William Stewart <email@hidden>
  • Date: Tue, 29 Aug 2006 15:48:12 -0700

You are missing some code here:

On 29/08/2006, at 2:19 PM, Artemiy Pavlov wrote:

Hello all!

William: thanks for the reply and the tip!

I tried the example in "CAAUMIDIMapManager":

	mAudioUnit->SetParameter( kTempo, HostTempo );

	AudioUnitParameter event;

event.mEventType = kAudioUnitEvent_ParameterValueChange;
event.mArgument.mParameter.mAudioUnit = mAudioUnit- >GetComponentInstance();

You are creating a fresh event struct, this is NOT what this code does: what it does is uses a setup local:
AudioUnitEvent event;
event.mEventType = kAudioUnitEvent_ParameterValueChange;
event.mArgument.mParameter.mAudioUnit = inAUBase.GetComponentInstance ();


Then in the loop:

		if (map.MIDI_Matches(inChannel, inData1, inData2, value))
		{
			inAUBase.SetParameter ( map.mParameterID, map.mScope, map.mElement,
									map.ParamValueFromMIDILinear(value), inBufferOffset);

			event.mArgument.mParameter.mParameterID = map.mParameterID;
			event.mArgument.mParameter.mScope = map.mScope;
			event.mArgument.mParameter.mElement = map.mElement;

			AUEventListenerNotify(NULL, NULL, &event);
			ret_value = true;
		}

If you don't set up the parameter info (which what you posted didn't), then you are sending a notification for some random parameterID/element/scope - so, basically the code you posted wouldn't work. If you add the three lines above to set up event.mArgument.mParameter to the code you posted, then it will work.

Bill


This will compile but won't work. Also, according to Stiwi's suggestion (BTW I am not sure how you call SetParameter and GetComponentInstance without the object, at my side it raises an error and I have to add mAudioUnit to them), I had:


		mAudioUnit->SetParameter( kTempo, HostTempo );

		AudioUnitParameter param;

		param.mAudioUnit = mAudioUnit->GetComponentInstance();
		param.mScope = kAudioUnitScope_Global;
		param.mParameterID = kTempo;

		AUEventListenerNotify(NULL, NULL, &param);

But this raises an error:

error: cannot convert 'AudioUnitParameter*' to 'const AudioUnitEvent*' for argument '3' to 'OSStatus AUEventListenerNotify (AUListenerBase*, void*, const AudioUnitEvent*)'


Sorry guys I'd really need to do more reading but I have very poor C ++ and all these objects and stuff is really hard for me at this point in time... :-(



Thanks again very much,

Artemiy.
_______________________________________________
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

--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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: 
 >Audio Units: calling SetParameter from within Process() (From: Artemiy Pavlov <email@hidden>)
 >Re: Audio Units: calling SetParameter from within Process() (From: stiwi <email@hidden>)
 >Re: Audio Units: calling SetParameter from within Process() (From: Artemiy Pavlov <email@hidden>)

  • Prev by Date: Re: Audio Units: calling SetParameter from within Process()
  • Next by Date: HELP!
  • Previous by thread: Re: Audio Units: calling SetParameter from within Process()
  • Next by thread: Re: Audio Units: calling SetParameter from within Process()
  • Index(es):
    • Date
    • Thread