當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetParameter函數代碼示例

本文整理匯總了C++中GetParameter函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetParameter函數的具體用法?C++ GetParameter怎麽用?C++ GetParameter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetParameter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetParameter

 void GenericModel::AddParameter(const RooRealVar& var, Int_t nbins)
 {
    // Define a named parameter for the model, with its associated range
    // of values and the number of 'bins' to be used to scan these values
    fParameters.addClone(var);
    GetParameter(var.GetName()).setBins(nbins);
 }
開發者ID:GiuseppePast,項目名稱:kaliveda,代碼行數:7,代碼來源:GenericModel.cpp

示例2: CPLEXPrintFromSolver

int CPLEXPrintFromSolver(int lpcount) {
	int Status = 0;
	if (CPLEXenv == NULL) {
		FErrorFile() << "Cannot print problem to file because CPLEX environment is not open." << endl;
		FlushErrorFile();
		return FAIL;
	}

	if (CPLEXModel == NULL) {
		FErrorFile() << "Cannot print problem to file because no CPLEX model exists." << endl;
		FlushErrorFile();
		return FAIL;
	}
	
	string Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename")+itoa(lpcount));
	Status = CPXwriteprob (CPLEXenv, CPLEXModel,Filename.data(), "LP");

	if (Status) {
		FErrorFile() << "Cannot print problem to file for unknown reason." << endl;
		FlushErrorFile();
		return FAIL;
	}

	return SUCCESS;
}
開發者ID:samseaver,項目名稱:ProbModelSEED,代碼行數:25,代碼來源:CPLEXapi.cpp

示例3: GetParameterStr

void GetParameterStr(const char* parameter, char* str)
{
    if(str == NULL)
        fprintf(stderr, "Empty string passed to GetParameterStr\n");
    else
        strcpy(str, GetParameter(parameter));
}
開發者ID:ThomasHeegaard,項目名稱:C_Game_Engine,代碼行數:7,代碼來源:config_loader.c

示例4: GetParameter

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	ÇPROJECTNAMEÈ::ÇPROJECTNAMEÈKernel::Process
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void		ÇPROJECTNAMEÈ::ÇPROJECTNAMEÈKernel::Process(	const Float32 	*inSourceP,
                                                    Float32		 	*inDestP,
                                                    UInt32 			inFramesToProcess,
                                                    UInt32			inNumChannels, // for version 2 AudioUnits inNumChannels is always 1
                                                    bool			&ioSilence )
{

	//This code will pass-thru the audio data.
	//This is where you want to process data to produce an effect.

	
	UInt32 nSampleFrames = inFramesToProcess;
	const Float32 *sourceP = inSourceP;
	Float32 *destP = inDestP;
	Float32 gain = GetParameter( kParam_One );
	
	while (nSampleFrames-- > 0) {
		Float32 inputSample = *sourceP;
		
		//The current (version 2) AudioUnit specification *requires* 
	    //non-interleaved format for all inputs and outputs. Therefore inNumChannels is always 1
		
		sourceP += inNumChannels;	// advance to next frame (e.g. if stereo, we're advancing 2 samples);
									// we're only processing one of an arbitrary number of interleaved channels

			// here's where you do your DSP work
                Float32 outputSample = inputSample * gain;
		
		*destP = outputSample;
		destP += inNumChannels;
	}
}
開發者ID:fruitsamples,項目名稱:AudioUnitEffectTemplates,代碼行數:35,代碼來源:StarterAU.cpp

示例5: GetParameter

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	karoke::ProcessBufferLists
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus karoke::ProcessBufferLists	(AudioUnitRenderActionFlags&	iFlags, 
										 const 	AudioBufferList& 	inBufferList, 
										 AudioBufferList&	outBufferList, 
										 UInt32			iFrames) 
{ 
	float *leftSample = ((float*)inBufferList.mBuffers[0].mData);
	float *rightSample = ((float*)inBufferList.mBuffers[1].mData);
	float *leftOut = (float*)outBufferList.mBuffers[0].mData;
	float *rightOut = (float*)outBufferList.mBuffers[1].mData;

	Float32 gain = GetParameter( kParam_One );
	
	while (iFrames > 0) {
		float bass = filter.process(*leftSample);
		float karaoked = *leftSample - *rightSample;

		float output = karaoked + gain*bass;

		*leftOut = output; 
		*rightOut = output; 
		
		iFrames--;
		leftSample++;
		rightSample++;
		leftOut++;
		rightOut++;
	}
	
	return noErr; 
}
開發者ID:LupusDei,項目名稱:8LU-DSP,代碼行數:33,代碼來源:karoke.cpp

