Skip to content

Commit

Permalink
fix multiple voices playing simultaneously
Browse files Browse the repository at this point in the history
  • Loading branch information
mnml authored and AJenbo committed Sep 24, 2019
1 parent b95f215 commit 2c86411
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 8 additions & 1 deletion SourceX/miniwin/dsound.cpp
Expand Up @@ -48,7 +48,14 @@ ULONG DirectSoundBuffer::Release()
*/
HRESULT DirectSoundBuffer::GetStatus(LPDWORD pdwStatus)
{
return DVL_DSERR_INVALIDPARAM;
for (int i = 1; i < Mix_AllocateChannels(-1); i++) {
if (Mix_GetChunk(i) == chunk && Mix_Playing(i)) {
*pdwStatus = DVL_DSBSTATUS_PLAYING;
break;
}
}

return DVL_DS_OK;
};

HRESULT DirectSoundBuffer::Lock(DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1,
Expand Down
7 changes: 0 additions & 7 deletions SourceX/sound.cpp
Expand Up @@ -99,13 +99,6 @@ void snd_play_snd(TSnd *pSnd, int lVolume, int lPan)
return;
}

if (snd_playing(pSnd)) {
DSB = sound_dup_channel(pSnd->DSB);
if (DSB == NULL) {
return;
}
}

lVolume += sglSoundVolume;
if (lVolume < VOLUME_MIN) {
lVolume = VOLUME_MIN;
Expand Down

0 comments on commit 2c86411

Please sign in to comment.