14#define NO_INSTRUMENT ((Instrument*) -1)
16#define AUDIO_SAMPLES 184
18#define AU_FX_MAX_TAPS 4
19#define AU_FX_LENGTH (14 * AUDIO_SAMPLES)
21#define AU_FILTER_LENGTH (28 * AUDIO_SAMPLES)
23#define HARDWARE_OUTPUT_RATE 32000
27#define AU_FRAME_USEC 5750
29#define N_AL_DECODER_IN 0
30#define N_AL_RESAMPLER_OUT 0
32#define N_AL_DECODER_OUT 0x170
33#define N_AL_TEMP_1 0x170
34#define N_AL_TEMP_2 0x2E0
35#define N_AL_MAIN_L_OUT 0x4E0
36#define N_AL_MAIN_R_OUT 0x650
37#define N_AL_AUX_L_OUT 0x7C0
38#define N_AL_AUX_R_OUT 0x930
40#define AU_MAX_BUS_VOLUME 0x8000
42#define ALIGN16_(val) (((val) + 0xF) & 0xFFF0)
43#define AU_FILE_RELATIVE(base,offset) ((void*)((s32)(offset) + (s32)(base)))
46#define VIDEO_FRAMES_PER_SECOND 50
47#define AUDIO_HEAP_SIZE 0x5B000
48#define AUDIO_MAX_SAMPLES (AUDIO_SAMPLES * 2)
49#define AUDIO_COMMAND_LIST_BUFFER_SIZE 0x5558
51#define VIDEO_FRAMES_PER_SECOND 60
52#define AUDIO_HEAP_SIZE 0x56000
53#define AUDIO_MAX_SAMPLES AUDIO_SAMPLES
54#define AUDIO_COMMAND_LIST_BUFFER_SIZE 0x4000
59#define DEFAULT_KEYBASE 4800
61#define AU_MAX_VOLUME_8 0x7F
62#define AU_MAX_VOLUME_16 0x7FFF
63#define AU_MAX_VOLUME_32 0x7FFFFFFF
70#define AU_VOL_8_TO_16(vol) (((vol) << 8) | 0xFF)
72#define AU_VOL_8_TO_32(vol) (((vol) << 0x18) | 0xFFFFFF)
75#define BGM_MAX_INSTRUMNETS 0x80
77#define BGM_DEFAULT_TICKS_PER_BEAT 48
81#define BGM_UPDATE_SCALE (1000)
83#define BGM_TEMPO_SCALE (100)
86#define BGM_MFRAMES_PER_MINUTE (BGM_UPDATE_SCALE * (60 * HARDWARE_OUTPUT_RATE) / AUDIO_SAMPLES)
89#define BGM_DEFAULT_BPM 156
91#define BGM_DEFAULT_TEMPO (BGM_DEFAULT_BPM * BGM_TEMPO_SCALE)
97#define BGM_DEFAULT_UPDATE_STEP 156250
100#define BGM_TEMPO_TO_UPDATE_UNITS(tempo) (BGM_UPDATE_SCALE * (u32)(tempo) / BGM_TEMPO_SCALE)
102#define SND_MIN_DURATION 250
103#define SND_MAX_DURATION 10000
105#define AU_SONG_NONE -1
107#define MUS_QUEUE_SIZE 16
108#define SFX_QUEUE_SIZE 16
111#define AU_SEMITONE_CENTS 100
114#define AU_OCTAVE_CENTS (12 * AU_SEMITONE_CENTS)
116#define ENV_VOL_MAX 0x80
117#define ENV_VOL_SHIFT 7
119#define PRG_MAX_COUNT 0x40
122#define VOL_MULT_2(a, b) ((a)*(b) >> ENV_VOL_SHIFT)
125#define VOL_MULT_3(a, b, c) ((a)*(b)*(c) >> ENV_VOL_SHIFT >> ENV_VOL_SHIFT)
128#define VOL_MULT_4(a, b, c, d) (VOL_MULT_2(VOL_MULT_3(a, b, c), d))
973#define INIT_BANK_BUFFER_SIZE 80
1390#ifndef NO_EXTERN_VARIABLES
BSS s32 PopupMenu_SelectedIndex
MSEQHeader * mseqFiles[4]
BGMInstrumentInfo * instrumentsInfo
@ SND_MANAGER_STATE_DISABLED
@ SND_MANAGER_STATE_ENABLED
InstrumentBank defaultBankSet[1]
struct BGMHeader * bgmFile
struct SeqArgs::@74 TrackTremoloDepth
SoundManagerMusicEvent bgmSounds[4]
u16 tremoloDelay
attack + sustain time
InstrumentBank bankSet5[16]
struct SeqArgs::@67 InstrumentReverb
s8 volumeChanged
Current write position for each custom envelope.
s32 CUSTOM_ECHO_PARAMS_1[]
Instrument * sfxInstrumentRef
u8 cmdBufPending
Buffer for an unused (legacy) system for controlling the BGMPlayer from the main thread.
s32 * customReverbParams[8]
SoundManager * soundManager
u8 firstVoice
number of polyphonic voices for this track
struct SeqArgs::@81 Detour
struct SeqArgs::@79 Branch
struct SeqArgs::@72 TrackTremolo
s32 songPlayingCounter
video frames (60 fps)
volatile u8 AuSynUseStereo
InstrumentBank bankSet2[16]
AuSynDriver * gActiveSynDriverPtr
s32 CUSTOM_SMALL_ROOM_PARAMS[]
s32 frameCounter
Number of video frame updates, used to update random numnber.
s16 customPressEnvelopes[8][9]
Instrument * defaultInstrument
struct AuResampler * resamplerTemplate
EnvelopePreset DummyInstrumentEnvelope
struct AuGlobals * globals
BKFileBuffer * auxBanks[3]
MusicEventTrigger * musicEventQueue
AuCallback onCompleteCallback
s32 AuEnvelopeIntervals[]
s32 frameCounter
current update counter value
SoundManager * gSoundManager
s16 prevUpdateResult
Unused, may indicate error status.
s16 masterPitchShift
unused; presumably another random parameter matching randomPitch and randomVelocity
struct MSEQHeader * dataMSEQ[2]
SoundRequest soundQueue[16]
Lock-free ring buffer for queueing sound effects from game thread.
AuGlobals * gSoundGlobals
EnvelopeOffset offsets[1]
AuCallback audioThreadCallbacks[2]
s8 busID
prevents notes from this track from being assigned voices, implemented for linked track pairs
s32 nextUpdateCounter
update counter threshold for a single tick
AuFilePos alternativeDataPos
u8 insPan
track volume, independent of instrument,
s16 DummyInstrumentCodebook[32]
struct SeqArgs::@65 InstrumentVolume
struct BGMPlayer * resumeCopyTo
InstrumentBank auxBankSet[4]
struct SeqArgs::@69 InstrumentCoarseTune
struct SeqArgs::@62 MasterVolumeFade
u8 AmbientSoundIDtoMSEQFileIndex[]
BankSetIndex
The bank indices used by audio assets when choosing an intrument.
AuLowPass * activeLowpass
@ BGM_SPECIAL_PROX_MIX_OVERRIDE
@ BGM_SPECIAL_SEEK_CUSTOM_ENV
@ BGM_SPECIAL_USE_CUSTOM_ENV
@ BGM_SPECIAL_WRITE_CUSTOM_ENV
@ BGM_SPECIAL_TRIGGER_SOUND
@ BGM_SPECIAL_SET_STEREO_DELAY
BGMInstrumentInfo * dataPRG
BankSet
corresponds with bank group IDs from INIT file bank list (InitBankEntry.bankSet)
SBNFileEntry * sbnFileList
u8 polyphonicIdx
voice idx end, exclusive
InstrumentBank bankSet6[4]
struct BGMPlayer * resumeCopyFrom
@ AU_VOICE_SYNC_FLAG_PARAMS
@ AU_VOICE_SYNC_FLAG_PAN_FXMIX
@ AU_VOICE_SYNC_FLAG_PITCH
struct SeqArgs::@59 MasterPitchShift
s32 CUSTOM_ECHO_PARAMS_3[]
u8 * trackVolsConfig
Dynamically customizable press envelopes.
struct SeqArgs::@64 OverridePatch
s32(* ALDMAproc2)(s32 addr, s32 len, void *state, u8 arg3)
s32 fileListLength
copied from SBN to the audio heap
InstrumentBank bankSet4[16]
struct SeqArgs::@80 EventTrigger
AmbienceVoiceState voiceStates[16]
BGMPlayerSnapshot snapshots[1]
struct Instrument * instrument
u8 lastVoice
voice idx start
struct SeqArgs::@75 RandomPan
SoundManagerCustomCmdList customCmdList[4]
u8 unused_0C
hardware sample output rate
u8 effectValues[4]
No means to modify value is implemented.
s16 tremoloDelay
live track detune, independent of instrument, instantly affects all active voices and subsequent note...
struct SeqArgs::@63 MasterEffect
u8 customEnvelopeWritePos[8]
Currently active (for writing) custom envelope.
@ MUSIC_STATE_STOP_CURRENT
@ MUSIC_STATE_AWAIT_FADEOUT
s32 PreventBGMPlayerUpdate
While TRUE, the audio thread skips BGM player updates.
s32 tickUpdateInterval
update counter amount to add per audio frame
AuSynDriver * gSynDriverPtr
s16_16 insVolumeStep
volume for current instrument, reset if instrument is changed
s32 songListLength
copied from INIT to the audio heap
struct SeqArgs::@77 TrackVolumeFade
AmbienceSavedVoice savedVoices[4]
ALDMAproc2(* ALDMANew2)(void *state)
struct SeqArgs::@82 Special
@ MUSIC_FLAG_FADE_IN_NEXT
@ MUSIC_FLAG_ENABLE_PROX_MIX
s32 CUSTOM_ECHO_PARAMS_2[]
AuFilePos loopStartPos[2]
@ BGM_COMP_END_COND_LOOP_FALSE
@ BGM_COMP_END_COND_LOOP_TRUE
AmbiencePlayer players[4]
struct SeqArgs::@78 ReverbType
struct SeqArgs::@73 TrackTremoloRate
struct AuResampler * activeResampler
struct BGMHeader * dataBGM[2]
@ SND_PLAYER_STATE_CONTINUE
EnvelopePreset * envelopes
BGMInstrumentInfo defaultPRGEntry
Instrument * InstrumentBank[16]
@ SOUND_INSTANCE_FLAG_POSITION_CHANGED
@ SOUND_INSTANCE_FLAG_ACTIVE
u8 priority
Used to mute any linked tracks after the first one encountered.
struct SeqArgs::@58 MasterVolume
struct BGMPlayer * bgmPlayer
BGMPlayerTrack tracks[16]
struct SeqArgs::@76 UseInstrument
struct SeqArgs::@68 TrackVolume
u8 DummyInstrumentWavData[190]
u8 sfxQueueReadPos
Read index for the soundQueue ring buffer (audio thread)
InstrumentBank * bankSets[8]
s8 customReverbAmounts[8]
@ AU_PRIORITY_BGM_PLAYER_MAIN
@ AU_PRIORITY_MSEQ_MANAGER
@ AU_PRIORITY_SFX_MANAGER
@ AU_PRIORITY_BGM_PLAYER_AUX
struct SeqArgs::@57 MasterTempo
SegData * compActiveLoopEndPos[4]
struct SeqArgs::@60 UnkCmdE3
SegData * compLoopStartLabels[32]
struct SeqArgs::@61 MasterTempoFade
char pad_18[8]
if true, the player is paused, else it will be saved to a snapshot
AuEffectChange effectChanges[4]
copied from INIT to the audio heap, seems to exist only to find SEF, PER, and PRG
u8 sfxQueueWritePos
Write index for the soundQueue ring buffer (game thread)
struct AuLowPass * lowpassTemplate
@ AU_DELAY_STATE_OFF
channel delay is enabled (though not necessarily applied)
@ AU_DELAY_STATE_REQUEST_OFF
channel delay is disabled
@ AU_VOICE_ENV_FLAG_KEY_RELEASED
@ AU_VOICE_ENV_FLAG_RELEASING
@ AU_VOICE_ENV_FLAG_VOL_CHANGED
@ AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE
u8 * envelopCustomPressProfile
struct SeqArgs::@71 TrackDetune
s8 volume
cent detune for instrument, reset if instrument is changed
MusicEventTrigger * musicEventQueuePos
struct SeqArgs::@70 InstrumentFineTune
AuLowPass * lowpassTemplate
s8 insFineDetune
semitone detune for instrument, reset if instrument is changed
struct AuVoice * curVoice
AmbienceManager * gAuAmbienceManager
InstrumentBank musicBankSet[16]
struct AuLowPass * activeLowpass
BGMDrumInfo defaultDrumEntry
struct SeqArgs::@66 InstrumentPan
Represents a dummy BK file large enough to hold everything except the wave data.
Structure for volume fading for SFX and BGM. Has independent controls for base and envelope volumes.
Compact identifier for a voice used by the ambience system.