bool EffectPaulstretch::GetAutomationParameters(CommandParameters & parms) { parms.WriteFloat(KEY_Amount, mAmount); parms.WriteFloat(KEY_Time, mTime_resolution); return true; }
bool EffectNoise::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Type, kTypeStrings[mType].Internal()); parms.Write(KEY_Amp, mAmp); return true; }
bool EffectChangePitch::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Percentage, m_dPercentChange); parms.Write(KEY_UseSBSMS, mUseSBSMS); return true; }
bool EffectDtmf::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Sequence, dtmfSequence); parms.Write(KEY_DutyCycle, dtmfDutyCycle); parms.Write(KEY_Amplitude, dtmfAmplitude); return true; }
int main(int argc, char *argv[]) { QTextCodec *localCode = QTextCodec::codecForLocale(); //QTextCodec *localCode = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForLocale(localCode); QTextCodec::setCodecForCStrings(localCode); QTextCodec::setCodecForTr(localCode); QApplication a(argc, argv); MainWindow w; CommandParameters commandParameters; // 显示版本号时无视其它参数内容 if (commandParameters.hasVersion()) { printf(VERSION_STRING); return 0; } // 显示帮助时 无视 --command 参数值 立即显示出窗口 if (commandParameters.hasHelp()) { w.show(); return a.exec(); } // --command 参数没有时显示窗口 if (!commandParameters.isCommandMode()) { w.show(); return a.exec(); } // 命令行模式并且没有开启help // 进行 start 和 script 脚本执行判断 // 如果没有脚本可执行 则立即关闭自身 if (commandParameters.isCommandMode() && !commandParameters.hasHelp()) { // 开启命令模式时 --script 参数值为空则立即退出 if (commandParameters.hasScript() && commandParameters.getParams()["script"] == "") { a.quit(); return 0; } // 开启命令模式时 --script 参数值为空则立即退出 if (!commandParameters.hasScript() && !commandParameters.hasStart()) { a.quit(); return 0; } } // 用来修补sendEvent在不显示窗口时失效问题 // 先最小化显示再隐藏 // 初步怀疑是show窗口之后才能开始接收GUI归属的消息 w.showMinimized(); w.hide(); return a.exec(); }
bool EffectBassTreble::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Bass, mBass); parms.Write(KEY_Treble, mTreble); parms.Write(KEY_Gain, mGain); parms.Write(KEY_Link, mLink); return true; }
// ---------------------------------------------------------------- // void parseAndPack( CommandProcessor& cp , ParamType type , const char* value , CommandParameters& params , int& offset ) { if( type == ParamType_int ) { int val = atoi( value ); offset = params.pack( val, offset ); } else if( type == ParamType_float ) { float val = atof( value ); offset = params.pack( val, offset ); } else if( type == ParamType_bool ) { bool val = ( strcmp( value, "true" ) == 0 ); offset = params.pack( val, offset ); } else if( type == ParamType_string ) { offset = params.pack( value, offset ); } else if( type == ParamType_Vector2 ) { const char* delims = "{, }"; char buffer[MAX_STRING_BUFFER]; strncpy( buffer, value, MAX_STRING_BUFFER-1 ); const char* x = strtok( buffer, delims ); const char* y = strtok( NULL, delims ); parseAndPack( cp, ParamType_float, x, params, offset ); parseAndPack( cp, ParamType_float, y, params, offset ); } else if( type == ParamType_Vector3 ) { const char* delims = "{, }"; char buffer[MAX_STRING_BUFFER]; strncpy( buffer, value, MAX_STRING_BUFFER-1 ); const char* x = strtok( buffer, delims ); const char* y = strtok( NULL, delims ); const char* z = strtok( NULL, delims ); parseAndPack( cp, ParamType_float, x, params, offset ); parseAndPack( cp, ParamType_float, y, params, offset ); parseAndPack( cp, ParamType_float, z, params, offset ); } else if( type == ParamType_CommandableRef ) { CommandableRef val = cp.requestCommandable( value ); offset = params.pack( (int)(void*)val, offset ); } }
bool EffectWahwah::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Freq, mFreq); parms.Write(KEY_Phase, mPhase); parms.Write(KEY_Depth, mDepth); parms.Write(KEY_Res, mRes); parms.Write(KEY_FreqOfs, mFreqOfs); parms.Write(KEY_OutGain, mOutGain); return true; }
bool AudacityCommand::GetAutomationParameters(wxString & parms) { CommandParameters eap; if (mUIDialog && !TransferDataFromWindow()) { return false; } ShuttleGetAutomation S; S.mpEap = &eap; bool bResult = DefineParams( S ); wxASSERT_MSG( bResult, "You did not define DefineParameters() for this command" ); static_cast<void>(bResult); // fix unused variable warning in release mode return eap.GetParameters(parms); }
bool VampEffect::GetAutomationParameters(CommandParameters & parms) { for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++) { wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); float value = mPlugin->getParameter(mParameters[p].identifier); float lower = mParameters[p].minValue; float upper = mParameters[p].maxValue; if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && lower == 0.0 && upper == 1.0) { bool val = value > 0.5; parms.Write(key, val); } else if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && !mParameters[p].valueNames.empty()) { std::vector<EnumValueSymbol> choices; int val = 0; for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++) { wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); if (size_t(value - mParameters[p].minValue + 0.5) == i) { val = i; } choices.push_back(choice); } parms.WriteEnum(key, val, choices.data(), choices.size()); } else { parms.Write(key, value); } } return true; }
void MainWindow::initUserScript() { CommandParameters cmdParams; if (cmdParams.hasScript()) { QString scriptFunc = script->readFile(getAppPath() + cmdParams.getParams()["script"], QTextCodec::codecForName("UTF-8")); if (script->getScriptEngine()->canEvaluate(scriptFunc)) { script->runScript(scriptFunc); } else { ui->outputScriptResults_txt->setPlainText(scriptFunc); } } if (cmdParams.hasStart()) { QString scriptFunc = "App.loadScript(App.path + 'js/conf/init.js', function(err, func){func(App,App.webview)});"; script->runScript(scriptFunc); return; } }
bool EffectAutoDuck::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_DuckAmountDb, mDuckAmountDb); parms.Write(KEY_InnerFadeDownLen, mInnerFadeDownLen); parms.Write(KEY_InnerFadeUpLen, mInnerFadeUpLen); parms.Write(KEY_OuterFadeDownLen, mOuterFadeDownLen); parms.Write(KEY_OuterFadeUpLen, mOuterFadeUpLen); parms.Write(KEY_ThresholdDb, mThresholdDb); parms.Write(KEY_MaximumPause, mMaximumPause); return true; }
bool EffectScienFilter::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Type, kTypeStrings[mFilterType].Internal()); parms.Write(KEY_Subtype, kSubTypeStrings[mFilterSubtype].Internal()); parms.Write(KEY_Order, mOrder); parms.WriteFloat(KEY_Cutoff, mCutoff); parms.WriteFloat(KEY_Passband, mRipple); parms.WriteFloat(KEY_Stopband, mStopbandRipple); return true; }
bool EffectTruncSilence::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Threshold, mThresholdDB); parms.Write(KEY_ActIndex, kActionStrings[mActionIndex].Internal()); parms.Write(KEY_Minimum, mInitialAllowedSilence); parms.Write(KEY_Truncate, mTruncLongestAllowedSilence); parms.Write(KEY_Compress, mSilenceCompressPercent); parms.Write(KEY_Independent, mbIndependent); return true; }
bool VampEffect::SetAutomationParameters(CommandParameters & parms) { // First pass verifies values for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++) { wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); float lower = mParameters[p].minValue; float upper = mParameters[p].maxValue; bool good = false; if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && lower == 0.0 && upper == 1.0) { bool val; good = parms.Read(key, &val); } else if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && !mParameters[p].valueNames.empty()) { std::vector<EnumValueSymbol> choices; int val; for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++) { wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); choices.push_back(choice); } good = parms.ReadEnum(key, &val, choices.data(), choices.size()) && val != wxNOT_FOUND; } else { double val; good = parms.Read(key, &val) && val >= lower && val <= upper; } if (!good) { return false; } } // Second pass sets the variables for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++) { wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str()); float lower = mParameters[p].minValue; float upper = mParameters[p].maxValue; if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && lower == 0.0 && upper == 1.0) { bool val; parms.Read(key, &val); mPlugin->setParameter(mParameters[p].identifier, val ? upper : lower); } else if (mParameters[p].isQuantized && mParameters[p].quantizeStep == 1.0 && !mParameters[p].valueNames.empty()) { std::vector<EnumValueSymbol> choices; int val = 0; for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++) { wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str()); choices.push_back(choice); } parms.ReadEnum(key, &val, choices.data(), choices.size()); mPlugin->setParameter(mParameters[p].identifier, (float) val); } else { double val; parms.Read(key, &val); if (mParameters[p].isQuantized) { float qs = mParameters[p].quantizeStep; if (qs != 0.0) { val = (int)((val - lower) / qs + 0.5) * qs + lower; } } mPlugin->setParameter(mParameters[p].identifier, val); } } return true; }
bool EffectAmplify::GetAutomationParameters(CommandParameters & parms) { parms.WriteFloat(KEY_Ratio, mRatio); return true; }
bool EffectRepeat::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Count, repeatCount); return true; }
bool EffectChangeSpeed::GetAutomationParameters(CommandParameters & parms) { parms.Write(KEY_Percentage, m_PercentChange); return true; }