1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix the function to stop all sounds

Note that this functions is not used...
This commit is contained in:
Mathieu Schroeter 2017-02-04 16:29:39 +01:00
parent d0abde9274
commit db53c5b38f

View File

@ -10,14 +10,6 @@
#include "resource.h" #include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// The following macro are used for proper error handling for DirectSound.
#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return false; } } }
struct WaveHeader struct WaveHeader
{ {
BYTE RIFF[4]; // "RIFF" BYTE RIFF[4]; // "RIFF"
@ -96,22 +88,16 @@ bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
bool CSound::StopAllSounds() bool CSound::StopAllSounds()
{ {
// Make sure we have a valid sound buffer for (int i = 0; i < MAXSOUND; i ++)
for (int i = 0; i < MAXSOUND; i ++) {
{ if (!m_lpSDL[i])
if ( m_lpDSB[i] ) continue;
{
DWORD dwStatus;
TRY_DS(m_lpDSB[i]->GetStatus(&dwStatus));
if ( (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING ) if (Mix_Playing (i + 1) == SDL_TRUE)
{ Mix_FadeOutChannel (i + 1, 500);
TRY_DS(m_lpDSB[i]->Stop()) }
}
}
}
return true; return true;
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////