papermario
Decompilation of Paper Mario
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
core.h File Reference

Functions

void create_audio_system (void)
 
void nuAuMgr (void *arg)
 
s32 nuAuDmaCallBack (s32 addr, s32 len, void *state, u8 useDma)
 DMA callback for audio sample streaming; manages a DMA buffer cache.
 
void au_release_voice (u8 index)
 
void au_engine_init (s32 outputRate)
 
void au_update_clients_for_video_frame (void)
 this is called once per video frame update (50 or 60 times per second)
 
void au_update_clients_for_audio_frame (void)
 this is called per audio frame generated by alAudioFrame (every 184 audio samples) there will be multiuple of these per video frame
 
void au_syn_begin_audio_frame (AuGlobals *globals)
 
void au_reset_nonfree_voice (AuVoice *arg0, u8 arg1)
 
void au_reset_voice (AuVoice *voice, u8 voiceIdx)
 
f32 au_compute_pitch_ratio (s32 tuning)
 Converts a linear pitch value (in cents) into a frequency ratio suitable for adjusting playback speed.
 
void au_fade_init (Fade *fade, s32 time, s32 startValue, s32 endValue)
 
void au_fade_clear (Fade *fade)
 
void au_fade_update (Fade *fade)
 
void au_fade_set_volume (u8 arg0, u16 arg1, s32 arg2)
 
void au_fade_flush (Fade *fade)
 
void au_fade_set_envelope (Fade *fade, s16 value)
 
void au_fade_calc_envelope (Fade *fade, u32 arg1, s32 target)
 
void au_fade_update_envelope (Fade *fade)
 
Instrumentau_get_instrument (AuGlobals *globals, BankSetIndex bank, s32 patch, EnvelopeData *arg3)
 Note that bank is supplied as BankSetIndex and not BankSet, which means it will be used to perform a raw access into AuGlobals::bankSets.
 
void au_get_bgm_player_and_file (u32 playerIndex, BGMHeader **outCurrentTrackData, BGMPlayer **outPlayer)
 
void au_get_bgm_player (u32 playerIndex, BGMPlayer **outPlayer)
 
AuResult au_load_song_files (u32 arg0, BGMHeader *arg1, BGMPlayer *arg2)
 
AuResult au_reload_song_files (s32 songID, BGMHeader *arg1)
 
BGMPlayerau_get_snapshot_by_index (s32 index)
 
AuResult au_ambient_load (u32 arg0)
 
BGMPlayerau_get_client_by_priority (u8 arg0)
 
void au_load_INIT (AuGlobals *arg0, s32 romAddr, ALHeap *heap)
 
AuResult au_fetch_SBN_file (u32 fileIdx, AuFileFormat format, SBNFileEntry *arg2)
 
void au_load_PER (AuGlobals *globals, s32 romAddr)
 
void au_load_PRG (AuGlobals *arg0, s32 romAddr)
 
InstrumentBankau_get_BK_instruments (BankSet bankSet, u32 bankIndex)
 
BKFileBufferau_load_BK_to_bank (s32 bkFileOffset, BKFileBuffer *bkFile, s32 bankIndex, BankSet bankSet)
 Loads an instrument bank file from ROM, allocates memory if needed, and sets up instrument pointers.
 
void au_swizzle_BK_instruments (s32 bkFileOffset, BKFileBuffer *bkFile, InstrumentBank instruments, u32 instrumentCount, u8 arg4)
 Fixes up (swizzles) instrument pointers in a loaded bank, converting file-relative offsets to valid RAM pointers.
 
BKFileBufferau_load_static_BK_to_bank (s32 *bkFileOffset, void *vaddr, s32 bankIndex, BankSet bankSet)
 UNUSED Loads an instrument bank file from ROM to a given buffer (allocates if needed), and sets up instrument pointers.
 
s32 au_load_aux_bank (s32 bkFileOffset, s32 bankIndex)
 
void au_clear_instrument_group (s32 bankIndex, BankSet bankSet)
 unused. resets all instruments in (bankIndex, bankSet) to default
 
void au_set_bus_volume_level (s32 arg0, u32 idx)
 