示例6: CALL

void
CBCI2000Controller::get_parameter( ArgList& ioArgs )
{
  std::string result;
  CALL( GetParameter( ioArgs.GetString( 1 ), result ) );
  ioArgs.SetString( 0, result );
}
開發者ID:ACrazyer,項目名稱:NeuralSystemsBCI2000,代碼行數:7,代碼來源:BCI2000Controller.cpp

示例7: GetData

//Fileoutput
int Gene::SaveGene(string InFilename) {
	if (InFilename.length() == 0) {
		InFilename = GetData("FILENAME",STRING);
		if (InFilename.length() == 0) {
			InFilename = GetData("DATABASE",STRING);
			if (InFilename.length() == 0) {
				return FAIL;
			}
		}
	}
	
	if (InFilename.substr(1,1).compare(":") != 0 && InFilename.substr(0,1).compare("/") != 0) {
		InFilename = GetDatabaseDirectory(false)+InFilename;
	}

	ofstream Output;
	if (!OpenOutput(Output,InFilename)) {
		return FAIL;
	}

	//First I check to see if the user specified that the input headers be printed in the output file
	vector<string>* FileHeader = StringToStrings(GetParameter("gene data to print"),";");
	vector<string> InputHeaders;
	for (int i=0; i < int(FileHeader->size()); i++) {
		if ((*FileHeader)[i].compare("INPUT_HEADER") == 0) {
			InputHeaders = GetAllData("INPUT_HEADER",STRING);
			break;
		}
	}

	for (int i=0; i < int(InputHeaders.size()); i++) {
		string Data;
		Interpreter(InputHeaders[i],Data,false);
		Output << InputHeaders[i] << "\t" << Data << endl;
	}

	for (int i=0; i < int(FileHeader->size()); i++) {
		//I check to see if the current file header has already been printed to file
		if ((*FileHeader)[i].compare("INPUT_HEADER") != 0) {
			int j =0;
			for (j=0; j < int(InputHeaders.size()); j++) {
				if (InputHeaders[j].compare((*FileHeader)[i]) == 0) {
					break;
				}
			}
			if (j == int(InputHeaders.size())) {
				//If the current file header has not already been printed to file, it is printed now
				string Data;
				Interpreter((*FileHeader)[i],Data,false);
				if (Data.length() > 0) {
					Output << (*FileHeader)[i] << "\t" << Data << endl;
				}
			}
		}
	}

	Output.close();
	return SUCCESS;
}
開發者ID:ModelSEED,項目名稱:Model-SEED-core,代碼行數:60,代碼來源:Gene.cpp

示例8: GetParameter

void	FragmentShader::SetParameter(std::string name, float*data) {
	CGparameter p = GetParameter(name);

	//DON'T try to set a non-existent parameter. GCM will instantly
	//fall over.
	if(p) {	
		cellGcmSetFragmentProgramParameter(program, p, data, offset);
	}
}
開發者ID:gambiting,項目名稱:Racer-PS3,代碼行數:9,代碼來源:Shader.cpp

示例9: switch

