_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
#include "sound.h"Go to the source code of this file.
sound_server.h - The sound server header file. | |
| #define | MaxVolume 255 |
| #define | SOUND_BUFFER_SIZE 65536 |
| uint32_t | SDL_SOUND_FINISHED |
| int | SetChannelVolume (int channel, int volume) |
| Set the channel volume. More... | |
| void | SetChannelStereo (int channel, int stereo) |
| Set the channel stereo. More... | |
| Mix_Chunk * | GetChannelSample (int channel) |
| Get the sample playing on a channel. More... | |
| void | StopChannel (int channel) |
| Stop a channel. More... | |
| void | StopAllChannels () |
| Stop all channels. More... | |
| bool | UnitSoundIsPlaying (Origin *origin) |
| Check if this unit plays some sound. More... | |
| bool | SampleIsPlaying (Mix_Chunk *sample) |
| Check, if this sample is already playing. More... | |
| Mix_Music * | LoadMusic (const std::string &name) |
| Load music. More... | |
| Mix_Chunk * | LoadSample (const std::string &name) |
| Load a sample. More... | |
| void | FreeSample (Mix_Chunk *sample) |
| int | PlaySample (Mix_Chunk *sample, Origin *origin=NULL) |
| Play a sample. More... | |
| int | PlaySample (Mix_Chunk *sample, void(*callback)(int channel)) |
| Play a sample, registering a "finished" callback. More... | |
| int | PlaySoundFile (const std::string &name) |
| Play a sound file. More... | |
| void | SetEffectsVolume (int volume) |
| Set effects volume. More... | |
| int | GetEffectsVolume () |
| Get effects volume. More... | |
| void | SetEffectsEnabled (bool enabled) |
| Set effects enabled. More... | |
| bool | IsEffectsEnabled () |
| Check if effects are enabled. More... | |
| void | SetMusicFinishedCallback (void(*callback)()) |
| Set the music finished callback. More... | |
| int | PlayMusic (const std::string &file) |
| Play a music file. More... | |
| void | StopMusic () |
| Stop music playing. More... | |
| void | SetMusicVolume (int volume) |
| Set music volume. More... | |
| int | GetMusicVolume () |
| Get music volume. More... | |
| void | SetMusicEnabled (bool enabled) |
| Set music enabled. More... | |
| bool | IsMusicEnabled () |
| Check if music is enabled. More... | |
| bool | IsMusicPlaying () |
| Check if music is playing. More... | |
| bool | SoundEnabled () |
| Check if sound is enabled. More... | |
| int | InitSound () |
| Initialize the sound card. More... | |
| void | QuitSound () |
| Cleanup sound. More... | |
| void | HandleSoundEvent (SDL_Event &event) |
| #define MaxVolume 255 |
| #define SOUND_BUFFER_SIZE 65536 |
| void FreeSample | ( | Mix_Chunk * | sample | ) |
Free a sample loaded with LoadSample.
| sample |
| Mix_Chunk* GetChannelSample | ( | int | channel | ) |
Get the sample playing on a channel.
Get the sample playing on a channel
| int GetEffectsVolume | ( | ) |
Get effects volume.
Get effects volume
| int GetMusicVolume | ( | ) |
Get music volume.
Get music volume
| void HandleSoundEvent | ( | SDL_Event & | event | ) |
| int InitSound | ( | ) |
Initialize the sound card.
Initialize sound card.
| bool IsEffectsEnabled | ( | ) |
Check if effects are enabled.
Check if effects are enabled
| bool IsMusicEnabled | ( | ) |
Check if music is enabled.
Check if music is enabled
| bool IsMusicPlaying | ( | ) |
Check if music is playing.
Check if music is playing
| Mix_Music* LoadMusic | ( | const std::string & | name | ) |
Load music.
Load a music file
| name | File name |
| Mix_Chunk* LoadSample | ( | const std::string & | name | ) |
Load a sample.
Load a sample
| name | File name of sample (short version). |
| int PlayMusic | ( | const std::string & | file | ) |
Play a music file.
Play a music file. This also enables the music finished callback.
| file | Name of music file, format is automatically detected. |
| int PlaySample | ( | Mix_Chunk * | sample, |
| Origin * | origin = NULL |
||
| ) |
Play a sample.
| int PlaySample | ( | Mix_Chunk * | sample, |
| void(*)(int channel) | callback | ||
| ) |
Play a sample, registering a "finished" callback.
| int PlaySoundFile | ( | const std::string & | name | ) |
Play a sound file.
| void QuitSound | ( | ) |
Cleanup sound.
Cleanup sound server.
| bool SampleIsPlaying | ( | Mix_Chunk * | sample | ) |
Check, if this sample is already playing.
Check if this sound is already playing
| void SetChannelStereo | ( | int | channel, |
| int | stereo | ||
| ) |
Set the channel stereo.
Set the channel stereo
| channel | Channel to set |
| stereo | -128 to 127, out of range will not set the stereo |
| int SetChannelVolume | ( | int | channel, |
| int | volume | ||
| ) |
Set the channel volume.
Set the channel volume
| channel | Channel to set |
| volume | New volume 0-255, <0 will not set the volume |
| void SetEffectsEnabled | ( | bool | enabled | ) |
Set effects enabled.
Set effects enabled
| void SetEffectsVolume | ( | int | volume | ) |
Set effects volume.
Set the global sound volume.
| volume | the sound volume 0-255 |
| void SetMusicEnabled | ( | bool | enabled | ) |
Set music enabled.
Set music enabled
Set the music finished callback.
Set the music finished callback
| void SetMusicVolume | ( | int | volume | ) |
Set music volume.
Set the music volume.
| volume | the music volume 0-255 |
| bool SoundEnabled | ( | ) |
Check if sound is enabled.
Check if sound is enabled
| void StopAllChannels | ( | ) |
Stop all channels.
Stop all channels
| void StopChannel | ( | int | channel | ) |
Stop a channel.
Stop a channel
| channel | Channel to stop |
| void StopMusic | ( | ) |
Stop music playing.
Stop the current playing music. This does not trigger the music finished callback.
| bool UnitSoundIsPlaying | ( | Origin * | origin | ) |
Check if this unit plays some sound.
| uint32_t SDL_SOUND_FINISHED |
1.8.17
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.