Skip to content

Commit

Permalink
xaudio2: Wait for engine thread to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
aeikum committed Nov 27, 2018
1 parent 4ae91e6 commit ce7cacb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dlls/xaudio2_7/xaudio_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,8 @@ static DWORD WINAPI engine_thread(void *user)

pthread_mutex_lock(&This->engine_lock);

pthread_cond_broadcast(&This->engine_done);

do{
pthread_cond_wait(&This->engine_ready, &This->engine_lock);

Expand Down Expand Up @@ -1763,8 +1765,14 @@ static HRESULT WINAPI IXAudio2Impl_CreateMasteringVoice(IXAudio2 *iface,

This->mst.effect_chain = wrap_effect_chain(pEffectChain);

pthread_mutex_lock(&This->mst.engine_lock);

This->mst.engine_thread = CreateThread(NULL, 0, &engine_thread, &This->mst, 0, NULL);

pthread_cond_wait(&This->mst.engine_done, &This->mst.engine_lock);

pthread_mutex_unlock(&This->mst.engine_lock);

FAudio_SetEngineProcedureEXT(This->faudio, &engine_cb, &This->mst);

FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
Expand Down

0 comments on commit ce7cacb

Please sign in to comment.