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

Function xaudio2Thread

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

Source from the content-addressed store, hash-verified

107 };
108
109 static void xaudio2Thread(LPVOID aParam)
110 {
111 XAudio2Data *data = static_cast<XAudio2Data*>(aParam);
112 int bufferIndex = 0;
113 while (WAIT_OBJECT_0 != WaitForSingleObject(data->audioProcessingDoneEvent, 0))
114 {
115 XAUDIO2_VOICE_STATE state;
116 data->sourceVoice->GetState(&state);
117 while (state.BuffersQueued < BUFFER_COUNT)
118 {
119 data->soloud->mix(data->buffer[bufferIndex], data->samples);
120 XAUDIO2_BUFFER info = {0};
121 info.AudioBytes = data->bufferLengthBytes;
122 info.pAudioData = reinterpret_cast<const BYTE*>(data->buffer[bufferIndex]);
123 data->sourceVoice->SubmitSourceBuffer(&info);
124 ++bufferIndex;
125 if (bufferIndex >= BUFFER_COUNT)
126 {
127 bufferIndex = 0;
128 }
129 data->sourceVoice->GetState(&state);
130 }
131 WaitForSingleObject(data->bufferEndEvent, INFINITE);
132 }
133 }
134
135 static void xaudio2Cleanup(Soloud *aSoloud)
136 {

Callers

nothing calls this directly

Calls 1

mixMethod · 0.80

Tested by

no test coverage detected