コード例 #1
0
/*归原点操作*/
void ScanThread::HomeMove()
{
    if(spark_info->b_array[B_HOME_Z_UP]){
        if(e_edge == FALL){
            qDebug()<<"home up";
            program.Speed = 400;
            program.Mode = Hand_Velocity_MODE;
            program.Driect = Hand_A_DRIECT;
            DoMove(&program);
        }else{
            if(spark_info->b_array[B_Z_UP_ALERT]){
                DoStop(&program);
            }
        }
        e_last = true;
    }
    else{
        /*手动停止归原点操作*/
        if(e_edge == RISE){
            DoStop(&program);
            AxisSwitch(&program ,Hand_NULL_AXIS ,Hand_A_DRIECT);
            program.Mutex = Hand_NULL_MUTEX;
            spark_info->hand.Mutex = Hand_NULL_MUTEX;
        }
        e_last = false;
    }

    if(spark_info->b_array[B_HOME_Z_DOWN]){
        if(f_edge == FALL){
            program.Speed = 400;
            program.Mode = Hand_Velocity_MODE;
            program.Driect = Hand_B_DRIECT;
            DoMove(&program);
        }else{
            if(spark_info->b_array[B_Z_DOWN_ALERT]){
                DoStop(&program);
            }
        }
        f_last = true;
    }
    else{
        /*手动停止归原点操作*/
        if(f_edge == RISE){
            DoStop(&program);
            AxisSwitch(&program ,Hand_NULL_AXIS ,Hand_B_DRIECT);
            spark_info->hand.Mutex = Hand_NULL_MUTEX;
            program.Mutex = Hand_NULL_MUTEX;
        }
        f_last = false;
    }
}
コード例 #2
0
ファイル: sound.cpp プロジェクト: 3v1n0/wxWidgets
bool wxOSXSoundManagerSoundData::Play(unsigned flags)
{
    Stop();

    m_flags = flags;

    SoundComponentData data;
    unsigned long numframes, offset;

    ParseSndHeader((SndListHandle)m_hSnd, &data, &numframes, &offset);

    SndNewChannel(&m_pSndChannel, sampledSynth,
                  initNoInterp
                  + (data.numChannels == 1 ? initMono : initStereo), NULL);

    if(SndPlay(m_pSndChannel, (SndListHandle) m_hSnd, flags & wxSOUND_ASYNC ? 1 : 0) != noErr)
        return false;

    if (flags & wxSOUND_ASYNC)
        CreateAndStartTimer();
    else
        DoStop();

    return true;
}
コード例 #3
0
ファイル: GeometricMediaSource.cpp プロジェクト: ckc/WinApp
__override HRESULT CGeometricMediaSource::DispatchOperation(CSourceOperation *pOp)
{
	AutoLock lock(_critSec);

    HRESULT hr = CheckShutdown();

    if (SUCCEEDED(hr))
    {
        switch(pOp->GetOperationType())
        {
        case CSourceOperation::Operation_Start:
            hr = DoStart(static_cast<CStartOperation *>(pOp));
            break;
        case CSourceOperation::Operation_Stop:
            hr = DoStop(pOp);
            break;
        case CSourceOperation::Operation_SetRate:
            hr = DoSetRate(static_cast<CSetRateOperation *>(pOp));
            break;
        default:
            hr = E_UNEXPECTED;
            break;
        }
    }

    return hr;
}
コード例 #4
0
ファイル: Frame.cpp プロジェクト: Everscent/dolphin-emu
void CFrame::OnClose(wxCloseEvent& event)
{
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
	{
		DoStop();
		if (Core::GetState() != Core::CORE_UNINITIALIZED)
			return;
		UpdateGUI();
	}

	//Stop Dolphin from saving the minimized Xpos and Ypos
	if(main_frame->IsIconized())
		main_frame->Iconize(false);

	// Don't forget the skip or the window won't be destroyed
	event.Skip();

	// Save GUI settings
	if (g_pCodeWindow) SaveIniPerspectives();
	// Close the log window now so that its settings are saved
	else
	{
		m_LogWindow->Close();
		m_LogWindow = NULL;
	}


	// Uninit
	m_Mgr->UnInit();
}
コード例 #5
0
ファイル: CPUThread.cpp プロジェクト: MissValeska/rpcs3
void CPUThread::Close()
{
	ThreadBase::Stop();
	DoStop();

	delete m_dec;
	m_dec = nullptr;
}
コード例 #6
0
ファイル: DialogSession.cpp プロジェクト: aronarts/FireNET
bool CDialogSession::Stop()
{
	bool bStopped = DoStop();
	if (bStopped)
		NotifyListeners(eDSE_UserStopped);

	return bStopped;
}
コード例 #7
0
		//-----------------------------------------------------------------------------
		void StateObject::Stop()
		{
			Dia::Core::Log::OutputVaradicLine("Stoping %s", GetUniqueId().AsChar());

			DIA_ASSERT(mState == StateEnum::kRunning, "Stoping %s but in wrong state: %s", mUniqueId.AsChar(), mState.AsString());

			DoStop();
		}