s32 au_set_reverb_type (s32 arg0, s32 arg1)
 
void au_sync_channel_delay_enabled (u32 arg0)
 
void au_read_rom (s32 romAddr, void *buffer, u32 size)
 
void au_memset (void *dst, s32 size, u8 value)
 
void au_copy_bytes (s8 *src, s8 *dest, s32 size)
 
void au_copy_words (void *src, void *dst, s32 size)
 
void au_driver_init (AuSynDriver *driver, ALConfig *config)
 
void au_driver_release (void)
 
void au_use_global_volume (void)
 
void au_set_global_volume (s16 arg0)
 
s16 au_get_global_volume (void)
 
void au_set_stereo_enabled (b8 enabled)
 
void au_bus_set_volume (u8 busID, u16 value)
 
u16 au_bus_get_volume (u8 busID)
 
void au_bus_set_effect (u8 busID, u8 effectID)
 
void au_bus_set_fx_params (u8 busID, s16 arg1, s16 arg2, s32 arg3)
 
void au_pvoice_set_bus (u8 voiceIdx, s8 busID)
 
void au_syn_stop_voice (u8 voiceIdx)
 
void au_syn_start_voice (u8 index)
 
void au_syn_start_voice_params (u8 index, u8 reverbType, Instrument *table, f32 pitch, s16 vol, u8 pan, u8 fxMix, s32 delta)
 
void au_syn_set_wavetable (u8 voiceIdx, Instrument *table)
 
void au_syn_set_pitch (u8 voiceIdx, f32 pitchRatio)
 
void au_syn_set_mixer_params (u8 voiceIdx, s16 volume, s32 arg2, u8 arg3, u8 arg4)
 
void au_syn_set_pan_fxmix (u8 voiceIdx, u8 arg1, u8 arg2)
 
void au_syn_set_volume_delta (u8 voiceIdx, s16 arg1, s32 arg2)
 
void au_syn_set_pan (u8 voiceIdx, u8 pan)
 
void au_syn_set_fxmix (u8 voiceIdx, u8 dryAmt)
 
s32 au_syn_get_playing (u8 voiceIdx)
 
s32 au_syn_get_bus (u8 voiceIdx)
 
f32 au_syn_get_pitch (u8 voiceIdx)
 
u8 au_syn_get_pan (u8 voiceIdx)
 
s16 au_syn_get_dryamt (u8 voiceIdx)
 
s16 au_syn_get_wetamt (u8 voiceIdx)
 
s32 au_syn_get_volume_left (u8 voiceIdx)
 
s32 au_syn_get_volume_right (u8 voiceIdx)
 
void au_set_delay_time (s32 arg0)
 
void au_delay_left_channel (u8 arg0)
 
void au_delay_right_channel (u8 arg0)
 
void au_disable_channel_delay (void)
 
void au_init_delay_channel (s16 arg0)
 
voidalHeapAlloc (ALHeap *heap, s32 count, s32 size)
 
void au_flush_finished_voices (AuGlobals *globals)
 (UNUSED) Immediately flush all voices which have finished playing.
 
void au_init_voices (AuGlobals *globals)
 Initializes all voices in the audio system.
 
void au_update_voices (AuGlobals *globals)
 Main envelope system update, called once per frame.
 
void au_voice_after_volume_change (AuVoice *voice)
 Applies volume update after a client-side volume change.
 
s32 au_voice_get_delta (s32 usecs)
 Converts envelope step duration from microseconds to num samples delta.
 
void au_voice_start (AuVoice *voice, EnvelopeData *envData)
 Starts a new voice with the given envelope data.
 
u8 au_voice_step (AuVoice *voice)
 Parses and executes envelope commands until a time interval is found.
 
void au_voice_set_vol_changed (AuVoice *voice)
 (UNUSED) Force recalculation of voice envelope volume during next update.
 
Acmdau_pull_voice (AuPVoice *pvoice, Acmd *cmdBufPos)
 
void au_fx_create (AuFX *fx, u8 mode, ALHeap *heap)
 
void au_filter_create (AuFilter *filter, ALHeap *heap)
 
void au_filter_init (AuFilter *filter, s16 arg1, s16 arg2, s16 fc)
 
