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

62 lines
1.3 KiB
C
Raw Normal View History

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