2017-01-21 17:27:46 +01:00
|
|
|
// sound.h
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2017-02-04 18:01:56 +01:00
|
|
|
#include <Windows.h>
|
2017-02-04 16:23:43 +01:00
|
|
|
#include <SDL_mixer.h>
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define MAXSOUND 100
|
|
|
|
#define MAXVOLUME 20
|
|
|
|
#define MAXBLUPI 100
|
|
|
|
|
|
|
|
class CSound
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CSound();
|
|
|
|
~CSound();
|
|
|
|
|
2017-02-04 16:48:26 +01:00
|
|
|
bool Create();
|
2017-01-22 00:10:12 +01:00
|
|
|
void SetState(bool bState);
|
|
|
|
bool GetEnable();
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
void SetAudioVolume(int volume);
|
|
|
|
int GetAudioVolume();
|
|
|
|
void SetMidiVolume(int volume);
|
|
|
|
int GetMidiVolume();
|
|
|
|
|
|
|
|
void CacheAll();
|
2017-01-22 00:10:12 +01:00
|
|
|
bool Cache(int channel, char *pFilename);
|
2017-01-21 17:27:46 +01:00
|
|
|
void Flush(int channel);
|
|
|
|
|
2017-02-04 16:23:43 +01:00
|
|
|
bool Play(int channel, int volume=0, Uint8 panLeft = 255, Uint8 panRight = 255);
|
2017-01-22 00:10:12 +01:00
|
|
|
bool PlayImage(int channel, POINT pos, int rank=-1);
|
2017-02-04 18:01:56 +01:00
|
|
|
bool PlayMusic(LPSTR lpszMIDIFilename);
|
2017-01-22 00:10:12 +01:00
|
|
|
bool RestartMusic();
|
2017-01-21 17:27:46 +01:00
|
|
|
void SuspendMusic();
|
|
|
|
void StopMusic();
|
2017-01-22 00:10:12 +01:00
|
|
|
bool IsPlayingMusic();
|
2017-02-04 17:59:07 +01:00
|
|
|
bool IsStoppedOnDemand ();
|
2017-01-21 17:27:46 +01:00
|
|
|
void AdaptVolumeMusic();
|
|
|
|
void SetSuspendSkip(int nb);
|
2017-01-22 00:10:12 +01:00
|
|
|
bool StopAllSounds();
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
protected:
|
2017-01-22 00:10:12 +01:00
|
|
|
bool m_bEnable;
|
|
|
|
bool m_bState;
|
2017-02-04 17:59:07 +01:00
|
|
|
bool m_bStopped;
|
|
|
|
Mix_Music *m_pMusic;
|
2017-02-04 16:23:43 +01:00
|
|
|
Mix_Chunk *m_lpSDL[MAXSOUND];
|
2017-01-21 17:27:46 +01:00
|
|
|
short m_channelBlupi[MAXBLUPI];
|
|
|
|
char m_MIDIFilename[50];
|
|
|
|
int m_audioVolume;
|
|
|
|
int m_midiVolume;
|
|
|
|
int m_lastMidiVolume;
|
|
|
|
int m_nbSuspendSkip;
|
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|