void au_fx_load_preset (AuFX *fx, u8 effectType)
 
Acmdau_pull_fx (AuFX *fx, Acmd *cmdBusPos, s16, s16)
 Applies a chain of delay-line based effects to audio and mixes into output.
 
s32 au_fx_param_hdl (AuFX *fx, s16 index, s16 paramID, s32 value)
 

Function Documentation

◆ alHeapAlloc()

◆ au_ambient_load()

AuResult au_ambient_load ( u32 arg0)

Referenced by snd_load_ambient().

◆ au_bus_get_volume()

u16 au_bus_get_volume ( u8 busID)

◆ au_bus_set_effect()

void au_bus_set_effect ( u8 busID,
u8 effectID )

◆ au_bus_set_fx_params()

void au_bus_set_fx_params ( u8 busID,
s16 arg1,
s16 arg2,
s32 arg3 )

◆ au_bus_set_volume()

void au_bus_set_volume ( u8 busID,
u16 value )

Referenced by au_fade_set_volume().

◆ au_clear_instrument_group()

void au_clear_instrument_group ( s32 bankIndex,
BankSet bankSet )

unused. resets all instruments in (bankIndex, bankSet) to default

◆ au_compute_pitch_ratio()

f32 au_compute_pitch_ratio ( s32 tuning)

Converts a linear pitch value (in cents) into a frequency ratio suitable for adjusting playback speed.

This function computes the playback rate corresponding to a pitch shift (up or down) in cents. Positive values increase pitch (higher frequency), and negative values decrease it. Recall 100 cents = 1 semitone, and therefore 1200 cents = 1 octave.

Parameters
tuningThe pitch offset in cents, from +4095 (~ 40.95 semitones up) to -16383 (~ 163.83 semitones down)
Returns
Floating point output rate multiplier. Multiply this with the base sample rate to apply the pitch.

Referenced by au_bgm_player_update_playing(), au_mseq_player_update(), and au_mseq_restore_voices().

◆ au_copy_bytes()

void au_copy_bytes ( s8 * src,
s8 * dest,
s32 size )

◆ au_copy_words()

void au_copy_words ( void * src,
void * dst,
s32 size )

◆ au_delay_left_channel()

void au_delay_left_channel ( u8 arg0)

◆ au_delay_right_channel()

void au_delay_right_channel ( u8 arg0)

◆ au_disable_channel_delay()

void au_disable_channel_delay ( void )

◆ au_driver_init()

void au_driver_init ( AuSynDriver * driver,
ALConfig * config )

Referenced by create_audio_system().

◆ au_driver_release()

void au_driver_release ( void )

◆ au_engine_init()

void au_engine_init ( s32 outputRate)

Referenced by create_audio_system().

◆ au_fade_calc_envelope()

void au_fade_calc_envelope ( Fade * fade,
u32 arg1,
s32 target )

Referenced by au_bgm_adjust_volume().

◆ au_fade_clear()

void au_fade_clear ( Fade * fade)

◆ au_fade_flush()

void au_fade_flush ( Fade * fade)

Referenced by au_set_bus_volume_level().

◆ au_fade_init()

void au_fade_init ( Fade * fade,
s32 time,
s32 startValue,
s32 endValue )

◆ au_fade_set_envelope()

void au_fade_set_envelope ( Fade * fade,
s16 value )

Referenced by au_bgm_player_init().

◆ au_fade_set_volume()

void au_fade_set_volume ( u8 arg0,
u16 arg1,
s32 arg2 )

◆ au_fade_update()

void au_fade_update ( Fade * fade)

◆ au_fade_update_envelope()

void au_fade_update_envelope ( Fade * fade)

◆ au_fetch_SBN_file()

AuResult au_fetch_SBN_file ( u32 fileIdx,
AuFileFormat format,
SBNFileEntry * arg2 )

◆ au_filter_create()

void au_filter_create ( AuFilter * filter,
ALHeap * heap )

◆ au_filter_init()

void au_filter_init ( AuFilter * filter,
s16 arg1,
s16 arg2,
s16 fc )

Referenced by au_filter_create().