//--------------------------------------------------------------------------------
OSStatus SubSynth::GetProperty(AudioUnitPropertyID inPropertyID, AudioUnitScope inScope, AudioUnitElement inElement, void * outData)
{
	if (inScope == kAudioUnitScope_Global)
	{
		switch (inPropertyID)
		{
			case kAudioUnitProperty_ParameterValueFromString:
			{
				AudioUnitParameterValueFromString * name = (AudioUnitParameterValueFromString*)outData;
				if (name->inString == NULL)
					return kAudioUnitErr_InvalidPropertyValue;
				double paramValue_literal = CFStringGetDoubleValue(name->inString);
				switch (name->inParamID)
				{
					case kParam_Tune:
						if (paramValue_literal <= 0.0)
							name->outValue = 0.0;	// XXX avoid log10(0) or log10(-X)
						else
							name->outValue = (log10(paramValue_literal / (0.0726 * GetSampleRate())) + 2.5) / 1.5;
						break;
					case kParam_Release:
						return kAudioUnitErr_PropertyNotInUse;	// XXX I can't figure out how to invert this one
					default:
						return kAudioUnitErr_InvalidParameter;
				}
				return noErr;
			}

			case kAudioUnitProperty_ParameterStringFromValue:
			{
				AudioUnitParameterStringFromValue * name = (AudioUnitParameterStringFromValue*)outData;
				double paramValue = (name->inValue == NULL) ? GetParameter(name->inParamID) : *(name->inValue);
				int precision = 0;
				switch (name->inParamID)
				{
					case kParam_Tune:
						paramValue = 0.0726 * GetSampleRate() * pow(10.0, -2.5 + (1.5 * paramValue));
						precision = 3;
						break;
					case kParam_Release:
						paramValue = GetReleaseTimeForParamValue(paramValue);
						precision = 1;
						break;
					default:
						return kAudioUnitErr_InvalidParameter;
				}
				name->outString = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%.*f"), precision, paramValue);
				if (name->outString == NULL)
					return coreFoundationUnknownErr;
				return noErr;
			}
		}
	}

	return AUEffectBase::GetProperty(inPropertyID, inScope, inElement, outData);
}
開發者ID:arcanelab,項目名稱:mda-VST-plug-ins,代碼行數:57,代碼來源:subsynth.cpp

示例10: switch

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	SampleEffectUnit::GetProperty
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus			SampleEffectUnit::GetProperty (AudioUnitPropertyID 		inID,
									  AudioUnitScope 					inScope,
									  AudioUnitElement			 		inElement,
									  void *							outData)
{
	if (inScope == kAudioUnitScope_Global) {
		switch (inID) {            
			case kAudioUnitProperty_ParameterValueFromString:
			{
                OSStatus retVal = kAudioUnitErr_InvalidPropertyValue;
				AudioUnitParameterValueFromString &name = *(AudioUnitParameterValueFromString*)outData;
				if (name.inParamID != kParam_Four)
					return kAudioUnitErr_InvalidParameter;
				if (name.inString == NULL)
                    return kAudioUnitErr_InvalidPropertyValue;
                
                UniChar chars[2];
                chars[0] = '-';
                chars[1] = 0x221e; // this is the unicode symbol for infinity
                CFStringRef comparisonString = CFStringCreateWithCharacters (NULL, chars, 2);
                
                if ( CFStringCompare(comparisonString, name.inString, 0) == kCFCompareEqualTo ) {
                    name.outValue = kMinValue_ParamFour;
                    retVal = noErr;
                }
                
                if (comparisonString) CFRelease(comparisonString);
                
				return retVal;
			}
			case kAudioUnitProperty_ParameterStringFromValue:
			{
				AudioUnitParameterStringFromValue &name = *(AudioUnitParameterStringFromValue*)outData;
				if (name.inParamID != kParam_Four)
					return kAudioUnitErr_InvalidParameter;
				
				AudioUnitParameterValue paramValue = (name.inValue == NULL
													? GetParameter (kParam_Four)
													: *(name.inValue));
										
				// for this usage only values <= -120 dB (the min value) have
				// a special name "-infinity"
				if (paramValue <= kMinValue_ParamFour) {
					UniChar chars[2];
					chars[0] = '-';
					chars[1] = 0x221e; // this is the unicode symbol for infinity
					name.outString = CFStringCreateWithCharacters (NULL, chars, 2);
				} else
					name.outString = NULL;

				return noErr;
			}
		}
	}
	return AUEffectBase::GetProperty (inID, inScope, inElement, outData);
}
開發者ID:DannyDeng2014,項目名稱:CocoaSampleCode,代碼行數:60,代碼來源:SampleEffectUnit.cpp

示例11: GetParameterInt

int GetParameterInt(const char* parameter)
{
    char* tmp = GetParameter(parameter);
    if(tmp == NULL)
    {
        fprintf(stderr, "No parameter gotten, returning 0\n");
        return 0;
    }
    return ParseParameter(tmp);
}
開發者ID:ThomasHeegaard,項目名稱:C_Game_Engine,代碼行數:10,代碼來源:config_loader.c

