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

Remove dsound stuff already replaced by sdl

This commit is contained in:
Mathieu Schroeter 2017-02-04 16:48:26 +01:00
parent 393dfb0b7c
commit 1007905fc9
4 changed files with 11 additions and 33 deletions

View File

@ -722,7 +722,7 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pSound = new CSound; g_pSound = new CSound;
if ( g_pSound == NULL ) return InitFail("New sound", true); if ( g_pSound == NULL ) return InitFail("New sound", true);
g_pSound->Create(g_hWnd); g_pSound->Create();
g_pSound->CacheAll(); g_pSound->CacheAll();
g_pSound->SetState(true); g_pSound->SetState(true);

2
misc.h
View File

@ -3,6 +3,8 @@
#pragma once #pragma once
#include <Windows.h>
extern void InitHInstance(HINSTANCE hInstance); extern void InitHInstance(HINSTANCE hInstance);
extern void OutputDebug(char *pMessage); extern void OutputDebug(char *pMessage);
extern void LoadString(UINT nID, char *pBuffer, int lgBuffer); extern void LoadString(UINT nID, char *pBuffer, int lgBuffer);

View File

@ -104,13 +104,6 @@ CSound::CSound()
m_lastMidiVolume = 0; m_lastMidiVolume = 0;
m_nbSuspendSkip = 0; m_nbSuspendSkip = 0;
m_lpDS = NULL;
for ( i=0 ; i<MAXSOUND ; i++ )
{
m_lpDSB[i] = NULL;
}
for ( i=0 ; i<MAXBLUPI ; i++ ) for ( i=0 ; i<MAXBLUPI ; i++ )
{ {
m_channelBlupi[i] = -1; m_channelBlupi[i] = -1;
@ -130,24 +123,18 @@ CSound::~CSound()
for ( i=0 ; i<MAXSOUND ; i++ ) for ( i=0 ; i<MAXSOUND ; i++ )
{ {
if ( m_lpDSB[i] != NULL ) if (!m_lpSDL[i])
{ continue;
//? m_lpDSB[i]->Release();
m_lpDSB[i]= NULL;
}
}
if ( m_lpDS != NULL ) Mix_FreeChunk (m_lpSDL[i]);
{ m_lpSDL[i] = nullptr;
m_lpDS->Release();
m_lpDS = NULL;
} }
} }
// Initialisation de DirectSound. // Initialisation de DirectSound.
bool CSound::Create(HWND hWnd) bool CSound::Create()
{ {
m_bEnable = true; m_bEnable = true;
@ -223,10 +210,8 @@ bool CSound::Cache(int channel, char *pFilename)
if ( !m_bEnable ) return false; if ( !m_bEnable ) return false;
if ( channel < 0 || channel >= MAXSOUND ) return false; if ( channel < 0 || channel >= MAXSOUND ) return false;
if ( m_lpDSB[channel] != NULL ) if (m_lpSDL[channel])
{
Flush(channel); Flush(channel);
}
m_lpSDL[channel] = Mix_LoadWAV (pFilename); m_lpSDL[channel] = Mix_LoadWAV (pFilename);
if (!m_lpSDL[channel]) if (!m_lpSDL[channel])
@ -245,12 +230,6 @@ void CSound::Flush(int channel)
if ( !m_bEnable ) return; if ( !m_bEnable ) return;
if ( channel < 0 || channel >= MAXSOUND ) return; if ( channel < 0 || channel >= MAXSOUND ) return;
if ( m_lpDSB[channel] != NULL )
{
m_lpDSB[channel]->Release();
m_lpDSB[channel]= NULL;
}
if (m_lpSDL[channel]) if (m_lpSDL[channel])
{ {
Mix_FreeChunk (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) 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 ) if ( rank >= 0 && rank < MAXBLUPI )
{ {

View File

@ -3,7 +3,6 @@
#pragma once #pragma once
#include <dsound.h>
#include <stdio.h> #include <stdio.h>
#include <SDL_mixer.h> #include <SDL_mixer.h>
@ -20,7 +19,7 @@ public:
CSound(); CSound();
~CSound(); ~CSound();
bool Create(HWND hWnd); bool Create();
void SetState(bool bState); void SetState(bool bState);
bool GetEnable(); bool GetEnable();
@ -48,8 +47,6 @@ protected:
HWND m_hWnd; HWND m_hWnd;
bool m_bEnable; bool m_bEnable;
bool m_bState; bool m_bState;
LPDIRECTSOUND m_lpDS;
LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
Mix_Chunk *m_lpSDL[MAXSOUND]; Mix_Chunk *m_lpSDL[MAXSOUND];
short m_channelBlupi[MAXBLUPI]; short m_channelBlupi[MAXBLUPI];
UINT m_MidiDeviceID; UINT m_MidiDeviceID;