◆ au_flush_finished_voices()

void au_flush_finished_voices ( AuGlobals * globals)

(UNUSED) Immediately flush all voices which have finished playing.

These are normally released automatically during the start of each audio frame.

◆ au_fx_create()

void au_fx_create ( AuFX * fx,
u8 effectType,
ALHeap * heap )
Parameters
effectTypefrom enum AuEffectType

Referenced by au_driver_init().

◆ au_fx_load_preset()

void au_fx_load_preset ( AuFX * fx,
u8 effectType )

Referenced by au_bus_set_effect(), and au_fx_create().

◆ au_fx_param_hdl()

s32 au_fx_param_hdl ( AuFX * fx,
s16 index,
s16 paramID,
s32 value )

Referenced by au_bus_set_fx_params().

◆ au_get_bgm_player()

void au_get_bgm_player ( u32 playerIndex,
BGMPlayer ** outPlayer )

◆ au_get_bgm_player_and_file()

void au_get_bgm_player_and_file ( u32 playerIndex,
BGMHeader ** outCurrentTrackData,
BGMPlayer ** outPlayer )

Referenced by snd_song_load().

◆ au_get_BK_instruments()

InstrumentBank * au_get_BK_instruments ( BankSet bankSet,
u32 bankIndex )

◆ au_get_client_by_priority()

BGMPlayer * au_get_client_by_priority ( u8 arg0)

Referenced by au_bgm_process_resume().

◆ au_get_global_volume()

s16 au_get_global_volume ( void )

Referenced by nuAuPreNMIProc().

◆ au_get_instrument()

Instrument * au_get_instrument ( AuGlobals * globals,
BankSetIndex bank,
s32 patch,
EnvelopeData * envData )

Note that bank is supplied as BankSetIndex and not BankSet, which means it will be used to perform a raw access into AuGlobals::bankSets.

This does not affect values above 3, but 1 and 2 differ.

Referenced by au_bgm_player_update_playing(), au_BGMCmd_E8_TrackOverridePatch(), au_BGMCmd_F5_UseInstrument(), and au_mseq_player_update().

◆ au_get_snapshot_by_index()

BGMPlayer * au_get_snapshot_by_index ( s32 index)

◆ au_init_delay_channel()

void au_init_delay_channel ( s16 arg0)

Referenced by au_engine_init().

◆ au_init_voices()

void au_init_voices ( AuGlobals * globals)

Initializes all voices in the audio system.

Sets default values and clears previous envelope state.

Referenced by au_engine_init().

◆ au_load_aux_bank()

s32 au_load_aux_bank ( s32 bkFileOffset,
s32 bankIndex )

◆ au_load_BK_to_bank()

BKFileBuffer * au_load_BK_to_bank ( s32 bkFileOffset,
BKFileBuffer * bkFile,
s32 bankIndex,
BankSet bankSet )

Loads an instrument bank file from ROM, allocates memory if needed, and sets up instrument pointers.

Instruments in the bank will be configured to use DMA streaming for sample/codebook data. This is the standard loader for streamed instrument banks.

Referenced by au_load_aux_bank(), and au_load_BK_headers().

◆ au_load_INIT()

void au_load_INIT ( AuGlobals * arg0,
s32 romAddr,
ALHeap * heap )

Referenced by au_engine_init().

◆ au_load_PER()

void au_load_PER ( AuGlobals * globals,
s32 romAddr )

Referenced by au_engine_init().

◆ au_load_PRG()

void au_load_PRG ( AuGlobals * arg0,
s32 romAddr )

Referenced by au_engine_init().

◆ au_load_song_files()

AuResult au_load_song_files ( u32 arg0,
BGMHeader * arg1,
BGMPlayer * arg2 )

Referenced by snd_song_load().

◆ au_load_static_BK_to_bank()

BKFileBuffer * au_load_static_BK_to_bank ( s32 * inAddr,
void * outAddr,
s32 bankIndex,
BankSet bankSet )

UNUSED Loads an instrument bank file from ROM to a given buffer (allocates if needed), and sets up instrument pointers.

Instruments are configured to always bypass DMA: sample and codebook data is assumed to be already present in RAM. Use this only for banks whose sample data is guaranteed to be preloaded, not for standard streaming.

