31 #ifndef __SOUND_SERVER_H__
32 #define __SOUND_SERVER_H__
47 #define SOUND_BUFFER_SIZE 65536
59 virtual int Read(
void *buf,
int len) = 0;
140 extern int PlayMusic(
const std::string &file);
161 #ifdef USE_FLUIDSYNTH
172 #endif // !__SOUND_SERVER_H__
void SetMusicEnabled(bool enabled)
Set music enabled.
Definition: sound_server.cpp:753
Definition: sound_server.h:88
void SetEffectsEnabled(bool enabled)
Set effects enabled.
Definition: sound_server.cpp:643
CSample * LoadFluidSynth(const char *name, int flags)
Load a module file.
Definition: fluidsynth.cpp:249
int GetEffectsVolume()
Get effects volume.
Definition: sound_server.cpp:635
Load compressed in memory.
Definition: sound_server.h:77
bool SampleIsPlaying(CSample *sample)
Check, if this sample is already playing.
Definition: sound_server.cpp:363
void SetEffectsVolume(int volume)
Set effects volume.
Definition: sound_server.cpp:626
virtual ~CSample()
Definition: sound_server.h:57
int GetMusicVolume()
Get music volume.
Definition: sound_server.cpp:745
int PlayMusic(CSample *sample)
Play a music file.
Definition: sound_server.cpp:675
unsigned int Frequency
sample size in bits
Definition: sound_server.h:63
CSample()
Definition: sound_server.h:55
unsigned short BitsPerSample
frequency in hz
Definition: sound_server.h:64
_play_audio_flags_
Definition: sound_server.h:74
unsigned char Channels
Definition: sound_server.h:61
int PlaySoundFile(const std::string &name)
Play a sound file.
Definition: sound_server.cpp:612
virtual int Read(void *buf, int len)=0
CSample * GetChannelSample(int channel)
Get the sample playing on a channel.
Definition: sound_server.cpp:499
SynthState
Definition: sound_server.h:85
void SetMusicVolume(int volume)
Set music volume.
Definition: sound_server.cpp:736
void StopAllChannels()
Stop all channels.
Definition: sound_server.cpp:526
CSample * LoadVorbis(const char *name, int flags)
Load a wav file.
Definition: ogg.cpp:390
bool IsMusicPlaying()
Check if music is playing.
Definition: sound_server.cpp:774
int Len
buffer position
Definition: sound_server.h:68
int InitSound()
Initialize the sound card.
Definition: sound_server.cpp:831
bool UnitSoundIsPlaying(Origin *origin)
Check if this unit plays some sound.
Definition: sound_server.cpp:373
int InitFluidSynth()
Init FluidSynth library.
Definition: fluidsynth.cpp:190
bool SoundEnabled()
Check if sound is enabled.
Definition: sound_server.cpp:786
void CleanFluidSynth(bool reinit=false)
Definition: fluidsynth.cpp:166
bool IsEffectsEnabled()
Check if effects are enabled.
Definition: sound_server.cpp:651
int Pos
sample buffer
Definition: sound_server.h:67
Definition: sound_server.h:87
void QuitSound()
Cleanup sound.
Definition: sound_server.cpp:866
Preload file into memory.
Definition: sound_server.h:78
void SetChannelFinishedCallback(int channel, void(*callback)(int channel))
Set the channel's callback for when a sound finishes playing.
Definition: sound_server.cpp:488
void StopChannel(int channel)
Stop a channel.
Definition: sound_server.cpp:512
CSample * LoadSample(const std::string &name)
Load a sample.
Definition: sound_server.cpp:575
SynthState GetFluidSynthState()
Gets the state of Fluidsynth player.
Definition: fluidsynth.cpp:157
void SetMusicFinishedCallback(void(*callback)())
Set the music finished callback.
Definition: sound_server.cpp:663
Definition: sound_server.h:75
unsigned char * Buffer
bits in a sample 8/16/32
Definition: sound_server.h:66
int SetChannelStereo(int channel, int stereo)
Set the channel stereo.
Definition: sound_server.cpp:463
CSample * LoadMikMod(const char *name, int flags)
Load a vorbis file.
Definition: mikmod.cpp:196
Definition: sound_server.h:89
Definition: sound_server.h:52
Stream the file from medium.
Definition: sound_server.h:76
unsigned char SampleSize
mono or stereo
Definition: sound_server.h:62
bool IsMusicEnabled()
Check if music is enabled.
Definition: sound_server.cpp:766
int SetChannelVolume(int channel, int volume)
Load a MIDI file.
Definition: sound_server.cpp:436
int PlaySample(CSample *sample, Origin *origin=NULL)
Play a sample.
Definition: sound_server.cpp:593
void StopMusic()
Stop music playing.
Definition: sound_server.cpp:718
CSample * LoadWav(const char *name, int flags)
Definition: wav.cpp:230