void AudioTrack::addPlugin(BasePlugin* plugin, int idx)/*{{{*/ { if(debugMsg) qDebug("AudioTrack::addPlugin(%p, %d) \n", plugin, idx); if (!plugin) { BasePlugin* oldPlugin = (*_efxPipe)[idx]; if (oldPlugin) { oldPlugin->setId(-1); oldPlugin->setTrack(0); uint32_t paramCount = oldPlugin->getParameterCount(); for (uint32_t i = 0; i < paramCount; i++) { ParameterPort* paramPort = oldPlugin->getParameterPort(i); if (! paramPort || paramPort->type != PARAMETER_INPUT || (paramPort->hints & PARAMETER_IS_AUTOMABLE) == 0) continue; int id = genACnum(idx, i); removeController(id); } _efxPipe->remove(idx); } } if (plugin) { idx = efxPipe()->addPlugin(plugin, idx); plugin->setId(idx); plugin->setTrack(this); uint32_t paramCount = plugin->getParameterCount(); for (uint32_t i = 0; i < paramCount; i++) { ParameterPort* paramPort = plugin->getParameterPort(i); if (! paramPort || paramPort->type != PARAMETER_INPUT || (paramPort->hints & PARAMETER_IS_AUTOMABLE) == 0) continue; int id = genACnum(idx, i); CtrlValueType t = plugin->valueType(); CtrlList* cl = new CtrlList(id); cl->setRange(paramPort->ranges.min, paramPort->ranges.max); cl->setName(plugin->getParameterName(i)); cl->setPluginName(plugin->name()); cl->setUnit(plugin->getParameterUnit(i)); cl->setValueType(t); if (paramPort->hints & PARAMETER_IS_TOGGLED) cl->setMode(CtrlList::DISCRETE); else cl->setMode(CtrlList::INTERPOLATE); cl->setCurVal(plugin->getParameterValue(i)); addController(cl); } } }/*}}}*/
void Song::removeAllControllers() { while (m_controllers.size() != 0) { removeController(m_controllers.at(0)); } m_controllers.clear(); }
//----------------------------------------------------------------------------------------------------------------------------- // 设置控制器 void PersonView::setController(ControllerBase* controller) { removeController(); // 先释放掉原先的控制器 mController = controller; controller->setControllerListener(this); addChild(controller); float sp = (float)mConfig->speed() / 10; controller->setSpeed(sp); }
void SipperMediaListener::_handleAcceptedController(int accSock) { SipperMediaController controller; controller.listener = this; addController(accSock, &controller); controller.handleRequest(accSock); removeController(accSock); }
void Song::removeAllControllers() { for (int i = 0; i < m_controllers.size(); ++i) { removeController(m_controllers.at(i)); } m_controllers.clear(); }