◆ au_memset()

void au_memset ( void * dst,
s32 size,
u8 value )

◆ au_pull_fx()

Acmd * au_pull_fx ( AuFX * fx,
Acmd * ptr,
s16 wetDmem,
s16 tempDmem )

Applies a chain of delay-line based effects to audio and mixes into output.

For each delay tap in the FX chain:

  • Loads delay input/output from circular buffer.
  • Applies optional modulation and resampling.
  • Applies feedforward/feedback mixing.
  • Applies optional lowpass filtering.
  • Mixes result into wet output buffer.
Parameters
fxPointer to FX state (delay taps, buffers, etc.)
ptrPointer to the current audio command list position.
wetDmemDMEM offset to mix wet output into.
tempDmemBase DMEM offset for temporary working buffers.
Returns
Updated command list pointer.

Referenced by alAudioFrame().

◆ au_pull_voice()

Acmd * au_pull_voice ( AuPVoice * pvoice,
Acmd * cmdBufPos )

Referenced by alAudioFrame().

◆ au_pvoice_set_bus()

void au_pvoice_set_bus ( u8 voiceIdx,
s8 busID )

Referenced by au_engine_init().

◆ au_read_rom()

◆ au_release_voice()

void au_release_voice ( u8 index)

Referenced by au_pull_voice().

◆ au_reload_song_files()

AuResult au_reload_song_files ( s32 songID,
BGMHeader * arg1 )

Referenced by au_bgm_process_resume().

◆ au_reset_nonfree_voice()

void au_reset_nonfree_voice ( AuVoice * arg0,
u8 arg1 )

◆ au_reset_voice()

◆ au_set_bus_volume_level()

void au_set_bus_volume_level ( s32 arg0,
u32 idx )

◆ au_set_delay_time()

void au_set_delay_time ( s32 arg0)

◆ au_set_global_volume()

void au_set_global_volume ( s16 arg0)

Referenced by nuAuPreNMIProc().

◆ au_set_reverb_type()

s32 au_set_reverb_type ( s32 arg0,
s32 arg1 )

Referenced by snd_set_sfx_reverb_type().

◆ au_set_stereo_enabled()

void au_set_stereo_enabled ( b8 enabled)

Referenced by snd_set_mono(), and snd_set_stereo().

◆ au_swizzle_BK_instruments()

void au_swizzle_BK_instruments ( s32 bkFileOffset,
BKFileBuffer * file,
InstrumentBank instruments,
u32 instrumentCount,
u8 useDma )

Fixes up (swizzles) instrument pointers in a loaded bank, converting file-relative offsets to valid RAM pointers.

Sets whether each instrument uses DMA streaming or not, and updates pitch ratios to match output rate. Replaces NULL instruments with a default instrument to ensure all loaded patches point to valid data.

Referenced by au_load_BK_to_bank(), and au_load_static_BK_to_bank().

◆ au_syn_begin_audio_frame()

void au_syn_begin_audio_frame ( AuGlobals * globals)

◆ au_syn_get_bus()

s32 au_syn_get_bus ( u8 voiceIdx)

◆ au_syn_get_dryamt()

s16 au_syn_get_dryamt ( u8 voiceIdx)

◆ au_syn_get_pan()

u8 au_syn_get_pan ( u8 voiceIdx)

◆ au_syn_get_pitch()

f32 au_syn_get_pitch ( u8 voiceIdx)

◆ au_syn_get_playing()

s32 au_syn_get_playing ( u8 voiceIdx)

◆ au_syn_get_volume_left()

s32 au_syn_get_volume_left ( u8 voiceIdx)

◆ au_syn_get_volume_right()

s32 au_syn_get_volume_right ( u8 voiceIdx)

◆ au_syn_get_wetamt()

s16 au_syn_get_wetamt ( u8 voiceIdx)

◆ au_syn_set_fxmix()

void au_syn_set_fxmix ( u8 voiceIdx,
u8 dryAmt )

◆ au_syn_set_mixer_params()

void au_syn_set_mixer_params ( u8 voiceIdx,
s16 volume,
s32 arg2,
u8 arg3,
u8 arg4 )