コード例 #8
0
void SjPlayer::DoExit()
{
	if( m_impl )
	{
		DoStop();

		delete m_impl;
		m_impl  = NULL;
	}
}
コード例 #9
0
/*手动按键操作*/
void ScanThread::HandleMove()
{

    /*上升按键*/
    if((spark_info->c_array[C_Z_IN0] & 0x10))
    {
        if(a_edge == FALL){
            DoMove(&spark_info->hand);
            a_edge = NONE;
        }
        a_last = true;
        return;
    }else{
        if(a_edge == RISE){
            DoStop(&spark_info->hand);
            AxisSwitch(&spark_info->hand ,Hand_NULL_AXIS ,Hand_A_DRIECT);
            spark_info->hand.Mutex = Hand_NULL_MUTEX;
            a_edge = NONE;
        }
        a_last = false;
    }
    /*下降按键*/
    if((spark_info->c_array[C_Z_IN0] & 0x20))
    {
        if(b_edge == FALL){
            DoMove(&spark_info->hand);
            b_edge = NONE;
        }
        b_last = true;
        return;
    }else{
        if(b_edge == RISE){
            DoStop(&spark_info->hand);
            AxisSwitch(&spark_info->hand ,Hand_NULL_AXIS ,Hand_A_DRIECT);
            spark_info->hand.Mutex = Hand_NULL_MUTEX;
            b_edge = NONE;
        }
        b_last = false;
    }

}
コード例 #10
0
ファイル: TlbbScript.cpp プロジェクト: JiangYouxin/XTLBB
void TlbbScript::Stop()
{
	if(m_start)
	{
		m_start = false;

		// TODO: 这里是TlbbInstance的成员,要重新整理一下
		ReleaseDC(m_hWnd, m_hDC);
		Beep(879, 100);
		DoStop();
	}
}
コード例 #11
0
ファイル: PPCThread.cpp プロジェクト: BasCreator/rpcs3
void PPCThread::Stop()
{
	if(IsStopped()) return;

	wxGetApp().SendDbgCommand(DID_STOP_THREAD, this);

	m_status = Stopped;
	Reset();
	DoStop();
	Emu.CheckStatus();

	ThreadBase::Stop();

	wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this);
}
コード例 #12
0
ファイル: CPUThread.cpp プロジェクト: Magn3s1um/rpcs3
void CPUThread::Stop()
{
	if(IsStopped()) return;

	wxGetApp().SendDbgCommand(DID_STOP_THREAD, this);

	m_status = Stopped;
	ThreadBase::Stop(false);
	Reset();
	DoStop();
	Emu.CheckStatus();
	delete m_dec;

	wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this);
}
コード例 #13
0
ファイル: Frame.cpp プロジェクト: Everscent/dolphin-emu
void CFrame::OnHostMessage(wxCommandEvent& event)
{
	switch (event.GetId())
	{
	case IDM_UPDATEGUI:
		UpdateGUI();
		break;

	case IDM_UPDATESTATUSBAR:
		if (GetStatusBar() != NULL)
			GetStatusBar()->SetStatusText(event.GetString(), event.GetInt());
		break;

	case IDM_UPDATETITLE:
		if (m_RenderFrame != NULL)
			m_RenderFrame->SetTitle(event.GetString());
		break;

	case IDM_WINDOWSIZEREQUEST:
		{
			std::pair<int, int> *win_size = (std::pair<int, int> *)(event.GetClientData());
			OnRenderWindowSizeRequest(win_size->first, win_size->second);
			delete win_size;
		}
		break;

	case WM_USER_CREATE:
		if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
			m_RenderParent->SetCursor(wxCURSOR_BLANK);
		break;

#ifdef __WXGTK__
	case IDM_PANIC:
		{
			wxString caption = event.GetString().BeforeFirst(':');
			wxString text = event.GetString().AfterFirst(':');
			bPanicResult = (wxYES == wxMessageBox(text, 
						caption, event.GetInt() ? wxYES_NO : wxOK, wxGetActiveWindow()));
			panic_event.Set();
		}
		break;
#endif

	case WM_USER_STOP:
		DoStop();
		break;
	}
}
コード例 #14
0
void CFrame::OnRenderParentClose(wxCloseEvent& event)
{
  // Before closing the window we need to shut down the emulation core.
  // We'll try to close this window again once that is done.
  if (Core::GetState() != Core::CORE_UNINITIALIZED)
  {
    DoStop();
    if (event.CanVeto())
    {
      event.Veto();
    }
    return;
  }

  event.Skip();
}
コード例 #15
0
ファイル: CPUThread.cpp プロジェクト: BagusThanatos/rpcs3
void CPUThread::Stop()
{
	if(IsStopped()) return;

#ifndef QT_UI
	wxGetApp().SendDbgCommand(DID_STOP_THREAD, this);
#endif

	m_status = Stopped;
	ThreadBase::Stop(false);
	Reset();
	DoStop();
	Emu.CheckStatus();

#ifndef QT_UI
	wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this);
