MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / xaudio2Cleanup

Function xaudio2Cleanup

extlibs/soloud/src/backend/xaudio2/soloud_xaudio2.cpp:135–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 }
134
135 static void xaudio2Cleanup(Soloud *aSoloud)
136 {
137 if (0 == aSoloud->mBackendData)
138 {
139 return;
140 }
141 XAudio2Data *data = static_cast<XAudio2Data*>(aSoloud->mBackendData);
142 SetEvent(data->audioProcessingDoneEvent);
143 SetEvent(data->bufferEndEvent);
144 Thread::wait(data->thread);
145 Thread::release(data->thread);
146 if (0 != data->sourceVoice)
147 {
148 data->sourceVoice->Stop();
149 data->sourceVoice->FlushSourceBuffers();
150 }
151 if (0 != data->xaudio2)
152 {
153 data->xaudio2->StopEngine();
154 }
155 if (0 != data->sourceVoice)
156 {
157 data->sourceVoice->DestroyVoice();
158 }
159 if (0 != data->voiceCb)
160 {
161 delete data->voiceCb;
162 }
163 if (0 != data->masteringVoice)
164 {
165 data->masteringVoice->DestroyVoice();
166 }
167 if (0 != data->xaudio2)
168 {
169 data->xaudio2->Release();
170 }
171 for (int i=0;i<BUFFER_COUNT;++i)
172 {
173 if (0 != data->buffer[i])
174 {
175 delete[] data->buffer[i];
176 }
177 }
178 CloseHandle(data->bufferEndEvent);
179 CloseHandle(data->audioProcessingDoneEvent);
180 delete data;
181 aSoloud->mBackendData = 0;
182 CoUninitialize();
183 }
184
185 result xaudio2_init(Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
186 {

Callers

nothing calls this directly

Calls 2

waitFunction · 0.85
releaseFunction · 0.85

Tested by

no test coverage detected