void MediaRecorderImpl::stopRecorder(bool completed) { medvdbg("stopRecorder mCurState : %d\n", (recorder_state_t)mCurState); if ((mCurState != RECORDER_STATE_RECORDING && mCurState != RECORDER_STATE_PAUSED)) { notifyObserver(OBSERVER_COMMAND_ERROR); meddbg("stopRecorder Failed mCurState : %d\n", (recorder_state_t)mCurState); return; } audio_manager_result_t result = stop_audio_stream_in(); if (result != AUDIO_MANAGER_SUCCESS) { notifyObserver(OBSERVER_COMMAND_ERROR); meddbg("stop_audio_stream_in failed ret : %d\n", result); return; } mCurState = RECORDER_STATE_READY; if (completed) { notifyObserver(OBSERVER_COMMAND_FINISHIED); } else { notifyObserver(OBSERVER_COMMAND_ERROR); } RecorderWorker& mrw = RecorderWorker::getWorker(); mrw.setCurrentRecorder(nullptr); }
void MediaRecorderImpl::startRecorder() { medvdbg("startRecorder() mCurState : %d\n", (recorder_state_t)mCurState); if (mCurState != RECORDER_STATE_READY && mCurState != RECORDER_STATE_PAUSED) { notifyObserver(OBSERVER_COMMAND_ERROR); meddbg("startRecorder Failed mCurState : %d\n", (recorder_state_t)mCurState); return; } RecorderWorker& mrw = RecorderWorker::getWorker(); auto prevRecorder = mrw.getCurrentRecorder(); auto curRecorder = shared_from_this(); if (prevRecorder != curRecorder) { if (prevRecorder) { /** TODO Should be considered Audiofocus later **/ meddbg("stop prevRecorder\n"); prevRecorder->pauseRecorder(); } meddbg("set Current Recorder!!\n"); mrw.setCurrentRecorder(curRecorder); } mCurState = RECORDER_STATE_RECORDING; notifyObserver(OBSERVER_COMMAND_STARTED); }
//------------------------------------------------------------------------ // Purpose : Let the POLLing begin... //------------------------------------------------------------------------ void InputDevice::Poll() { HRESULT Hr; // Poll Keyboard if (m_pKeyboard) { Hr = m_pKeyboard->GetDeviceState(sizeof(m_KeyboardState), (void**)&m_KeyboardState); if (FAILED(Hr)) { // Keyboard lost ... ZeroMemory(m_KeyboardState, sizeof(m_KeyboardState)); // try to acquire next time we poll Hr = m_pKeyboard->Acquire(); } else { std::map<char, InputState>::iterator iter = m_keyMap.begin(); for ( ; iter != m_keyMap.end() ; iter++) { if(KeyDown(iter->first)) notifyObserver(iter->second); } } } // Poll Mouse... if (m_pMouse) { Hr = m_pMouse->GetDeviceState(sizeof(DIMOUSESTATE2), (void**)&m_MouseState); if (FAILED(Hr)) { // Mouse Lost... ZeroMemory(&m_MouseState, sizeof(m_MouseState)); // try to acquire next time we poll Hr = m_pMouse->Acquire(); } else { // We look for first three entries in the InputState enum // which holds Mouse Buttons for (int i = 0 ; i < 3 ; i++) { if (MouseButtonDown(i)) notifyObserver(InputState(i)); } } } }
void MediaRecorderImpl::pauseRecorder() { medvdbg("pauseRecorder() mCurState : %d\n", (recorder_state_t)mCurState); if (mCurState != RECORDER_STATE_RECORDING) { notifyObserver(OBSERVER_COMMAND_ERROR); meddbg("pause Failed mCurState : %d\n", (recorder_state_t)mCurState); return; } audio_manager_result_t result = pause_audio_stream_in(); if (result != AUDIO_MANAGER_SUCCESS) { notifyObserver(OBSERVER_COMMAND_ERROR); meddbg("pause_audio_stream_in failed ret : %d\n", result); return; } mCurState = RECORDER_STATE_PAUSED; notifyObserver(OBSERVER_COMMAND_PAUSED); }
LRESULT GaugeOverlayDialog::span(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { BOOL iRet = TRUE; // For GetDlgItemInt int i = GetDlgItemInt(wID, &iRet, TRUE); if (iRet) { ((CGaugeOverlay*)overlay)->put_Span((long)i); notifyObserver(); } return 1; }
LRESULT COverlayPanel::visible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { IOverlay *item = NULL; getHierarchy(NULL, NULL, &item); if (item) { LRESULT state = SendDlgItemMessage(IDC_CHECK_VISIBLE, BM_GETCHECK, (WPARAM)0, (LPARAM)0); item->put_Visible(state == BST_CHECKED); notifyObserver(); } return 1; }
LRESULT COverlayPanel::mode(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { ISimpleOverlay2 *pISO2 = 0; HRESULT hr = overlayRoot->QueryInterface(__uuidof(ISimpleOverlay2), (void **)&pISO2); if (SUCCEEDED(hr)) { long val = 0; modeList.getData(&val, 0 /* default value */); pISO2->put_EffectOverlayEffect(val); pISO2->Release(); notifyObserver(); } return 1; }
LRESULT COverlayPanel::duplicate(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { IOverlay *item = NULL; ICompositeOverlay *parent = NULL; getHierarchy(NULL, &parent, &item); if (item) { duplicate(parent, item); SendDlgItemMessage(IDC_OVERLAY_LIST, TVM_SELECTITEM, (WPARAM)TVGN_CARET, 0); notifyObserver(); } return 1; }
LRESULT COverlayPanel::moveDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { IOverlay *item = NULL; ICompositeOverlay *parent = NULL, *superParent = NULL; getHierarchy(&superParent, &parent, &item); if (item) { down(superParent, parent, item); enable(item); notifyObserver(); } else disable(); return 1; }
bool SGSHero::init(const char* hero_name, HERO_SIDE side) { if (!Sprite::init()) { return false; } __name = hero_name; __side = side; __active = true; /* range and level should be loaded from the hero script */ __range = SGCorpsAttackRange::CORPS_RANGE_INFANTRY; __level = 10; initActions(); initAttackActions(); initSpecActions(); this->setAnchorPoint(Vec2(0.5f, 0.5f)); this->setName(hero_name); notifyObserver("hero_add", reinterpret_cast<void*>(this)); // init category initCategory(); /* For Test Weapon Repo Purpose Only */ //SGWeaponBase *pDefArm = SGWeaponBase::Create("·ï»ËÓðÒÂ", 0); /* Test case ends */ __status = HERO_STATUS_NORMAL; __ai = HERO_AI_ATTACK; initDataNum(); startUpdate(0.0f); return true; }
LRESULT COverlayPanel::add(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { char text[256]; IOverlay *item = NULL; ICompositeOverlay *parent = NULL; getHierarchy(NULL, &parent, &item); *text = 0; GetDlgItemText(IDC_OVERLAY_TYPE, text, sizeof(text)); if (item) { ICompositeOverlay *pCO = NULL; HRESULT hr = item->QueryInterface(IID_ICompositeOverlay, (void **)&pCO); if (SUCCEEDED(hr)) { parent = (ICompositeOverlay*)item; pCO->Release(); } } if (add(parent, text)) notifyObserver(); return 1; }