Audio utility functions implementation. More...
#include "audio_utils.h"#include "game_variables.h"#include "mgba_logger.h"#include "state_machine.h"#include "util.h"#include <maxmod.h>#include <stdlib.h>Go to the source code of this file.
Data Structures | |
| struct | AudioParamReq |
| struct | AudioParam |
| struct | MusicPlayerState |
Macros | |
| #define | AUDIO_PARAM_REQ_DEFAULT { .target = 0, .stride = 0 } |
| #define | AUDIO_PARAM_DEFINE(init_val) { .current = init_val, .req = AUDIO_PARAM_REQ_DEFAULT } |
Functions | |
| static void | set_audio_param_req (AudioParam *param, s32 target, s32 steps) |
| static void | speed_change_update (void) |
| static bool | audio_param_update (AudioParam *param) |
| Update the AudioParam for the music transition state machine for audio transitions. | |
| void | play_sfx (mm_word id, mm_word rate, mm_byte volume) |
| Play a sound effect, wrapper for mmEffectEx() See https://maxmod.org/ref/functions/mm_sound_effect.html and https://maxmod.org/ref/functions/mmEffectEx.html. | |
| void | play_lose_music (void) |
| Play music at a low pitch and slow tempo (lose screen) | |
| void | play_regular_music (void) |
| Play music at a normal pitch and tempo. | |
| void | set_volume (int volume) |
Variables | |
| static const u32 | DEFAULT_PITCH = 0x400 |
| static const u32 | DEFAULT_TEMPO = 0x400 |
| static const u32 | DEFAULT_VOLUME = MM_MODULE_FULL_VOLUME |
| static const u32 | MUSIC_CHANGE_FRAMES = 75 |
| static const u32 | VOLUME_CHANGE_FRAMES = MUSIC_CHANGE_FRAMES / 3 |
| static MusicPlayerState | music_player |
| static StateInfo | state_info [] |
| static StateMachine | song_speed_sm = STATE_MACHINE_DEFINE(state_info, 1) |
Audio utility functions implementation.
Definition in file audio_utils.c.
| #define AUDIO_PARAM_DEFINE | ( | init_val | ) | { .current = init_val, .req = AUDIO_PARAM_REQ_DEFAULT } |
Definition at line 31 of file audio_utils.c.
| #define AUDIO_PARAM_REQ_DEFAULT { .target = 0, .stride = 0 } |
Definition at line 30 of file audio_utils.c.
|
inlinestatic |
Update the AudioParam for the music transition state machine for audio transitions.
Definition at line 78 of file audio_utils.c.
| void play_lose_music | ( | void | ) |
Play music at a low pitch and slow tempo (lose screen)
Definition at line 116 of file audio_utils.c.
| void play_regular_music | ( | void | ) |
Play music at a normal pitch and tempo.
Definition at line 135 of file audio_utils.c.
| void play_sfx | ( | mm_word | id, |
| mm_word | rate, | ||
| mm_byte | volume | ||
| ) |
Play a sound effect, wrapper for mmEffectEx() See https://maxmod.org/ref/functions/mm_sound_effect.html and https://maxmod.org/ref/functions/mmEffectEx.html.
| id | the sound id to play, from maxmod compiled soundbank.h header |
| rate | the pitch rate, the default value is MM_BASE_PTCH_RATE |
| volume | the volume ranging from 0 (silent) to 255 (loudest) |
Definition at line 103 of file audio_utils.c.
|
static |
Definition at line 62 of file audio_utils.c.
| void set_volume | ( | int | volume | ) |
Definition at line 146 of file audio_utils.c.
|
static |
Definition at line 89 of file audio_utils.c.
|
static |
Definition at line 41 of file audio_utils.c.
|
static |
Definition at line 42 of file audio_utils.c.
|
static |
Definition at line 43 of file audio_utils.c.
|
static |
Definition at line 44 of file audio_utils.c.
|
static |
Definition at line 50 of file audio_utils.c.
|
static |
Definition at line 60 of file audio_utils.c.
|
static |
Definition at line 56 of file audio_utils.c.
|
static |
Definition at line 45 of file audio_utils.c.