MixerGUI::MixerGUI(QSettings *set) : QMainWindow(), ui(new Ui::MixerGUI){ ui->setupUi(this); //load the designer file settings = set; //save this settings access for later closing = false; //connect the signals/slots connect(ui->actionClose_Mixer, SIGNAL(triggered()), this, SLOT(hideGUI()) ); connect(ui->actionClose_Mixer_and_Tray, SIGNAL(triggered()), this, SLOT(closeApplication()) ); connect(ui->menuConfiguration, SIGNAL(triggered(QAction*)), this, SLOT(startExternalApp(QAction*)) ); connect(ui->tool_test, SIGNAL(clicked()), this, SLOT(TestSound()) ); connect(ui->actionRestart_PulseAudio, SIGNAL(triggered()), this, SLOT(RestartPulseAudio()) ); }
//----------------------------------------------------------------------------- // The 'main' function // argc - number of parameters // argv - the parameters // Returns: Error code int main(int argc, char** argv) { int i; // Loop counter char mode = 0; // Check the parameters for(i = 1; i < argc; i++) { // Skip the first argument, it's the executable's name mode = *(argv[i]); break; } //if(mode == 't') { // Test mode //TestCurve(); //TestWaveFile(); //TestWaveCurve(); //TestFilter(); //TestTLC59711(); //TestMCP3008(); //TestMCP23017(); TestSound(); return 0; }
void CRMmainLoop::RunMessageLoop() { MSG msg; UINT fps = 0; HRESULT hr = S_FALSE; ZeroMemory( &msg, sizeof(msg) ); //msg 초기화 함수 //=================================================================== // 음악 데이터를 불러온다. // 음악 데이터를 vector 형식으로 리스팅 FindMusicData(); //=================================================================== // fmod 사용하기 fmodex.dll파일이 필요하다. hr = CRMsound::GetInstance()->CreateSound(); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_INIT, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } //sound를 불러와서 묶어 놓고 있는 상태 //동영상 플레이 이후 별로의 로딩화면이 없는 상태이기 때문에 미리 로딩하는 개념 hr = CRMsound::GetInstance()->LoadSound( BGM_TITLE, SOUND_BG_TITLE ); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_CANCEL, SOUND_EFFECT_PAUSE_CANCEL ); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_FLIP, SOUND_EFFECT_PAUSE_FLIP ); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_OK, SOUND_EFFECT_PAUSE_OK ); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_OPEN, SOUND_EFFECT_PAUSE_OPEN ); if ( hr != S_OK ) { MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } //=================================================================== // 동영상 출력 부분 hr = CRMvideoPlayer::GetInstance()->CreateFactory(); if ( hr == S_OK ) { CRMvideoPlayer::GetInstance()->StartVideo(); } else { hr = GoNextScene(); // 동영상 재생을 위한 초기화에 실패 했을 경우 동영상 재생 패스 if ( hr != S_OK ) { MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } } hr = CreateObject(); if ( hr != S_OK ) { MessageBox( NULL, ERROR_CREATE_RESOURCE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } // 오브젝트 생성 부분을 리팩토링 while ( true ) { if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) // PeekMessage는 대기 없이 무한 루프 상태로 진행(non blocked function) { if ( msg.message == WM_QUIT ) { CRMvideoPlayer::GetInstance()->DestoryFactory(); return; } TranslateMessage(&msg); DispatchMessage(&msg); // Wndproc과 연결되어 있음 } else { if ( m_SceneType == SCENE_OPENING ) { CRMvideoPlayer::GetInstance()->RenderVideo(); CRMinput::GetInstance()->UpdateKeyState(); if ( CRMinput::GetInstance()->GetKeyStatusByKey( KEY_TABLE_RETURN ) == KEY_STATUS_UP ) { CRMvideoPlayer::GetInstance()->DestoryFactory(); hr = GoNextScene(); if ( hr != S_OK ) { MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } } continue; } #ifdef _DEBUG m_NowTime = timeGetTime(); if ( m_PrevTime == 0 ) { m_PrevTime = m_NowTime; } // FPS 출력용 계산 if( ( m_NowTime - m_FpsCheckTime ) > 1000 ) { // printConsole("FPS : %d \n", fps); CRMlabel* testLabel = new CRMlabel(); std::wstring testString; testString.append(L"FPS : "); testString.append( std::to_wstring(fps) ); testLabel->CreateLabel(LABEL_FPS, testString, LABEL_FONT_NORMAL, 15.0F ); testLabel->SetRGBA( 1.0f, 1.0f, 1.0f, 1.f ); testLabel->SetSceneType( SCENE_PLAY ); testLabel->SetPosition( 20, 20 ); m_FpsCheckTime = m_NowTime; fps = 0; } m_ElapsedTime = m_NowTime - m_PrevTime; if( m_ElapsedTime == m_Fps ) { #endif // 처리 해야 할 내부 로직들을 처리함 // Update if ( GetActiveWindow() == NULL && GetNowScene() == SCENE_PLAY) { CRMpauseManager::GetInstance()->ShowPause(); } CRMobjectManager::GetInstance()->Update(); // {} 로 스택을 활용하여 더미클래스의 생성자, 소멸자를 호출 { CRMdummyRender dummyRender; // 생성자 // CRMrender::GetInstance()->RenderInit(); CRMobjectManager::GetInstance()->Render(); // 화면에 대한 처리를 진행 // Render } // 소멸자 // CRMrender::GetInstance()->RenderEnd(); m_PrevTime = m_NowTime; #ifdef _DEBUG ++fps; } #endif // _DEBUG ////////////////////////////////////////////////////////////////////////// // 소리 밀림 방지를 위해 FPS = 60에 맞추던 부분에서 빼옴 ////////////////////////////////////////////////////////////////////////// CRMinput::GetInstance()->UpdateKeyState(); // test sound TestSound(); // test Key hr = TestKeyboard(); if ( hr != S_OK ) { MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP ); return; } ////////////////////////////////////////////////////////////////////////// // 씬 관리 부분 ////////////////////////////////////////////////////////////////////////// if ( m_SceneType == SCENE_PLAY ) { CRMitemManager::GetInstance()->Update(); CRMnoteManager::GetInstance()->StartNote(); CRMjudgeManager::GetInstance()->JudgeNote(); // 이렇게 자주 해줄 필요는 없는데... if ( ( CRMplayer1P::GetInstance()->IsEnd() && CRMplayer2P::GetInstance()->IsEnd() ) || !CRMsound::GetInstance()->GetIsPlaying() ) { GoNextScene(); } } else if ( m_SceneType == SCENE_RESULT ) { CRMresultManager::GetInstance()->ShowResult(); } ////////////////////////////////////////////////////////////////////////// // 여기까지 ////////////////////////////////////////////////////////////////////////// if ( m_ElapsedTime > m_Fps ) { m_PrevTime = m_NowTime; } } } }