示例12: printf

bool CommandParser::GetParameterE(char ID,char *type,...) {
	char **Out;

	int opt_index=GetOptionIndex(ID);
	if (opt_index==num_elements) return false;
	int n_param=GetNumOptionParameters(opt_index);


	int j=0;
	int lenght=(int)strlen(type);
	int num=-1;
	char *typeB=new char[strlen(type)+2];
	typeB[0]=0;

	for(int i=0;i<lenght;i++) {
		if (type[i]=='[') {
			if (j<=n_param) num=j;
			else break;
			continue;
		}
		if (type[i]==']') {
			if (j<=n_param) num=j;
			else break;
			continue;
		}
		typeB[j++]=type[i];
		typeB[j]=0;
	}
	if (j<=n_param) num=j;
	if (n_param!=num) {
		printf("Invalid number of parameters for option -%c.\n",ID);
		invalid_option_parameters=true;
		delete[]typeB;
		return false;
	}
	typeB[num]=0;

	if (!GetParameter(ID,1,Out)) {delete[]typeB;return false;}
	

	va_list marker;
	va_start(marker,type);
	for(int i=0;i<num;i++) {
		if (Out[i][0]=='-') {delete[]typeB;return false;}
		if (typeB[i]=='s') strcpy(va_arg(marker,char*),Out[i]);
		if (typeB[i]=='i') *va_arg(marker,int*)=atoi(Out[i]);
		if (typeB[i]=='c') *(va_arg(marker,char*))=Out[i][0];
		if (typeB[i]=='f') *(va_arg(marker,float*))=(float)atof(Out[i]);
		if (typeB[i]=='d') *(va_arg(marker,double*))=atof(Out[i]);
	}
	va_end(marker);
	delete[]typeB;
	return true;
}
開發者ID:ballanlu,項目名稱:GammaLib,代碼行數:54,代碼來源:IOAddOn.cpp

示例13: GetFlag

bool CommandParser::GetFlag(char ID) {
	char **Out;
	bool exists=GetParameter(ID,0,Out);
	if (exists) {
		if (GetNumOptionParameters(GetOptionIndex(ID))!=0) {
			printf("Invalid number of parameters for option -%c.\n",ID);
			invalid_option_parameters=true;
		}
	}
	return exists;
}
開發者ID:ballanlu,項目名稱:GammaLib,代碼行數:11,代碼來源:IOAddOn.cpp

示例14: GetParameter

bool CommandParser::GetParameter(char ID,char *type,...) {
	char **Out;
	int num=(int)strlen(type);

	if (!GetParameter(ID,num,Out)) return false;
	if (!GetParameter(ID,1,Out)) return false;
	
	va_list marker;
	va_start(marker,type);
	for(int i=0;i<num;i++) {
		if (Out[i][0]=='-') return false;
		if (type[i]=='s') strcpy(va_arg(marker,char*),Out[i]);
		if (type[i]=='i') *va_arg(marker,int*)=atoi(Out[i]);
		if (type[i]=='c') *(va_arg(marker,char*))=Out[i][0];
		if (type[i]=='f') *(va_arg(marker,float*))=(float)atof(Out[i]);
		if (type[i]=='d') *(va_arg(marker,double*))=atof(Out[i]);
	}
	va_end(marker);
	return true;
}
開發者ID:ballanlu,項目名稱:GammaLib,代碼行數:20,代碼來源:IOAddOn.cpp

示例15: GetParameter

void
mitk::GIFVolumetricStatistics::CalculateFeaturesUsingParameters(const Image::Pointer & feature, const Image::Pointer &mask, const Image::Pointer &, FeatureListType &featureList)
{
  auto parsedArgs = GetParameter();
  if (parsedArgs.count(GetLongName()))
  {
    MITK_INFO << "Start calculating Volumetric Features::....";
    auto localResults = this->CalculateFeatures(feature, mask);
    featureList.insert(featureList.end(), localResults.begin(), localResults.end());
    MITK_INFO << "Finished calculating volumetric features....";
  }
}
開發者ID:Cdebus,項目名稱:MITK,代碼行數:12,代碼來源:mitkGIFVolumetricStatistics.cpp


注:本文中的GetParameter函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。