#endif
}
コード例 #16
0
int ExtractThread(EXTRACT_THREAD_VIDEO_DATA*	lpETD)
{
	lpETD->dlg->SetDialogState_Muxing();
	lpETD->dlg->ButtonState_START();

	lpETD->dlg->AddProtocolLine("started extracting binary", 4);

	VIDEOSOURCE* v = lpETD->v;
	v->Enable(1);
	CFileStream* f = lpETD->file;
	char cTime[20];
	char* lpBuffer = new char[2<<20];
	int iLastTime = GetTickCount();
	v->ReInit();

	while (!v->IsEndOfStream() && !DoStop()) {
		__int64 iTimecode;
		__int64 iNS = 0;
		DWORD dwSize;
		v->GetFrame(lpBuffer,&dwSize,&iTimecode);
		f->Write(lpBuffer,dwSize);
		if (GetTickCount()-iLastTime>100 || v->IsEndOfStream()) {
			Millisec2Str((iTimecode * v->GetTimecodeScale() + iNS)/ 1000000,cTime);
			
			CUTF8 utf8Time(cTime);
			lpETD->dlg->m_Prg_Frames.SetWindowText(utf8Time.TStr());
			iLastTime+=100;
		}
	}

	lpETD->dlg->SetDialogState_Config();
	lpETD->dlg->ButtonState_STOP();
	delete lpBuffer;
	StopMuxing(false);
	lpETD->file->Close();
	lpETD->dlg->AddProtocol_Separator();
	delete lpETD;

	v->Enable(0);

	return 1;
}
コード例 #17
0
void SjPlayer::Stop(bool stopVisIfPlaying)
{
	// This function may only be called from the main thread.
	wxASSERT( wxThread::IsMain() );

	if( !m_isInitialized ) {
		return;
	}

	m_stopAfterThisTrack = false;
	m_failedUrls.Clear();

	// stop visualisation
	if( stopVisIfPlaying )
	{
		g_visModule->StopVisIfOverWorkspace();
	}

	// Do the "real stop" in the implementation part
	DoStop();
	m_paused = false;
}
コード例 #18
0
ファイル: Lab6.cpp プロジェクト: Eugeny/Labs
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		switch (wmId)
		{
		case 1:
			DoStart(hWnd);
			break;
		case 2:
			DoStop(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_TIMER:
		DoTimer(hWnd);
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		DoPaint(hdc);
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
コード例 #19
0
ファイル: Frame.cpp プロジェクト: Everscent/dolphin-emu
void CFrame::OnKeyDown(wxKeyEvent& event)
{
	if(Core::GetState() != Core::CORE_UNINITIALIZED &&
			(RendererHasFocus() || g_TASInputDlg->HasFocus()))
	{
		int WiimoteId = -1;
		// Toggle fullscreen
		if (IsHotkey(event, HK_FULLSCREEN))
			DoFullscreen(!RendererIsFullscreen());
		// Send Debugger keys to CodeWindow
		else if (g_pCodeWindow && (event.GetKeyCode() >= WXK_F9 && event.GetKeyCode() <= WXK_F11))
 			event.Skip();
		// Pause and Unpause
		else if (IsHotkey(event, HK_PLAY_PAUSE))
			DoPause();
		// Stop
		else if (IsHotkey(event, HK_STOP))
			DoStop();
		// Screenshot hotkey
		else if (IsHotkey(event, HK_SCREENSHOT))
			Core::SaveScreenShot();
		// Wiimote connect and disconnect hotkeys
		else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
			WiimoteId = 0;
		else if (IsHotkey(event, HK_WIIMOTE2_CONNECT))
			WiimoteId = 1;
		else if (IsHotkey(event, HK_WIIMOTE3_CONNECT))
			WiimoteId = 2;
		else if (IsHotkey(event, HK_WIIMOTE4_CONNECT))
			WiimoteId = 3;
		// State save and state load hotkeys
		/*else if (event.GetKeyCode() >= WXK_F1 && event.GetKeyCode() <= WXK_F8)
		{
			int slot_number = event.GetKeyCode() - WXK_F1 + 1;
			if (event.GetModifiers() == wxMOD_NONE)
				State::Load(slot_number);
			else if (event.GetModifiers() == wxMOD_SHIFT)
				State::Save(slot_number);
			else
				event.Skip();
		}*/
		else if (event.GetKeyCode() == WXK_F11 && event.GetModifiers() == wxMOD_NONE)
			State::LoadLastSaved();
		else if (event.GetKeyCode() == WXK_F12)
		{
			if (event.GetModifiers() == wxMOD_NONE)
				State::UndoSaveState();
			else if (event.GetModifiers() == wxMOD_SHIFT)
				State::UndoLoadState();
			else
				event.Skip();
		}
		else
		{
			unsigned int i = NUM_HOTKEYS;
			if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || g_TASInputDlg->HasFocus())
			{
				for (i = 0; i < NUM_HOTKEYS; i++)
				{
					if (IsHotkey(event, i))
					{
						int cmd = GetCmdForHotkey(i);
						if (cmd >= 0)
						{ 
							wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, cmd);
							wxMenuItem *item = GetMenuBar()->FindItem(cmd);
							if (item && item->IsCheckable())
							{
								item->wxMenuItemBase::Toggle();
								evt.SetInt(item->IsChecked());
							}
							GetEventHandler()->AddPendingEvent(evt);
							break;
						}
					}
				}
			}
			// On OS X, we claim all keyboard events while
			// emulation is running to avoid wxWidgets sounding
			// the system beep for unhandled key events when
			// receiving pad/wiimote keypresses which take an
			// entirely different path through the HID subsystem.
#ifndef __APPLE__
			// On other platforms, we leave the key event alone
			// so it can be passed on to the windowing system.
			if (i == NUM_HOTKEYS)
				event.Skip();
#endif
		}

		// Actually perform the wiimote connection or disconnection
		if (WiimoteId >= 0)
		{
			bool connect = !GetMenuBar()->IsChecked(IDM_CONNECT_WIIMOTE1 + WiimoteId);
			ConnectWiimote(WiimoteId, connect);
		}

		// Send the OSD hotkeys to the video backend
		if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7' && event.GetModifiers() == wxMOD_NONE)
		{
#ifdef _WIN32
			PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
#elif defined(HAVE_X11) && HAVE_X11
			X11Utils::SendKeyEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetKeyCode());
#endif
		}
		// Send the freelook hotkeys to the video backend
		if ((event.GetKeyCode() == ')' || event.GetKeyCode() == '(' ||
					event.GetKeyCode() == '0' || event.GetKeyCode() == '9' ||
					event.GetKeyCode() == 'W' || event.GetKeyCode() == 'S' ||
					event.GetKeyCode() == 'A' || event.GetKeyCode() == 'D' ||
					event.GetKeyCode() == 'R')
				&& event.GetModifiers() == wxMOD_SHIFT)
		{
#ifdef _WIN32
			PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
#elif defined(HAVE_X11) && HAVE_X11
			X11Utils::SendKeyEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetKeyCode());
#endif
		}
	}
	else
		event.Skip();
}
コード例 #20
0
ファイル: mainwnd.c プロジェクト: RPG-7/reactos
static VOID
MainWndCommand(PMAIN_WND_INFO Info,
               WORD CmdId,
               HWND hControl)
{
    UNREFERENCED_PARAMETER(hControl);

    switch (CmdId)
    {
        case ID_PROP:
        {
            if (Info->SelectedItem != NO_ITEM_SELECTED)
            {
                Info->bDlgOpen = TRUE;
                OpenPropSheet(Info);
                Info->bDlgOpen = FALSE;
                SetMenuAndButtonStates(Info);
            }
        }
        break;

        case ID_REFRESH:
        {
            RefreshServiceList(Info);
            Info->SelectedItem = NO_ITEM_SELECTED;

            /* disable menus and buttons */
            SetMenuAndButtonStates(Info);

            /* clear the service in the status bar */
            SendMessage(Info->hStatus,
                        SB_SETTEXT,
                        1,
                        _T('\0'));
        }
        break;

        case ID_EXPORT:
        {
            ExportFile(Info);
            SetFocus(Info->hListView);
        }
        break;

        case ID_CREATE:
        {
            INT ret;

            ret = DialogBoxParam(hInstance,
                                 MAKEINTRESOURCE(IDD_DLG_CREATE),
                                 Info->hMainWnd,
                                 CreateDialogProc,
                                 (LPARAM)Info);
            if (ret == IDOK)
                RefreshServiceList(Info);

            SetFocus(Info->hListView);
        }
        break;

        case ID_DELETE:
        {
            if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState != SERVICE_RUNNING)
            {
                DialogBoxParam(hInstance,
                               MAKEINTRESOURCE(IDD_DLG_DELETE),
                               Info->hMainWnd,
                               DeleteDialogProc,
                               (LPARAM)Info);
            }
            else
            {
                TCHAR Buf[60];
                LoadString(hInstance,
                           IDS_DELETE_STOP,
                           Buf,
                           sizeof(Buf) / sizeof(TCHAR));
                DisplayString(Buf);
            }

            SetFocus(Info->hListView);

        }
        break;

        case ID_START:
        {
            if (DoStart(Info, NULL))
            {
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        }
        break;

        case ID_STOP:
            if (DoStop(Info))
            {
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        break;

        case ID_PAUSE:
            DoPause(Info);
        break;

        case ID_RESUME:
            DoResume(Info);
        break;

        case ID_RESTART:
            if (DoStop(Info))
            {
                DoStart(Info, NULL);
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        break;

        case ID_HELP:
            MessageBox(NULL,
                       _T("Help is not yet implemented\n"),
                       _T("Note!"),
                       MB_OK | MB_ICONINFORMATION);
            SetFocus(Info->hListView);
        break;

        case ID_EXIT:
            PostMessage(Info->hMainWnd,
                        WM_CLOSE,
                        0,
                        0);
        break;

        case ID_VIEW_LARGE:
            SetListViewStyle(Info->hListView,
                             LVS_ICON);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_LARGE,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_SMALL:
            SetListViewStyle(Info->hListView,
                             LVS_SMALLICON);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_SMALL,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_LIST:
            SetListViewStyle(Info->hListView,
                             LVS_LIST);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_LIST,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_DETAILS:
            SetListViewStyle(Info->hListView,
                             LVS_REPORT);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_DETAILS,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_CUST:
        break;

        case ID_ABOUT:
            DialogBox(hInstance,
                      MAKEINTRESOURCE(IDD_ABOUTBOX),
                      Info->hMainWnd,
                      AboutDialogProc);
            SetFocus(Info->hListView);
        break;

    }
}
コード例 #21
0
ファイル: DialogSession.cpp プロジェクト: aronarts/FireNET
void CDialogSession::DoPlay(float dt)
{
	if (m_bFirstUpdate == false)
		m_curTime+=dt;
	else
		m_bFirstUpdate = false;

	// delayed aborting
	if (m_abortReason != eAR_None)
	{
		TActorContextMap::iterator iter = m_actorContextMap.begin();
		while (iter != m_actorContextMap.end())
		{
			CDialogActorContextPtr pContext = (*iter).second;
			if (pContext->IsStillPlaying())
			{
				m_endGraceTimeOut-=dt;
				if (m_endGraceTimeOut >= 0.0f)
					return;
				else
					break;
			}
			++iter;
		}
		DoStop();
		NotifyListeners(eDSE_Aborted);
		return;
	}

	bool bContinue = true;
	if (m_bHaveSchedule)
	{
		m_nextTimeDelay-=dt;
		if (m_nextTimeDelay<=0.0f)
		{
			m_bHaveSchedule = false;
			m_curScriptLine = m_nextScriptLine;
			if (m_curScriptLine < m_pScript->GetNumLines())
			{
				const CDialogScript::SScriptLine* pLine = m_pScript->GetLine(m_curScriptLine);
				if (pLine)
				{
					m_bReachedEnd = false;
					DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogSession: %s Playing new line %d: now=%f", GetDebugName(), m_curScriptLine, m_curTime);
					bool ok = PlayLine(pLine);
					bContinue = ok; // PlayLine can vote for immediate stop by returning false!
					NotifyListeners(eDSE_LineStarted);
				}
			}	
			else
			{
				// we're past end
				m_bReachedEnd = true;
			}
		}
	}

	int nStillPlaying = 0;
	int nSoundWantContinue = 0;

	// update all contexts
	CDialogScript::SActorSet aborted = 0;
	{
		TActorContextMap::iterator iter = m_actorContextMap.begin();
		while (iter != m_actorContextMap.end())
		{
			CDialogActorContextPtr pContext = (*iter).second;
			pContext->Update(dt);
			if (pContext->IsAborted())
			{
				// First one which aborts, aborts the whole session
				if (m_abortReason == eAR_None)
					m_abortReason = pContext->GetAbortReason();
				aborted.SetActor(iter->first);
			}
			if (pContext->IsStillPlaying())
			{
				++nStillPlaying;
			}
			if (pContext->CheckActorFlags(CDialogSession::eDACF_NoAbortSound))
			{
				++nSoundWantContinue;
			}
			++iter;
		}
	}

	// when we've reached the end there could still be some contexts playing
	if (m_bReachedEnd)
	{
		if (nStillPlaying == 0)
		{
			// no context playing, do a real end now
			bContinue = false;
		}
		else
		{
			if (nStillPlaying != m_pendingActors)
			{
				m_pendingActors = nStillPlaying;
				DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogSession: %s End of Script reached. Waiting for %d pending Actors.", GetDebugName(), nStillPlaying);
			}
			// wait for some grace time and stop if timed out
			m_endGraceTimeOut-=dt;
			bContinue = m_endGraceTimeOut >= 0.0f;
		}
	}

	if (aborted.NumActors() > 0)
	{
		if (nSoundWantContinue == 0 || nStillPlaying==0)
		{
			DoStop();
			NotifyListeners(eDSE_Aborted);
		}
		else
		{
			DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogSession: %s Delaying abortion.", GetDebugName());
		}
	}
	else if (bContinue == false)
	{
		DoStop();
		NotifyListeners(eDSE_EndOfDialog);
	}
}
コード例 #22
0
		void Stop()
		{
			DoStop();
		}
コード例 #23
0
void CFrame::OnStop(wxCommandEvent& WXUNUSED(event))
{
  DoStop();
}
コード例 #24
0
ファイル: DialogSession.cpp プロジェクト: aronarts/FireNET
void CDialogSession::Release()
{
	DoStop(); // force stopping [most important thing is un-precaching sounds]
	NotifyListeners(eDSE_SessionDeleted);
	delete this;
}
コード例 #25
0
ファイル: sound.cpp プロジェクト: NullNoname/dolphin
wxOSXAudioToolboxSoundData::~wxOSXAudioToolboxSoundData()
{
    DoStop();
}
コード例 #26
0
bool ImageContainerParent::RecvStop()
{
  DoStop();
  return true;
}
コード例 #27
0
ファイル: sound.cpp プロジェクト: 3v1n0/wxWidgets
wxOSXSoundManagerSoundData::~wxOSXSoundManagerSoundData()
{
    DoStop();
    ReleaseResource((Handle)m_hSnd);
}
コード例 #28
0
ファイル: sound.cpp プロジェクト: 3v1n0/wxWidgets
bool wxOSXQuickTimeSoundData::Play(unsigned flags)
{
    if ( m_movie )
        Stop();

    m_flags = flags;

    if (!wxInitQT())
        return false;

    if( m_soundHandle )
    {
        Handle dataRef = nil;
        MovieImportComponent miComponent;
        Track targetTrack = nil;
        TimeValue addedDuration = 0;
        long outFlags = 0;
        OSErr err;
        ComponentResult result;

        err = PtrToHand(&m_soundHandle, &dataRef, sizeof(Handle));

        HLock(m_soundHandle);
        if (memcmp(&(*m_soundHandle)[8], "WAVE", 4) == 0)
            miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeWave);
        else if (memcmp(&(*m_soundHandle)[8], "AIFF", 4) == 0)
            miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeAIFF);
        else if (memcmp(&(*m_soundHandle)[8], "AIFC", 4) == 0)
            miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeAIFC);
        else
        {
            HUnlock(m_soundHandle);
            wxLogSysError(wxT("wxSound - Location in memory does not contain valid data"));
            return false;
        }

        HUnlock(m_soundHandle);
        m_movie = NewMovie(0);

        result = MovieImportDataRef(miComponent,                dataRef,
                                    HandleDataHandlerSubType,   m_movie,
                                    nil,                        &targetTrack,
                                    nil,                        &addedDuration,
                                    movieImportCreateTrack,     &outFlags);

        if (result != noErr)
        {
            wxLogSysError(wxString::Format(wxT("Couldn't import movie data\nError:%i"), (int)result));
        }

        SetMovieVolume(m_movie, kFullVolume);
        GoToBeginningOfMovie(m_movie);
    }
    else
    {
        OSErr err = noErr ;

        Handle dataRef = NULL;
        OSType dataRefType;

        err = QTNewDataReferenceFromFullPathCFString(wxCFStringRef(m_sndname,wxLocale::GetSystemEncoding()),
                                                     (UInt32)kQTNativeDefaultPathStyle, 0, &dataRef, &dataRefType);

        wxASSERT(err == noErr);

        if (NULL != dataRef || err != noErr)
        {
            err = NewMovieFromDataRef( &m_movie, newMovieDontAskUnresolvedDataRefs , NULL, dataRef, dataRefType );
            wxASSERT(err == noErr);
            DisposeHandle(dataRef);
        }

        if (err != noErr)
        {
            wxLogSysError(
                          wxString::Format(wxT("wxSound - Could not open file: %s\nError:%i"), m_sndname.c_str(), err )
                          );
            return false;
        }
    }

    //Start the m_movie!
    StartMovie(m_movie);

    if (flags & wxSOUND_ASYNC)
    {
        CreateAndStartTimer();
    }
    else
    {
        wxASSERT_MSG(!(flags & wxSOUND_LOOP), wxT("Can't loop and play syncronously at the same time"));

        //Play movie until it ends, then exit
        //Note that due to quicktime caching this may not always
        //work 100% correctly
        while (!IsMovieDone(m_movie))
            MoviesTask(m_movie, 1);

        DoStop();
    }

    return true;
}
コード例 #29
0
void AbstractHttpServer::Stop() {
  DoStop();
}
コード例 #30
0
ファイル: sound_osx.cpp プロジェクト: beanhome/dev
void wxSoundData::Stop()
{
    DoStop();
    wxDELETE(m_pTimer);
}