◆ au_syn_set_pan()

void au_syn_set_pan ( u8 voiceIdx,
u8 pan )

Referenced by alAudioFrame().

◆ au_syn_set_pan_fxmix()

void au_syn_set_pan_fxmix ( u8 voiceIdx,
u8 arg1,
u8 arg2 )

◆ au_syn_set_pitch()

void au_syn_set_pitch ( u8 voiceIdx,
f32 pitchRatio )

◆ au_syn_set_volume_delta()

void au_syn_set_volume_delta ( u8 voiceIdx,
s16 arg1,
s32 arg2 )

◆ au_syn_set_wavetable()

void au_syn_set_wavetable ( u8 voiceIdx,
Instrument * table )

Referenced by au_engine_init().

◆ au_syn_start_voice()

void au_syn_start_voice ( u8 index)

◆ au_syn_start_voice_params()

void au_syn_start_voice_params ( u8 index,
u8 reverbType,
Instrument * table,
f32 pitch,
s16 vol,
u8 pan,
u8 fxMix,
s32 delta )

◆ au_syn_stop_voice()

void au_syn_stop_voice ( u8 voiceIdx)

◆ au_sync_channel_delay_enabled()

void au_sync_channel_delay_enabled ( u32 arg0)

Referenced by snd_set_mono(), and snd_set_stereo().

◆ au_update_clients_for_audio_frame()

void au_update_clients_for_audio_frame ( void )

this is called per audio frame generated by alAudioFrame (every 184 audio samples) there will be multiuple of these per video frame

this is called per audio frame generated by alAudioFrame (every 184 audio samples) there will be multiuple of these per video frame

Updates MSEQ, SFX, and BGM players for the current audio frame.

Referenced by alAudioFrame().

◆ au_update_clients_for_video_frame()

void au_update_clients_for_video_frame ( void )

this is called once per video frame update (50 or 60 times per second)

Referenced by alAudioFrame().

◆ au_update_voices()

void au_update_voices ( AuGlobals * globals)

Main envelope system update, called once per frame.

Progresses envelope state for all active voices.

Referenced by au_update_clients_for_audio_frame().

◆ au_use_global_volume()

void au_use_global_volume ( void )

Referenced by nuAuPreNMIProc().

◆ au_voice_after_volume_change()

void au_voice_after_volume_change ( AuVoice * voice)

Applies volume update after a client-side volume change.

This is deferred to avoid modifying envelope state mid-step.

Referenced by au_update_voices().

◆ au_voice_get_delta()

s32 au_voice_get_delta ( s32 usecs)

Converts envelope step duration from microseconds to num samples delta.

Uses AU_FRAME_USEC as the base time slice, returning the number of audio samples corresponding to the provided duration.

Parameters
msecsTime duration in microseconds.
Returns
Number of samples that should pass in this interval.

Referenced by au_update_voices(), au_voice_after_volume_change(), and au_voice_start().

◆ au_voice_set_vol_changed()

void au_voice_set_vol_changed ( AuVoice * voice)

(UNUSED) Force recalculation of voice envelope volume during next update.

◆ au_voice_start()

void au_voice_start ( AuVoice * voice,
EnvelopeData * envData )

Starts a new voice with the given envelope data.

Initializes envelope state and prepares the press phase for playback.

Parameters
voicePointer to the voice being started.
envDataEnvelope command lists (press and release) to use.

Referenced by au_syn_begin_audio_frame().

◆ au_voice_step()

u8 au_voice_step ( AuVoice * voice)

Parses and executes envelope commands until a time interval is found.

Commands include setting multipliers, loop control, etc.

Referenced by au_update_voices(), and au_voice_start().

◆ create_audio_system()

void create_audio_system ( void )

◆ nuAuDmaCallBack()

s32 nuAuDmaCallBack ( s32 addr,
s32 len,
void * state,
u8 useDma )

DMA callback for audio sample streaming; manages a DMA buffer cache.

Referenced by nuAuDmaNew().

◆ nuAuMgr()

void nuAuMgr ( void * arg)

Referenced by create_audio_system().