Exemplo n.º 1
0
void ParamEdit::CreateDefinedParam() {

	DefinedParam *np = new DefinedParam(GetBasePrefix(),
			GetParamNameFirstAndSecondPart() + GetParamName(),
			GetUnit(),
			GetFormula(),
			GetPrec(),
			GetFormulaType(),
			GetStartTime(),
			m_network_param);
	np->CreateParam();

	if (m_network_param) {
		m_remarks_handler->GetConnection()->InsertOrUpdateParam(np, this, false);
		delete np;
	} else {
		if (!m_creating_new) {
			m_cfg_mgr->SubstiuteDefinedParams(std::vector<DefinedParam*>(1, m_edited_param), std::vector<DefinedParam*>(1, np));
			m_edited_param = np;
		} else {
			m_cfg_mgr->GetDefinedDrawsSets()->AddDefinedParam(np);
			m_database_manager->AddParams(std::vector<DefinedParam*>(1, np));
		}
	}

}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// Finds a particular parameter	(works because the lowest parameters match the shader)
//-----------------------------------------------------------------------------
int CBaseShader::FindParamIndex( const char *pName ) const
{
	int numParams = GetNumParams();
	for( int i = 0; i < numParams; i++ )
	{
		if( Q_strnicmp( GetParamName( i ), pName, 64 ) == 0 )
		{
			return i;
		}
	}
	return -1;
}
CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
{
	if (HasNamedParams())
	{
		Float32 val = (value == NULL ? GetValue() : *value);
		int index = int(mParamInfo.minValue) + int(val);
		CFStringRef str = GetParamName (index);
		if (str) {
			CFRetain (str);
			return str;
		}
	}
	else if (ValuesHaveStrings()) 
	{
		AudioUnitParameterStringFromValue stringValue;
		stringValue.inParamID = mParameterID;
		stringValue.inValue = value;
		stringValue.outString = NULL;
		UInt32 propertySize = sizeof(stringValue);
		
		OSStatus err = AudioUnitGetProperty (mAudioUnit, 
											kAudioUnitProperty_ParameterStringFromValue,
											mScope, 
											0, 
											&stringValue, 
											&propertySize);
		
		if (!err && stringValue.outString != NULL)
			return stringValue.outString;
	}
	
	Float32 val = (value == NULL ? GetValue() : *value);
	AudioUnitParameterUnit unit = this->ParamInfo().unit;
	if (unit ==  kAudioUnitParameterUnit_Cents || unit == kAudioUnitParameterUnit_AbsoluteCents)
		return CreateLocalizedStringForParameterValue(val, this, 4, 0);
	else
		return CreateLocalizedStringForParameterValue(val, this, 4);
}
Exemplo n.º 4
0
void CEffectTxTDlg::SetEffect(int nEffectStk)
{
  int nEffect = APP->chaine_eff->get_effect(APP->current_chaine,nEffectStk);
  effstk = APP->chaine_eff->get(APP->current_chaine,nEffectStk);
CString sParm;
this->nEffect = nEffect;
this->nEffectStk = nEffectStk;
eff = (CSmpEffect *) APP->host->GetAt(nEffect);
m_lstparms.SetRedraw(FALSE);
m_lstparms.DeleteAllItems();
if (eff)
  {
    eff->SetParmWnd(this);

    for (int i = 0; i < eff->pEffect->numParams; i++)
    {
      GetParamName(i,sParm);
      int idx =   m_lstparms.InsertItem(i,sParm);
      GetParamVal(i,sParm);
      m_lstparms.SetItemText(idx,2,sParm);
      GetParamDisp(i,sParm);
      m_lstparms.SetItemText(idx,1,sParm);

      sParm.Format("%d",effstk->Get_Controleur(i));
      m_lstparms.SetItemText(idx,3,sParm);
      UpdateData();
      m_controleurnb = effstk->Get_Controleur(i);
      UpdateData(FALSE);
      m_lstparms.SetItemData(idx, i);
    }
  m_lstparms.SetCurSel(0);

  }
m_lstparms.SetRedraw(TRUE);
OnSelchangeParmlist();
}
Exemplo n.º 5
0
CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
{
	if (HasNamedParams())
	{
		Float32 val = (value == NULL ? GetValue() : *value);
		int index = int(mParamInfo.minValue) + int(val);
		CFStringRef str = GetParamName (index);
		if (str) {
			CFRetain (str);
			return str;
		}
	}
	else if (ValuesHaveStrings()) 
	{
		AudioUnitParameterStringFromValue stringValue;
		stringValue.inParamID = mParameterID;
		stringValue.inValue = value;
		stringValue.outString = NULL;
		UInt32 propertySize = sizeof(stringValue);
		
		OSStatus err = AudioUnitGetProperty (mAudioUnit, 
											kAudioUnitProperty_ParameterStringFromValue,
											mScope, 
											mParameterID, 
											&stringValue, 
											&propertySize);
		
		if (err == noErr && stringValue.outString != NULL)
			return stringValue.outString;
	}
	
	Float32 val = (value == NULL ? GetValue() : *value);
	char valstr[32];
	AUParameterFormatValue (val, this, valstr, 4);
	return CFStringCreateWithCString(NULL, valstr, kCFStringEncodingUTF8);
}
Exemplo n.º 6
0
void PullInfo(){
  printf("================================================================================\n");
  
  int major, minor, rev;
  glfwGetVersion(&major, &minor, &rev);
  printf("GLFW version is %i.%i.%i\n", major, minor, rev);
  
  int width, height;
  glfwGetWindowSize(&width, &height);
  printf("Window size is %i %i\n", width, height);
  
  int status = glfwGetKey(GLFW_KEY_LCTRL);
  if(status == GLFW_PRESS)
    printf("Left control is pressed\n");
  else
    printf("Left control is released\n");
    
  status = glfwGetMouseButton(GLFW_MOUSE_BUTTON_1);
  if(status == GLFW_PRESS)
    printf("Mouse button 1 is pressed\n");
  else
    printf("Mouse button 1 is released\n");
    
  int x, y;
  glfwGetMousePos(&x, &y);
  printf("Mouse position is %i %i\n", x, y);
  
  int wheel = glfwGetMouseWheel();
  printf("Mouse wheel pos is %i\n", wheel);
  
  double time = glfwGetTime();
  printf("Time is %f\n", time);
  
  glfwGetGLVersion(&major, &minor, &rev);
  printf("GL version is %i.%i.%i\n", major, minor, rev);
  
  int proc = glfwGetNumberOfProcessors();
  printf("%i processors are available\n", proc);
  
  unsigned int i;
  for(i = 0; i<nb_params; i++)
    printf(" - %-27s : %i\n", GetParamName(params[i]), glfwGetWindowParam(params[i]));
  
  const char* extension = "MOZ_WEBGL_compressed_texture_s3tc";
  printf("'%s' extension is %s.\n", extension, glfwExtensionSupported(extension) ? "supported" : "not supported");  
  
  extension = "GL_EXT_framebuffer_object";
  printf("'%s' extension is %s.\n", extension, glfwExtensionSupported(extension) ? "supported" : "not supported");
  
  extension = "glBindBuffer";
  void* proc_addr = glfwGetProcAddress(extension);
  printf("'%s' extension proc address is %p.\n", extension, proc_addr);
  
  printf("Sleeping 1 sec...\n");
  glfwSleep(1);
  printf("...Done.\n");
  
  printf("================================================================================\n");
  
#ifdef REPORT_RESULT  
  int result = 1;
  REPORT_RESULT();
#endif
}