Alchemy
Loading...
Searching...
No Matches

SoundPlayer Struct Reference

A player, which plays one song: its header and status, its tracks, its tempo and fade. More...

#include <sound/audio_engine_types.h>

Data Fields

const struct SequenceHeader * header
 The song playing or last played.
u32 status
 bits: 31 paused | 15..0 tracks active after the last tick.
u8 trackCount
 Tracks this player owns, at most 16.
u8 priority
 The song's priority.
u8 unk0a
 The last command run: its byte - 0xB1.
u8 checkPriority
 Nonzero: a song of lower priority does not replace a playing one.
u32 ticks
 Song ticks played since the song started.
u8 unk10 [8]
 Not named by TBS code.
u8 * workBytes
 gSound_WorkBytes, which the work-byte command uses.
u16 tempo
 Twice the tempo command's byte; 150 at start.
u16 tempoScale
 256 plays at the song's tempo.
u16 tempoStep
 tempo * tempoScale / 256, added to tempoCount each frame.
u16 tempoCount
 Each 150 in it runs one tick, so a tempoStep of 150 is a tick a frame.
u16 fadePeriod
 Frames between fade steps; 0 when not fading.
u16 fadeCounter
 Frames left until the next fade step.
u16 fadeVolume
 bits: 8..4 level, 0 to 0x100 in steps of 16 | 1 fade in | 0 pause at the end (SoundFadeFlag).
u8 unk2a [2]
 Not named by TBS code.
struct SoundTrack * tracks
 trackCount tracks.
const struct SoundVoice * voices
 The song's voice table.
u32 lock
 SOUND_LOCK when free; raised while the player is changed or ticked.
void(*) nextTick (struct SoundPlayer *player)
 The tick routine and player that were first in the chain before this player was added; this player's tick runs them first.
struct SoundPlayer * nextTickPlayer
 Passed to nextTick.

Detailed Description

A player, which plays one song: its header and status, its tracks, its tempo and fade.

Definition at line 352 of file audio_engine_types.h.

Field Documentation

◆ header

const struct SequenceHeader* SoundPlayer::header

The song playing or last played.

Definition at line 353 of file audio_engine_types.h.

Referenced by Audio_PlayOrResumeSound(), Audio_PlaySoundIfInactive(), Audio_ResumeSound(), Audio_StopSound(), and MusicPlayer_StartSong().

◆ status

u32 SoundPlayer::status

bits: 31 paused | 15..0 tracks active after the last tick.

Set to SOUND_PLAYER_PAUSED alone when no track is left.

Definition at line 356 of file audio_engine_types.h.

Referenced by Audio_PlayOrResumeSound(), Audio_PlaySoundIfInactive(), Audio_ResumePlayer(), MusicPlayer_Initialize(), MusicPlayer_SetFadeParameters(), MusicPlayer_StartSong(), MusicPlayer_StepFade(), MusicPlayer_StepVolumeAndPitchTowardTargets(), and MusicPlayer_Stop().

◆ trackCount

◆ priority

u8 SoundPlayer::priority

The song's priority.

Definition at line 358 of file audio_engine_types.h.

Referenced by MusicPlayer_StartSong().

◆ unk0a

u8 SoundPlayer::unk0a

The last command run: its byte - 0xB1.

Definition at line 359 of file audio_engine_types.h.

◆ checkPriority

u8 SoundPlayer::checkPriority

Nonzero: a song of lower priority does not replace a playing one.

From gSound_PlayerSlots, 0 for every player.

Definition at line 362 of file audio_engine_types.h.

Referenced by Audio_Initialize(), and MusicPlayer_StartSong().

◆ ticks

u32 SoundPlayer::ticks

Song ticks played since the song started.

Definition at line 363 of file audio_engine_types.h.

Referenced by MusicPlayer_StartSong().

◆ unk10

u8 SoundPlayer::unk10[8]

Not named by TBS code.

Definition at line 364 of file audio_engine_types.h.

◆ workBytes

u8* SoundPlayer::workBytes

gSound_WorkBytes, which the work-byte command uses.

Definition at line 365 of file audio_engine_types.h.

Referenced by Audio_Initialize(), and MusicTrack_OperateWorkByte().

◆ tempo

u16 SoundPlayer::tempo

Twice the tempo command's byte; 150 at start.

Definition at line 366 of file audio_engine_types.h.

Referenced by MusicPlayer_SetPitchAndUpdateFrequency(), and MusicPlayer_StartSong().

◆ tempoScale

u16 SoundPlayer::tempoScale

256 plays at the song's tempo.

Definition at line 367 of file audio_engine_types.h.

Referenced by MusicPlayer_SetPitchAndUpdateFrequency(), and MusicPlayer_StartSong().

◆ tempoStep

u16 SoundPlayer::tempoStep

tempo * tempoScale / 256, added to tempoCount each frame.

Definition at line 369 of file audio_engine_types.h.

Referenced by MusicPlayer_SetPitchAndUpdateFrequency(), and MusicPlayer_StartSong().

◆ tempoCount

u16 SoundPlayer::tempoCount

Each 150 in it runs one tick, so a tempoStep of 150 is a tick a frame.

Definition at line 371 of file audio_engine_types.h.

Referenced by MusicPlayer_StartSong().

◆ fadePeriod

u16 SoundPlayer::fadePeriod

Frames between fade steps; 0 when not fading.

Definition at line 372 of file audio_engine_types.h.

Referenced by MusicPlayer_SetFadeParameters(), MusicPlayer_StartSong(), and MusicPlayer_StepFade().

◆ fadeCounter

u16 SoundPlayer::fadeCounter

Frames left until the next fade step.

Definition at line 373 of file audio_engine_types.h.

Referenced by MusicPlayer_SetFadeParameters(), and MusicPlayer_StepFade().

◆ fadeVolume

u16 SoundPlayer::fadeVolume

bits: 8..4 level, 0 to 0x100 in steps of 16 | 1 fade in | 0 pause at the end (SoundFadeFlag).

Definition at line 376 of file audio_engine_types.h.

Referenced by MusicPlayer_SetFadeParameters(), and MusicPlayer_StepFade().

◆ unk2a

u8 SoundPlayer::unk2a[2]

Not named by TBS code.

Definition at line 377 of file audio_engine_types.h.

◆ tracks

◆ voices

const struct SoundVoice* SoundPlayer::voices

The song's voice table.

Definition at line 379 of file audio_engine_types.h.

Referenced by MusicPlayer_StartSong().

◆ lock

◆ nextTick

void(*) SoundPlayer::nextTick(struct SoundPlayer *player)

The tick routine and player that were first in the chain before this player was added; this player's tick runs them first.

Definition at line 384 of file audio_engine_types.h.

Referenced by MusicPlayer_Initialize().

◆ nextTickPlayer

struct SoundPlayer* SoundPlayer::nextTickPlayer

Passed to nextTick.

Definition at line 385 of file audio_engine_types.h.

Referenced by MusicPlayer_Initialize().