2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-18 17:58:52 +01:00
|
|
|
#include <string>
|
2017-01-21 17:27:46 +01:00
|
|
|
#include <stdio.h>
|
2017-02-10 23:03:33 +01:00
|
|
|
#include <SDL2/SDL_mixer.h>
|
2017-02-20 18:14:37 +01:00
|
|
|
|
2017-02-10 00:14:28 +01:00
|
|
|
#include "blupi.h"
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
|
2017-02-12 13:14:22 +01:00
|
|
|
#define MAXSOUND 100
|
|
|
|
#define MAXVOLUME 20
|
|
|
|
#define MAXBLUPI 100
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
class CSound
|
|
|
|
{
|
|
|
|
public:
|
2017-02-12 13:14:22 +01:00
|
|
|
CSound();
|
|
|
|
~CSound();
|
|
|
|
|
|
|
|
bool Create();
|
|
|
|
void SetState (bool bState);
|
|
|
|
bool GetEnable();
|
|
|
|
|
|
|
|
void SetAudioVolume (Sint32 volume);
|
|
|
|
Sint32 GetAudioVolume();
|
|
|
|
void SetMidiVolume (Sint32 volume);
|
|
|
|
Sint32 GetMidiVolume();
|
|
|
|
|
|
|
|
void CacheAll();
|
2017-02-18 17:58:52 +01:00
|
|
|
bool Cache (Sint32 channel, const std::string &pFilename);
|
2017-02-28 21:49:15 +01:00
|
|
|
void FlushAll ();
|
2017-02-12 13:14:22 +01:00
|
|
|
void Flush (Sint32 channel);
|
|
|
|
|
|
|
|
bool Play (Sint32 channel, Sint32 volume = 0, Uint8 panLeft = 255,
|
|
|
|
Uint8 panRight = 255);
|
|
|
|
bool PlayImage (Sint32 channel, POINT pos, Sint32 rank = -1);
|
2017-03-04 17:19:36 +01:00
|
|
|
bool PlayMusic (const std::string &lpszMIDIFilename);
|
2017-02-12 13:14:22 +01:00
|
|
|
bool RestartMusic();
|
|
|
|
void SuspendMusic();
|
|
|
|
void StopMusic();
|
|
|
|
bool IsPlayingMusic();
|
|
|
|
bool IsStoppedOnDemand();
|
|
|
|
void AdaptVolumeMusic();
|
|
|
|
void SetSuspendSkip (Sint32 nb);
|
2017-07-30 22:38:51 +02:00
|
|
|
bool StopAllSounds(bool immediat);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
protected:
|
2017-02-12 13:14:22 +01:00
|
|
|
bool m_bState;
|
|
|
|
bool m_bStopped;
|
|
|
|
Mix_Music *m_pMusic;
|
|
|
|
Mix_Chunk *m_lpSDL[MAXSOUND];
|
|
|
|
Sint16 m_channelBlupi[MAXBLUPI];
|
2017-03-04 17:19:36 +01:00
|
|
|
std::string m_MIDIFilename;
|
2017-02-12 13:14:22 +01:00
|
|
|
Sint32 m_audioVolume;
|
|
|
|
Sint32 m_midiVolume;
|
|
|
|
Sint32 m_lastMidiVolume;
|
|
|
|
Sint32 m_nbSuspendSkip;
|
2017-01-21 17:27:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|