• 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: Setparameter problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Setparameter problem


  • Subject: RE: Setparameter problem
  • From: Pjotr kiwapta <email@hidden>
  • Date: Wed, 24 Sep 2008 21:30:46 +0200
  • Importance: Normal

Cynthia,

Thanks for the fast response. Here my answers to your questions:

> The instrument template gives an example on how to call this in the constructor method.
> Are your parameters in the global scope?

I am not sure, because I don't understand what is ment by these so called scopes. I created the parameters exactly the same way as in the TremoloUnit example. So they are not part of an object or namespace. So I suppose they have a global scope indeed.


> Did you create the necessary elements as indicated in the constructor example?

Not shure what you mean by the necessary elements, but I did everything the same way as the TremoloUnit example. The only thing I did different is that I have defined the parameters as integer instead of a float, and used the kAudioUnitParameterUnit_Indexed, because this is the only integer available (see my GetParameterInfo function below).(the parameters have to be integer by the way).

> Are you sure the parameterID's and values are correct?

Yes, I have defined them and use the definition instead of a value (again just like the example).


> You mean in the generic view? Can you post your GetParameterInfo function?

Yes. The Generic view shows the sliders. And when I move them, the events are triggered and do their thing the right way. Here is my GetParameterInfo function, though this seems to work fine:

OSStatus MyIns::GetParameterInfo(AudioUnitScope inScope, AudioUnitParameterID inParameterID, AudioUnitParameterInfo &outParameterInfo)
{
	if (inScope != kAudioUnitScope_Global) return kAudioUnitErr_InvalidScope;

    ComponentResult result = noErr;

	outParameterInfo.flags = SetAudioUnitParameterDisplayType (0, kAudioUnitParameterFlag_DisplaySquareRoot);
    outParameterInfo.flags += kAudioUnitParameterFlag_IsWritable | kAudioUnitParameterFlag_IsReadable;

    if (inScope == kAudioUnitScope_Global) {
		switch(inParameterID){
			case kParameter_MSB:
				AUBase::FillInParameterName(outParameterInfo,kParamName_MSB,false);
				outParameterInfo.unit = kAudioUnitParameterUnit_Indexed;
				outParameterInfo.minValue = 0;
				outParameterInfo.maxValue = 127;
				outParameterInfo.defaultValue = kMSB_default;
				break;
			case kParameter_LSB:

				etc..

            default:
                result = kAudioUnitErr_InvalidParameter;
                break;
		}
	}

	return result;
}

And for example I am using the following function for the factory preset:

OSStatus MyIns::NewFactoryPresetSet(const AUPreset &inNewFactoryPreset)
{
	SInt32 chosenPreset = inNewFactoryPreset.presetNumber;
	for(int i(0);iSetParameter(kParameter_MSB, kMSB_default);
					Globals()->SetParameter(kParameter_LSB, kLSB_default);
					Globals()->SetParameter(kParameter_SndNumber, kSndNumber_default);
					Globals()->SetParameter(kParameter_MidiChannel, kMidiChannel_default);
					break;
				case kPreset_PRE1:

                                        etc..

			}
			SetAFactoryPresetAsCurrent(kPresets[i]);
			return noErr;
		}
	}
    return kAudioUnitErr_InvalidProperty;
}




_________________________________________________________________
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl _______________________________________________
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: 
 >Setparameter problem (From: Pjotr kiwapta <email@hidden>)
 >Re: Setparameter problem (From: Cynthia Maxwell <email@hidden>)

  • Prev by Date: Re: ExtAudioFileSetProperty() fails
  • Next by Date: Re: ExtAudioFileSetProperty() fails
  • Previous by thread: Re: Setparameter problem
  • Next by thread: RE: Setparameter problem
  • Index(es):
    • Date
    • Thread