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;
if ( g_pSound == NULL ) return InitFail("New sound", true);
g_pSound->Create(g_hWnd);
g_pSound->Create();
g_pSound->CacheAll();
g_pSound->SetState(true);

2
misc.h
View File

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

View File

@ -104,13 +104,6 @@ CSound::CSound()
m_lastMidiVolume = 0;
m_nbSuspendSkip = 0;
m_lpDS = NULL;
for ( i=0 ; i<MAXSOUND ; i++ )
{
m_lpDSB[i] = NULL;
}
for ( i=0 ; i<MAXBLUPI ; i++ )
{
m_channelBlupi[i] = -1;
@ -130,24 +123,18 @@ CSound::~CSound()
for ( i=0 ; i<MAXSOUND ; i++ )
{
if ( m_lpDSB[i] != NULL )
{
//? m_lpDSB[i]->Release();
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 )
{

View File

@ -3,7 +3,6 @@
#pragma once
#include <dsound.h>
#include <stdio.h>
#include <SDL_mixer.h>
@ -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;