void ReplaceMaterialParam(const Palleon::MaterialPtr& material, const char* paramName, const CVector4& newParamValue) { auto param = material->GetEffectParameter(paramName); CVector4 paramValue(0, 0, 0, 0); if(param.IsVector3()) { paramValue = CVector4(param.GetVector3(), 0); } else { paramValue = param.GetVector4(); } paramValue.x = (newParamValue.x == 1000.f) ? paramValue.x : newParamValue.x; paramValue.y = (newParamValue.y == 1000.f) ? paramValue.y : newParamValue.y; paramValue.z = (newParamValue.z == 1000.f) ? paramValue.z : newParamValue.z; paramValue.w = (newParamValue.w == 1000.f) ? paramValue.w : newParamValue.w; if(param.IsVector3()) { param.SetVector3(paramValue.xyz()); } else { param.SetVector4(paramValue); } material->SetEffectParameter(paramName, param); }
static void methodRespContent(ParserControl *parm, parseUnion *stateUnion) { parseUnion lvalp={0}; ct = localLex(&lvalp, parm); if(ct == XTOK_ERROR) { dontLex = 1; error(parm, (parseUnion*)&lvalp.xtokErrorResp); } else if(ct == XTOK_RETVALUE || ct == XTOK_PARAMVALUE) { dontLex = 1; if(ct == XTOK_RETVALUE) { dontLex = 1; returnValue(parm, (parseUnion*)&lvalp.xtokReturnValue); } ct = localLex(&lvalp, parm); dontLex = 1; if(ct == XTOK_PARAMVALUE) { do { dontLex = 1; paramValue(parm, (parseUnion*)&lvalp.xtokParamValue); addParamValue(parm, &stateUnion->xtokMethodRespContent.values, &lvalp.xtokParamValue); ct = localLex(&lvalp, parm); } while(ct == XTOK_PARAMVALUE); dontLex = 1; } } else if(ct == ZTOK_METHODRESP) { dontLex = 1; } else { parseError("XTOK_ERROR or XTOK_RETVALUE or XTOK_PARAMVALUE or ZTOK_METHODRESP", ct, parm); } }
void MultiAgentTest::MyUpdateEventHandler( sml::smlUpdateEventId, void*, sml::Kernel* pKernel, sml::smlRunFlags ) { int agents = pKernel->GetNumberAgents() ; for (int agentIndex = 0 ; agentIndex < agents ; ++agentIndex) { sml::Agent* pAgent = pKernel->GetAgentByIndex( agentIndex ) ; CPPUNIT_ASSERT( pAgent != NULL ); char const* pIOString = pAgent->ExecuteCommandLine( "print --depth 4 i1" ) ; CPPUNIT_ASSERT( pIOString != NULL ); //std::cout << pIOString << std::endl ; // Make sure we can get the output link (had a bug where this wouldn't always work) sml::Identifier* pOutputLink = pAgent->GetOutputLink() ; CPPUNIT_ASSERT( pOutputLink != NULL ); // Read in the commands int numberCommands = pAgent->GetNumberCommands() ; for ( int i = 0 ; i < numberCommands ; ++i ) { sml::Identifier* pCommand = pAgent->GetCommand( i ) ; CPPUNIT_ASSERT( pCommand != NULL ); char const* pName = pCommand->GetCommandName() ; CPPUNIT_ASSERT( pName != NULL ); CPPUNIT_ASSERT( std::string( pName ) == "result" ); // Receive the new total char const* pTotal = pCommand->GetParameterValue( "total" ) ; CPPUNIT_ASSERT( pTotal != NULL ); std::stringstream paramValue( pTotal ); int intTotal = 0; paramValue >> intTotal; // Mark command as completed in working memory pCommand->AddStatusComplete() ; // Place a new addition request on the input link UpdateInput( pAgent, intTotal ); } } }
CLauncherWindow::StringKeyValueMap CLauncherWindow::GetUrlParameters(const TCHAR* url) { std::map<std::tstring, std::tstring> parameters; auto paramStart = _tcschr(url, _T('?')); if(paramStart != nullptr) { while(1) { paramStart++; auto nextParam = _tcschr(paramStart, _T('&')); auto paramSeparatorPos = _tcschr(paramStart, _T('=')); if(paramSeparatorPos != nullptr) { auto paramEnd = nextParam ? nextParam : (paramStart + _tcslen(paramStart)); std::tstring paramName(paramStart, paramSeparatorPos); std::tstring paramValue(paramSeparatorPos + 1, paramEnd); parameters.insert(std::make_pair(paramName, paramValue)); } if(nextParam == nullptr) break; paramStart = nextParam; } } return parameters; }
MyString MultiLogFiles::getParamFromSubmitLine(MyString &submitLine, const char *paramName) { MyString paramValue(""); const char *DELIM = "="; submitLine.Tokenize(); const char * rawToken = submitLine.GetNextToken(DELIM, true); if ( rawToken ) { MyString token(rawToken); token.trim(); if ( !strcasecmp(token.Value(), paramName) ) { rawToken = submitLine.GetNextToken(DELIM, true); if ( rawToken ) { paramValue = rawToken; paramValue.trim(); } } } return paramValue; }
int synthv1_jack::process ( jack_nframes_t nframes ) { if (!m_activated) return 0; const uint16_t nchannels = synthv1::channels(); float *ins[nchannels], *outs[nchannels]; for (uint16_t k = 0; k < nchannels; ++k) { ins[k] = static_cast<float *> ( ::jack_port_get_buffer(m_audio_ins[k], nframes)); outs[k] = static_cast<float *> ( ::jack_port_get_buffer(m_audio_outs[k], nframes)); } const float bpm_sync = paramValue(synthv1::DEL1_BPMSYNC); if (bpm_sync > 0.0f) { const float bpm_host = paramValue(synthv1::DEL1_BPMHOST); if (bpm_host > 0.0f) { jack_position_t pos; jack_transport_query(m_client, &pos); if (pos.valid & JackPositionBBT) { const float bpm = float(pos.beats_per_minute); if (::fabs(bpm_host - bpm) > 0.01f) setParamValue(synthv1::DEL1_BPMHOST, bpm); } } } uint32_t ndelta = 0; #ifdef CONFIG_JACK_MIDI void *midi_in = ::jack_port_get_buffer(m_midi_in, nframes); if (midi_in) { const uint32_t nevents = ::jack_midi_get_event_count(midi_in); for (uint32_t n = 0; n < nevents; ++n) { jack_midi_event_t event; ::jack_midi_event_get(&event, midi_in, n); uint32_t nread = event.time - ndelta; if (nread > 0) { synthv1::process(ins, outs, nread); for (uint16_t k = 0; k < nchannels; ++k) { ins[k] += nread; outs[k] += nread; } } ndelta = event.time; synthv1::process_midi(event.buffer, event.size); } } #endif #ifdef CONFIG_ALSA_MIDI const jack_nframes_t buffer_size = ::jack_get_buffer_size(m_client); const jack_nframes_t frame_time = ::jack_last_frame_time(m_client); uint8_t event_buffer[1024]; jack_midi_event_t event; while (::jack_ringbuffer_peek(m_alsa_buffer, (char *) &event, sizeof(event)) == sizeof(event)) { if (event.time > frame_time) break; jack_nframes_t event_time = frame_time - event.time; if (event_time > buffer_size) event_time = 0; else event_time = buffer_size - event_time; if (event_time > ndelta) { const uint32_t nread = event_time - ndelta; if (nread > 0) { synthv1::process(ins, outs, nread); for (uint16_t k = 0; k < nchannels; ++k) { ins[k] += nread; outs[k] += nread; } } ndelta = event_time; } ::jack_ringbuffer_read_advance(m_alsa_buffer, sizeof(event)); ::jack_ringbuffer_read(m_alsa_buffer, (char *) event_buffer, event.size); synthv1::process_midi(event_buffer, event.size); } #endif // CONFIG_ALSA_MIDI synthv1::process(ins, outs, nframes - ndelta); return 0; }
void QueryManager::addExpression(VARIABLETYPE variableType, string variableName) { ASTParameter param(variableName, variableType); ASTParameterValue paramValue(param); expressionValueList[variableName] = paramValue; }