Alchemy
Loading...
Searching...
No Matches

SoundNote Struct Reference

A PCM note, one of 12 the mixer renders: its state and envelope, its output levels, and its links to the other notes of its track. More...

#include <sound/audio_engine_types.h>

Data Fields

u8 state
 0 when free.
u8 kind
 The voice's kind; bits 2..0 nonzero for a CGB note.
u8 outRight
 Velocity and track volume to the right, 0 to 255.
u8 outLeft
 Velocity and track volume to the left, 0 to 255.
u8 unk04 [2]
 The voice's attack (0x04) and decay (0x05).
u8 sustain
 The voice's sustain level.
u8 unk07 [3]
 The voice's release (0x07), the key played (0x08) and the envelope level, 0 to 255 (0x09).
u8 peak
 For a PCM note, the mixer writes the envelope's right level here each frame; the name comes from CgbNote.peak.
u8 unk0b [0x0e]
 0x0b left level, 0x0c echo level, 0x0d echo frames, 0x10 gate in ticks, 0x11 the song's key, 0x12 velocity, 0x13 priority, 0x14 rhythm pan; the mixer keeps a PCM note's samples left in the word at 0x18.
u8 sustainLevel
 CgbNote.sustainLevel; inside the samples-left word for a PCM note.
u8 unk1a
 Inside the samples-left word for a PCM note.
u8 panBits
 CgbNote.panBits; inside the samples-left word for a PCM note.
u8 channelBits
 CgbNote.channelBits; for a PCM note, the mixer's fractional sample position is the word at 0x1c.
u8 unk1d [0x0f]
 0x1d CGB update bits, 0x1e CGB length, 0x1f CGB sweep, 0x20 the word frequency, 0x24 the voice's target (the sample), 0x28 the next sample byte (mixer).
struct SoundTrack * track
 The track whose list holds this note; NULL once detached.
struct SoundNote * prev
 The note started after this one in the track's list (nearer its head); NULL at the head.
struct SoundNote * next
 The note started before this one in the track's list; NULL at the end.
u8 unk38 [8]
 Not named by TBS code.

Detailed Description

A PCM note, one of 12 the mixer renders: its state and envelope, its output levels, and its links to the other notes of its track.

A track's note list holds CGB notes through this type too; the names from 0x0a to 0x1c come from the CGB layout (CgbNote).

Definition at line 142 of file audio_engine_types.h.

Field Documentation

◆ state

u8 SoundNote::state

0 when free.

bits: 7 start | 6 released | 4 looping | 2 echo | 1..0 phase (3 attack, 2 decay, 1 sustain, 0 release).

Definition at line 145 of file audio_engine_types.h.

Referenced by AudioEngine_SetMode(), and AudioEngine_StopAllChannels().

◆ kind

u8 SoundNote::kind

The voice's kind; bits 2..0 nonzero for a CGB note.

Definition at line 146 of file audio_engine_types.h.

◆ outRight

u8 SoundNote::outRight

Velocity and track volume to the right, 0 to 255.

Definition at line 147 of file audio_engine_types.h.

◆ outLeft

u8 SoundNote::outLeft

Velocity and track volume to the left, 0 to 255.

Definition at line 148 of file audio_engine_types.h.

◆ unk04

u8 SoundNote::unk04[2]

The voice's attack (0x04) and decay (0x05).

Definition at line 149 of file audio_engine_types.h.

◆ sustain

u8 SoundNote::sustain

The voice's sustain level.

Definition at line 150 of file audio_engine_types.h.

◆ unk07

u8 SoundNote::unk07[3]

The voice's release (0x07), the key played (0x08) and the envelope level, 0 to 255 (0x09).

Definition at line 153 of file audio_engine_types.h.

◆ peak

u8 SoundNote::peak

For a PCM note, the mixer writes the envelope's right level here each frame; the name comes from CgbNote.peak.

Definition at line 156 of file audio_engine_types.h.

◆ unk0b

u8 SoundNote::unk0b[0x0e]

0x0b left level, 0x0c echo level, 0x0d echo frames, 0x10 gate in ticks, 0x11 the song's key, 0x12 velocity, 0x13 priority, 0x14 rhythm pan; the mixer keeps a PCM note's samples left in the word at 0x18.

Definition at line 160 of file audio_engine_types.h.

◆ sustainLevel

u8 SoundNote::sustainLevel

CgbNote.sustainLevel; inside the samples-left word for a PCM note.

Definition at line 162 of file audio_engine_types.h.

◆ unk1a

u8 SoundNote::unk1a

Inside the samples-left word for a PCM note.

Definition at line 163 of file audio_engine_types.h.

◆ panBits

u8 SoundNote::panBits

CgbNote.panBits; inside the samples-left word for a PCM note.

Definition at line 164 of file audio_engine_types.h.

◆ channelBits

u8 SoundNote::channelBits

CgbNote.channelBits; for a PCM note, the mixer's fractional sample position is the word at 0x1c.

Definition at line 167 of file audio_engine_types.h.

◆ unk1d

u8 SoundNote::unk1d[0x0f]

0x1d CGB update bits, 0x1e CGB length, 0x1f CGB sweep, 0x20 the word frequency, 0x24 the voice's target (the sample), 0x28 the next sample byte (mixer).

Definition at line 171 of file audio_engine_types.h.

◆ track

struct SoundTrack* SoundNote::track

The track whose list holds this note; NULL once detached.

Definition at line 173 of file audio_engine_types.h.

◆ prev

struct SoundNote* SoundNote::prev

The note started after this one in the track's list (nearer its head); NULL at the head.

Definition at line 176 of file audio_engine_types.h.

◆ next

struct SoundNote* SoundNote::next

The note started before this one in the track's list; NULL at the end.

Definition at line 178 of file audio_engine_types.h.

◆ unk38

u8 SoundNote::unk38[8]

Not named by TBS code.

Definition at line 179 of file audio_engine_types.h.