MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / ThreadProc

Method ThreadProc

Source/VisualizerWnd.cpp:133–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133UINT 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
164BOOL CVisualizerWnd::CreateEx(DWORD dwExStyle, LPCWSTR lpszClassName, LPCWSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
165{

Callers 1

ThreadProcFuncMethod · 0.80

Calls 4

swapMethod · 0.80
SetSampleDataMethod · 0.45
DrawMethod · 0.45
DisplayMethod · 0.45

Tested by

no test coverage detected