add global audio mute config option

This commit is contained in:
Sebastian Krzyszkowiak 2018-07-26 15:33:02 +02:00
parent 09e8b5249b
commit 7c92d1e05e
2 changed files with 3 additions and 0 deletions

View file

@ -93,6 +93,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
game->config.music = strtol(GetConfigOptionDefault(game, "SuperDerpy", "music", "10"), NULL, 10); game->config.music = strtol(GetConfigOptionDefault(game, "SuperDerpy", "music", "10"), NULL, 10);
game->config.voice = strtol(GetConfigOptionDefault(game, "SuperDerpy", "voice", "10"), NULL, 10); game->config.voice = strtol(GetConfigOptionDefault(game, "SuperDerpy", "voice", "10"), NULL, 10);
game->config.fx = strtol(GetConfigOptionDefault(game, "SuperDerpy", "fx", "10"), NULL, 10); game->config.fx = strtol(GetConfigOptionDefault(game, "SuperDerpy", "fx", "10"), NULL, 10);
game->config.mute = strtol(GetConfigOptionDefault(game, "SuperDerpy", "mute", "0"), NULL, 10);
game->config.debug = strtol(GetConfigOptionDefault(game, "SuperDerpy", "debug", "0"), NULL, 10); game->config.debug = strtol(GetConfigOptionDefault(game, "SuperDerpy", "debug", "0"), NULL, 10);
game->config.width = strtol(GetConfigOptionDefault(game, "SuperDerpy", "width", "1280"), NULL, 10); game->config.width = strtol(GetConfigOptionDefault(game, "SuperDerpy", "width", "1280"), NULL, 10);
if (game->config.width < 320) { game->config.width = 320; } if (game->config.width < 320) { game->config.width = 320; }
@ -264,6 +265,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
al_set_mixer_gain(game->audio.fx, game->config.fx / 10.0); al_set_mixer_gain(game->audio.fx, game->config.fx / 10.0);
al_set_mixer_gain(game->audio.music, game->config.music / 10.0); al_set_mixer_gain(game->audio.music, game->config.music / 10.0);
al_set_mixer_gain(game->audio.voice, game->config.voice / 10.0); al_set_mixer_gain(game->audio.voice, game->config.voice / 10.0);
al_set_mixer_playing(game->audio.mixer, !game->config.mute);
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");

View file

@ -78,6 +78,7 @@ struct Game {
int fx; /*!< Effects volume. */ int fx; /*!< Effects volume. */
int music; /*!< Music volume. */ int music; /*!< Music volume. */
int voice; /*!< Voice volume. */ int voice; /*!< Voice volume. */
bool mute; /*!< Whether audio should be muted globally. */
bool fullscreen; /*!< Fullscreen toggle. */ bool fullscreen; /*!< Fullscreen toggle. */
bool debug; /*!< Toggles debug mode. */ bool debug; /*!< Toggles debug mode. */
int width; /*!< Width of window as being set in configuration. */ int width; /*!< Width of window as being set in configuration. */