void Ducker_Global::ToggleMusicBot(uint64 serverConnectionHandlerID, anyID clientID) { Print(QString("(ToggleMusicBot) %1").arg(clientID),serverConnectionHandlerID,LogLevel_DEBUG); unsigned int error; QString uid; if (TSHelpers::GetClientUID(serverConnectionHandlerID,clientID,uid) != ERROR_ok) { Error("(ToggleMusicBot)"); return; } if (DuckTargets->contains(uid)) { DuckTargets->remove(uid); UpdateActive(); vols->RemoveVolume(serverConnectionHandlerID,clientID); } else { char name[512]; if((error = ts3Functions.getClientDisplayName(serverConnectionHandlerID, clientID, name, 512)) != ERROR_ok) { Error("(ToggleMusicBot) Error getting client display name",serverConnectionHandlerID,error); return; } DuckTargets->insert(uid,name); UpdateActive(); AddMusicBotVolume(serverConnectionHandlerID,clientID); } SaveDuckTargets(); }
void EffectRack::MoveRowUp(int row) { Effect *effect = mEffects[row]; mEffects.RemoveAt(row); mEffects.Insert(effect, row - 1); int state = mPowerState[row]; mPowerState.RemoveAt(row); mPowerState.Insert(state, row - 1); state = mFavState[row]; mFavState.RemoveAt(row); mFavState.Insert(state, row - 1); row *= NUMCOLS; for (int i = 0; i < NUMCOLS; i++) { wxSizerItem *si = mMainSizer->GetItem(row + NUMCOLS - 1); wxWindow *w = si->GetWindow(); int flags = si->GetFlag(); int border = si->GetBorder(); int prop = si->GetProportion(); mMainSizer->Detach(row + NUMCOLS - 1); mMainSizer->Insert(row - NUMCOLS, w, prop, flags, border); } mMainSizer->Layout(); Refresh(); UpdateActive(); }
void Ducker_Global::onTalkStatusChanged(uint64 serverConnectionHandlerID, int status, bool isReceivedWhisper, anyID clientID, bool isMe) { Q_UNUSED(isReceivedWhisper); if (isMe || !isRunning()) return; if (DuckTargets->isEmpty()) return; // Compute if this change causes a ducking change if ((!isActive()) && (status==STATUS_TALKING)) { if (!isClientMusicBotRt(serverConnectionHandlerID,clientID)) setActive(true); } else if (isActive() && (status==STATUS_NOT_TALKING)) UpdateActive(); if ((status==STATUS_TALKING) || (status==STATUS_NOT_TALKING)) { DspVolumeDucker* vol = qobject_cast<DspVolumeDucker*>(vols->GetVolume(serverConnectionHandlerID,clientID)); if (vol != 0) vol->setProcessing(status==STATUS_TALKING); } }
void Ducker_Global::onRunningStateChanged(bool value) { if(m_ContextMenuToggleMusicBot == -1) { m_ContextMenuToggleMusicBot = TSContextMenu::instance()->Register(this,PLUGIN_MENU_TYPE_CLIENT,"Toggle Global Ducking Target","duck_16.png"); connect(TSContextMenu::instance(),SIGNAL(FireContextMenuEvent(uint64,PluginMenuType,int,uint64)),SLOT(onContextMenuEvent(uint64,PluginMenuType,int,uint64)),Qt::AutoConnection); } if (value) { connect(talkers,SIGNAL(ConnectStatusChanged(uint64,int,uint)),vols,SLOT(onConnectStatusChanged(uint64,int,uint)),Qt::UniqueConnection); uint64* servers; if(ts3Functions.getServerConnectionHandlerList(&servers) == ERROR_ok) { uint64* server; for(server = servers; *server != (uint64)NULL; ++server) { int status; if (ts3Functions.getConnectionStatus(*server, &status) != ERROR_ok) continue; if (status != STATUS_CONNECTION_ESTABLISHED) continue; unsigned int error; // Get My Id on this handler anyID myID; if((error = ts3Functions.getClientID(*server,&myID)) != ERROR_ok) { Error("onRunningStateChanged",*server,error); continue; } // Get My channel on this handler uint64 channelID; if((error=ts3Functions.getChannelOfClient(*server,myID,&channelID)) != ERROR_ok) Error("(onRunningStateChanged) Could not get channel of client.",*server,error); else onClientMoveEvent(*server, myID, 0, channelID, RETAIN_VISIBILITY, myID); } ts3Functions.freeMemory(servers); UpdateActive(); } } else { disconnect(talkers,SIGNAL(ConnectStatusChanged(uint64,int,uint)),vols,SLOT(onConnectStatusChanged(uint64,int,uint))); setActive(false); vols->RemoveVolumes(); } TSInfoData::instance()->Register(this,value,1); Log(QString("enabled: %1").arg((value)?"true":"false")); }
void SnapGadgets::Update(float dt) { if (_activeGameGadget) { _activeGameGadget->UpdateScrolling(dt); _activeGameGadget->Update(dt); } UpdateActive(); if(_currentEditorGadget){ _editTimer += dt; } }
void LinkedNode::Update(f32 delta_time) { if (active_) { UpdateActive(delta_time); } for (SceneObjectMap::iterator it = scene_objects_.begin(); it!= scene_objects_.end(); it++) { it->second->Update(delta_time); } }
void EffectRack::OnPower(wxCommandEvent & evt) { wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject()); int index = GetEffectIndex(btn); mPowerState[index] = !mPowerState[index]; if (mPowerState[index]) { btn->SetBitmapLabel(mPowerPushed); btn->SetBitmapSelected(mPowerPushed); } else { btn->SetBitmapLabel(mPowerRaised); btn->SetBitmapSelected(mPowerRaised); } UpdateActive(); }
void EffectRack::OnApply(wxCommandEvent & WXUNUSED(evt)) { AudacityProject *project = GetActiveProject(); for (size_t i = 0, cnt = mEffects.GetCount(); i < cnt; i++) { if (mPowerState[i]) { project->OnEffect(mEffects[i]->GetID(), true); mPowerState[i] = false; wxBitmapButton *btn = static_cast<wxBitmapButton *>(FindWindowById(ID_POWER + i)); btn->SetBitmapLabel(mPowerRaised); btn->SetBitmapSelected(mPowerRaised); } } UpdateActive(); }
void EffectRack::OnRemove(wxCommandEvent & evt) { wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject()); evt.Skip(); int index = GetEffectIndex(btn); if (index < 0) { return; } mEffects.RemoveAt(index); mPowerState.RemoveAt(index); mFavState.RemoveAt(index); if (mEffects.GetCount() == 0) { if (mTimer.IsRunning()) { mTimer.Stop(); } } index *= NUMCOLS; for (int i = 0; i < NUMCOLS; i++) { wxWindow *w = mMainSizer->GetItem(index)->GetWindow(); mMainSizer->Detach(index); delete w; } mMainSizer->Layout(); Fit(); UpdateActive(); }
void CDataPush::Start() { UpdateActive(); m_sConnection = m_mainworker.sOnDeviceReceived.connect(boost::bind(&CDataPush::OnDeviceReceived, this, _1, _2, _3, _4)); }
void EffectRack::OnBypass(wxCommandEvent & evt) { mBypassing = evt.GetInt() != 0; UpdateActive(); }
void EffectRack::Add(Effect *effect, bool active, bool favorite) { if (mEffects.Index(effect) != wxNOT_FOUND) { return; } wxBitmapButton *bb; wxASSERT(mPanel); // To justify safenew bb = safenew wxBitmapButton(mPanel, ID_POWER + mNumEffects, mPowerRaised); bb->SetBitmapSelected(mPowerRaised); bb->SetName(_("Active State")); bb->SetToolTip(_("Set effect active state")); mPowerState.Add(active); if (active) { bb->SetBitmapLabel(mPowerPushed); bb->SetBitmapSelected(mPowerPushed); } else { bb->SetBitmapLabel(mPowerRaised); bb->SetBitmapSelected(mPowerRaised); } mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); bb = safenew wxBitmapButton(mPanel, ID_EDITOR + mNumEffects, mSettingsRaised); bb->SetBitmapSelected(mSettingsPushed); bb->SetName(_("Show/Hide Editor")); bb->SetToolTip(_("Open/close effect editor")); mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); bb = safenew wxBitmapButton(mPanel, ID_UP + mNumEffects, mUpRaised); bb->SetBitmapSelected(mUpPushed); bb->SetBitmapDisabled(mUpDisabled); bb->SetName(_("Move Up")); bb->SetToolTip(_("Move effect up in the rack")); mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); bb = safenew wxBitmapButton(mPanel, ID_DOWN + mNumEffects, mDownRaised); bb->SetBitmapSelected(mDownPushed); bb->SetBitmapDisabled(mDownDisabled); bb->SetName(_("Move Down")); bb->SetToolTip(_("Move effect down in the rack")); mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); bb = safenew wxBitmapButton(mPanel, ID_FAV + mNumEffects, mFavRaised); bb->SetBitmapSelected(mFavPushed); bb->SetName(_("Favorite")); bb->SetToolTip(_("Mark effect as a favorite")); mFavState.Add(favorite); if (favorite) { bb->SetBitmapLabel(mFavPushed); bb->SetBitmapSelected(mFavPushed); } else { bb->SetBitmapLabel(mFavRaised); bb->SetBitmapSelected(mFavRaised); } mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); bb = safenew wxBitmapButton(mPanel, ID_REMOVE + mNumEffects, mRemoveRaised); bb->SetBitmapSelected(mRemovePushed); bb->SetName(_("Remove")); bb->SetToolTip(_("Remove effect from the rack")); mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); wxStaticText *text = safenew wxStaticText(mPanel, ID_NAME + mNumEffects, effect->GetName()); text->SetToolTip(_("Name of the effect")); mMainSizer->Add(text, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5); mMainSizer->Layout(); SetSize(GetMinSize()); Fit(); Update(); mEffects.Add(effect); mNumEffects++; if (!mTimer.IsRunning()) { mTimer.Start(1000); } if (active) { UpdateActive(); } }