From db53c5b38fac42d1d7314c197f000ec07eed0575 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sat, 4 Feb 2017 16:29:39 +0100 Subject: [PATCH] Fix the function to stop all sounds Note that this functions is not used... --- sound.cpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/sound.cpp b/sound.cpp index 97df755..66b02f7 100644 --- a/sound.cpp +++ b/sound.cpp @@ -10,14 +10,6 @@ #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 { BYTE RIFF[4]; // "RIFF" @@ -96,22 +88,16 @@ bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR bool CSound::StopAllSounds() { - // Make sure we have a valid sound buffer - for (int i = 0; i < MAXSOUND; i ++) - { - if ( m_lpDSB[i] ) - { - DWORD dwStatus; - TRY_DS(m_lpDSB[i]->GetStatus(&dwStatus)); + for (int i = 0; i < MAXSOUND; i ++) + { + if (!m_lpSDL[i]) + continue; - if ( (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING ) - { - TRY_DS(m_lpDSB[i]->Stop()) - } - } - } + if (Mix_Playing (i + 1) == SDL_TRUE) + Mix_FadeOutChannel (i + 1, 500); + } - return true; + return true; } /////////////////////////////////////////////////////////////////////////////