| 131 | } |
| 132 | |
| 133 | UINT CVisualizerWnd::ThreadProc() |
| 134 | { |
| 135 | DWORD nThreadID = AfxGetThread()->m_nThreadID; |
| 136 | m_bThreadRunning = true; |
| 137 | |
| 138 | TRACE(L"Visualizer: Started thread (0x%04x)\n", nThreadID); |
| 139 | |
| 140 | while (m_bThreadRunning && ::WaitForSingleObject(m_hNewSamples, INFINITE) == WAIT_OBJECT_0) { |
| 141 | m_bNoAudio = false; |
| 142 | |
| 143 | // Switch buffers |
| 144 | LockedBuffer([&] { |
| 145 | m_pBuffer1.swap(m_pBuffer2); |
| 146 | }); |
| 147 | |
| 148 | // Draw |
| 149 | LockedState([&] { |
| 150 | if (CDC *pDC = GetDC()) { |
| 151 | m_pStates[m_iCurrentState]->SetSampleData(m_pBuffer2); |
| 152 | m_pStates[m_iCurrentState]->Draw(); |
| 153 | m_pStates[m_iCurrentState]->Display(pDC, false); |
| 154 | ReleaseDC(pDC); |
| 155 | } |
| 156 | }); |
| 157 | } |
| 158 | |
| 159 | TRACE(L"Visualizer: Closed thread (0x%04x)\n", nThreadID); |
| 160 | |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | BOOL CVisualizerWnd::CreateEx(DWORD dwExStyle, LPCWSTR lpszClassName, LPCWSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) |
| 165 | { |
no test coverage detected