From 1007905fc9e0f3ed9199224998a8515976d1b753 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sat, 4 Feb 2017 16:48:26 +0100 Subject: [PATCH] Remove dsound stuff already replaced by sdl --- blupi.cpp | 2 +- misc.h | 2 ++ sound.cpp | 35 +++++++---------------------------- sound.h | 5 +---- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/blupi.cpp b/blupi.cpp index 4623883..295c757 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -722,7 +722,7 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) g_pSound = new CSound; if ( g_pSound == NULL ) return InitFail("New sound", true); - g_pSound->Create(g_hWnd); + g_pSound->Create(); g_pSound->CacheAll(); g_pSound->SetState(true); diff --git a/misc.h b/misc.h index ad07aa4..4706167 100644 --- a/misc.h +++ b/misc.h @@ -3,6 +3,8 @@ #pragma once +#include + extern void InitHInstance(HINSTANCE hInstance); extern void OutputDebug(char *pMessage); extern void LoadString(UINT nID, char *pBuffer, int lgBuffer); diff --git a/sound.cpp b/sound.cpp index 586f98b..015a0a6 100644 --- a/sound.cpp +++ b/sound.cpp @@ -104,13 +104,6 @@ CSound::CSound() m_lastMidiVolume = 0; m_nbSuspendSkip = 0; - m_lpDS = NULL; - - for ( i=0 ; iRelease(); - m_lpDSB[i]= NULL; - } - } + if (!m_lpSDL[i]) + continue; - if ( m_lpDS != NULL ) - { - m_lpDS->Release(); - m_lpDS = NULL; + Mix_FreeChunk (m_lpSDL[i]); + m_lpSDL[i] = nullptr; } } // Initialisation de DirectSound. -bool CSound::Create(HWND hWnd) +bool CSound::Create() { m_bEnable = true; @@ -223,10 +210,8 @@ bool CSound::Cache(int channel, char *pFilename) if ( !m_bEnable ) return false; if ( channel < 0 || channel >= MAXSOUND ) return false; - if ( m_lpDSB[channel] != NULL ) - { + if (m_lpSDL[channel]) Flush(channel); - } m_lpSDL[channel] = Mix_LoadWAV (pFilename); if (!m_lpSDL[channel]) @@ -245,12 +230,6 @@ void CSound::Flush(int channel) if ( !m_bEnable ) return; if ( channel < 0 || channel >= MAXSOUND ) return; - if ( m_lpDSB[channel] != NULL ) - { - m_lpDSB[channel]->Release(); - m_lpDSB[channel]= NULL; - } - if (m_lpSDL[channel]) { Mix_FreeChunk (m_lpSDL[channel]); @@ -291,7 +270,7 @@ bool CSound::Play(int channel, int volume, Uint8 panLeft, Uint8 panRight) bool CSound::PlayImage(int channel, POINT pos, int rank) { - int stopCh, volumex, volumey, volume, pan; + int stopCh, volumex, volumey, volume; if ( rank >= 0 && rank < MAXBLUPI ) { diff --git a/sound.h b/sound.h index 2c6e89d..82140aa 100644 --- a/sound.h +++ b/sound.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include @@ -20,7 +19,7 @@ public: CSound(); ~CSound(); - bool Create(HWND hWnd); + bool Create(); void SetState(bool bState); bool GetEnable(); @@ -48,8 +47,6 @@ protected: HWND m_hWnd; bool m_bEnable; bool m_bState; - LPDIRECTSOUND m_lpDS; - LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND]; Mix_Chunk *m_lpSDL[MAXSOUND]; short m_channelBlupi[MAXBLUPI]; UINT m_MidiDeviceID;