void Oscillator::update( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { if( m_freq >= Engine::mixer()->processingSampleRate() / 2 ) { Mixer::clearAudioBuffer( _ab, _frames ); return; } if( m_subOsc != NULL ) { switch( m_modulationAlgoModel->value() ) { case PhaseModulation: updatePM( _ab, _frames, _chnl ); break; case AmplitudeModulation: updateAM( _ab, _frames, _chnl ); break; case SignalMix: updateMix( _ab, _frames, _chnl ); break; case SynchronizedBySubOsc: updateSync( _ab, _frames, _chnl ); break; case FrequencyModulation: updateFM( _ab, _frames, _chnl ); } } else { updateNoSub( _ab, _frames, _chnl ); } }
/** Processes all message received on the update 0MQ socket */ void QApplicationLauncher::subscribeMessageReceived(QList<QByteArray> messageList) { QByteArray topic; topic = messageList.at(0); m_rx.ParseFromArray(messageList.at(1).data(), messageList.at(1).size()); #ifdef QT_DEBUG std::string s; gpb::TextFormat::PrintToString(m_rx, &s); DEBUG_TAG(3, m_commandIdentity, "launcher update" << topic << QString::fromStdString(s)) #endif if (m_rx.type() == pb::MT_LAUNCHER_FULL_UPDATE) //value update { m_launchers = QJsonValue(QJsonArray()); // clear old value Service::updateValue(m_rx, &m_launchers, "launcher", "launcher"); // launcher protobuf value, launcher temp path emit launchersChanged(m_launchers); if (m_subscribeSocketState != Service::Up) { m_subscribeSocketState = Service::Up; updateState(Service::Connected); } updateSync(); if (m_rx.has_pparams()) { pb::ProtocolParameters pparams = m_rx.pparams(); startSubscribeHeartbeat(pparams.keepalive_timer() * 2); // wait double the time of the hearbeat interval } } else if (m_rx.type() == pb::MT_LAUNCHER_INCREMENTAL_UPDATE){ Service::updateValue(m_rx, &m_launchers, "launcher", "launcher"); // launcher protobuf value, launcher temp path emit launchersChanged(m_launchers); refreshSubscribeHeartbeat(); } else if (m_rx.type() == pb::MT_PING) { if (m_subscribeSocketState == Service::Up) { refreshSubscribeHeartbeat(); } else { updateState(Service::Connecting); unsubscribe("launcher"); // clean up previous subscription subscribe("launcher"); // trigger a fresh subscribe -> full update } } else if (m_rx.type() == pb::MT_LAUNCHER_ERROR) { QString errorString; for (int i = 0; i < m_rx.note_size(); ++i) { errorString.append(QString::fromStdString(m_rx.note(i)) + "\n"); } m_subscribeSocketState = Service::Down; updateState(Service::Error, Service::CommandError, errorString); #ifdef QT_DEBUG DEBUG_TAG(1, m_commandIdentity, "proto error on subscribe" << errorString) #endif }
void QApplicationStatus::statusMessageReceived(const QList<QByteArray> &messageList) { QByteArray topic; topic = messageList.at(0); m_rx.ParseFromArray(messageList.at(1).data(), messageList.at(1).size()); #ifdef QT_DEBUG std::string s; gpb::TextFormat::PrintToString(m_rx, &s); DEBUG_TAG(3, "status", "update" << topic << QString::fromStdString(s)) #endif if ((m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) || (m_rx.type() == pb::MT_EMCSTAT_INCREMENTAL_UPDATE)) { if ((topic == "motion") && m_rx.has_emc_status_motion()) { updateMotion(m_rx.emc_status_motion()); if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { updateSync(MotionChannel); } } if ((topic == "config") && m_rx.has_emc_status_config()) { updateConfig(m_rx.emc_status_config()); if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { updateSync(ConfigChannel); } } if ((topic == "io") && m_rx.has_emc_status_io()) { updateIo(m_rx.emc_status_io()); if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { updateSync(IoChannel); } } if ((topic == "task") && m_rx.has_emc_status_task()) { updateTask(m_rx.emc_status_task()); if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { updateSync(TaskChannel); } } if ((topic == "interp") && m_rx.has_emc_status_interp()) { updateInterp(m_rx.emc_status_interp()); if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { updateSync(InterpChannel); } } if (m_rx.type() == pb::MT_EMCSTAT_FULL_UPDATE) { if (m_statusSocketState != Up) { m_statusSocketState = Up; updateState(Connected); } if (m_rx.has_pparams()) { pb::ProtocolParameters pparams = m_rx.pparams(); startStatusHeartbeat(pparams.keepalive_timer() * 2); // wait double the time of the hearbeat interval } } else { refreshStatusHeartbeat(); } return; } else if (m_rx.type() == pb::MT_PING) { if (m_statusSocketState == Up) { refreshStatusHeartbeat(); } else { updateState(Connecting); unsubscribe(); // clean up previous subscription subscribe(); // trigger a fresh subscribe } return; } #ifdef QT_DEBUG gpb::TextFormat::PrintToString(m_rx, &s); DEBUG_TAG(1, "status", "update: unknown message type: " << QString::fromStdString(s)) #endif }