Browse Source

add methods to Audio class to mute/unmute and change volume per channel

undefined
jeunathe Sam Hocevar <sam@hocevar.net> 11 years ago
parent
commit
958d8c403e
2 changed files with 30 additions and 0 deletions
  1. +27
    -0
      src/audio.cpp
  2. +3
    -0
      src/audio.h

+ 27
- 0
src/audio.cpp View File

@@ -43,5 +43,32 @@ void Audio::Setup(int channels)
#endif
}

void Audio::SetVolume(int channel, int volume)
{
#if defined USE_SDL_MIXER
Mix_Volume(channel,volume);
#else
UNUSED(channel);
#endif
}

void Audio::MuteAll()
{
#if defined USE_SDL_MIXER
Mix_Volume(-1,0);
#else
UNUSED(false);
#endif
}

void Audio::UnmuteAll()
{
#if defined USE_SDL_MIXER
Mix_Volume(-1,MIX_MAX_VOLUME);
#else
UNUSED(false);
#endif
}

} /* namespace lol */


+ 3
- 0
src/audio.h View File

@@ -26,6 +26,9 @@ class Audio
{
public:
static void Setup(int channels);
static void SetVolume(int channel,int volume);
static void MuteAll();
static void UnmuteAll();

private:
Audio() {}


Loading…
Cancel
Save