Alchemy
Loading...
Searching...
No Matches

tables.c File Reference

Go to the source code of this file.

Typedefs

typedef void(*) SoundFunc(void)
typedef void(*) SoundCommand(struct SoundPlayer *player, struct SoundTrack *track)
 A command table entry: the driver calls it with the player and the track.

Functions

void MusicTrack_FinishSequence (void)
void MusicTrack_Goto (void)
void MusicTrack_CallPattern (void)
void MusicTrack_ReturnFromPattern (void)
void MusicTrack_Repeat (void)
void MusicTrack_SetPriorityFromCommand (void)
void MusicPlayer_SetTempoFromCommand (void)
void MusicTrack_SetKeyOffsetFromCommand (void)
void MusicTrack_SetVoiceFromCommand (void)
void MusicTrack_SetVolumeFromCommand (void)
void MusicTrack_SetPanFromCommand (void)
void MusicTrack_SetBendFromCommand (void)
void MusicTrack_SetBendRangeFromCommand (void)
void MusicTrack_SetLfoSpeedFromCommand (void)
void MusicTrack_SetLfoDelayFromCommand (void)
void MusicTrack_SetModulationFromCommand (void)
void MusicTrack_SetModulationTargetFromCommand (void)
void MusicTrack_SetTuneFromCommand (void)
void MusicTrack_WriteSoundRegisterFromCommand (void)
void MusicTrack_ReleaseKey (void)
void AudioEngine_SetPcmRate (void)
void MusicTrack_Stop (void)
void MusicPlayer_StepFade (void)
void MusicTrack_CalcOutput (void)
void SoundNote_Detach (void)
void SoundDriver_ClearBuffer (void)
void MusicTrack_ReadVoiceTarget (struct SoundPlayer *player, struct SoundTrack *track)
 Reads an unaligned little-endian voice target address from the sequence.
void MusicTrack_SetVoiceKind (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice kind from the sequence.
void MusicTrack_SetVoiceAttack (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice attack rate from the sequence.
void MusicTrack_SetVoiceDecay (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice decay rate from the sequence.
void MusicTrack_SetVoiceSustain (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice sustain level from the sequence.
void MusicTrack_SetVoiceRelease (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice release rate from the sequence.
void MusicTrack_SetTailLevel (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the note tail volume from the sequence.
void MusicTrack_SetTailLength (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the note tail duration from the sequence.
void MusicTrack_SetVoiceLength (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the hardware note length from the sequence.
void MusicTrack_SetVoicePanOrSweep (struct SoundPlayer *player, struct SoundTrack *track)
 Reads the voice pan or CGB sweep setting from the sequence.
void Runtime_CallWorkEntryWithArgs ()

Variables

const SoundFunc gSound_CommandTableTemplate []
 Sequence commands copied for each player, and driver entry points.
const u8 gSound_PcmPitchCodes []
 PCM pitches: the high four bits hold the octave, the low four the note.
const u32 gSound_PcmFrequencySteps []
 Frequencies by note at octave zero, in 32-bit fixed point.
const u16 gSound_FrameLengths []
 Samples per frame for each playback frequency setting.
const u8 gSound_CgbPitchCodes []
 CGB channel pitches.
const s16 gSound_CgbFrequencySteps []
 Frequencies by note for CGB channels.
const u8 gSound_NoisePitchCodes []
 Noise channel pitches.
const u8 gSound_Cgb3LevelCodes []
 CGB channel 3 waveform volumes.
const u8 gSound_ClockLengths []
 Note durations in clock ticks.
const SoundCommand gSound_ExtendedCommandTable []
 Extended commands; entries zero and three do nothing.

Typedef Documentation

◆ SoundFunc

typedef void(*) SoundFunc(void)

Definition at line 10 of file tables.c.

◆ SoundCommand

typedef void(*) SoundCommand(struct SoundPlayer *player, struct SoundTrack *track)

A command table entry: the driver calls it with the player and the track.

Definition at line 11 of file tables.c.

Function Documentation

◆ MusicTrack_FinishSequence()

void MusicTrack_FinishSequence ( void )

◆ MusicTrack_Goto()

void MusicTrack_Goto ( void )

Referenced by MusicTrack_Goto().

◆ MusicTrack_CallPattern()

void MusicTrack_CallPattern ( void )

Referenced by MusicTrack_CallPattern().

◆ MusicTrack_ReturnFromPattern()

void MusicTrack_ReturnFromPattern ( void )

◆ MusicTrack_Repeat()

void MusicTrack_Repeat ( void )

Referenced by MusicTrack_Repeat().

◆ MusicTrack_SetPriorityFromCommand()

void MusicTrack_SetPriorityFromCommand ( void )

◆ MusicPlayer_SetTempoFromCommand()

void MusicPlayer_SetTempoFromCommand ( void )

◆ MusicTrack_SetKeyOffsetFromCommand()

void MusicTrack_SetKeyOffsetFromCommand ( void )

◆ MusicTrack_SetVoiceFromCommand()

void MusicTrack_SetVoiceFromCommand ( void )

◆ MusicTrack_SetVolumeFromCommand()

void MusicTrack_SetVolumeFromCommand ( void )

◆ MusicTrack_SetPanFromCommand()

void MusicTrack_SetPanFromCommand ( void )

◆ MusicTrack_SetBendFromCommand()

void MusicTrack_SetBendFromCommand ( void )

◆ MusicTrack_SetBendRangeFromCommand()

void MusicTrack_SetBendRangeFromCommand ( void )

◆ MusicTrack_SetLfoSpeedFromCommand()

void MusicTrack_SetLfoSpeedFromCommand ( void )

◆ MusicTrack_SetLfoDelayFromCommand()

void MusicTrack_SetLfoDelayFromCommand ( void )

◆ MusicTrack_SetModulationFromCommand()

void MusicTrack_SetModulationFromCommand ( void )

◆ MusicTrack_SetModulationTargetFromCommand()

void MusicTrack_SetModulationTargetFromCommand ( void )

◆ MusicTrack_SetTuneFromCommand()

void MusicTrack_SetTuneFromCommand ( void )

◆ MusicTrack_WriteSoundRegisterFromCommand()

void MusicTrack_WriteSoundRegisterFromCommand ( void )

◆ MusicTrack_ReleaseKey()

void MusicTrack_ReleaseKey ( void )

◆ AudioEngine_SetPcmRate()

void AudioEngine_SetPcmRate ( void )

◆ MusicTrack_Stop()

void MusicTrack_Stop ( void )

◆ MusicPlayer_StepFade()

void MusicPlayer_StepFade ( void )

◆ MusicTrack_CalcOutput()

void MusicTrack_CalcOutput ( void )

◆ SoundNote_Detach()

void SoundNote_Detach ( void )

Referenced by SoundNote_Detach().

◆ SoundDriver_ClearBuffer()

void SoundDriver_ClearBuffer ( void )

Referenced by SoundDriver_ClearBuffer().

◆ MusicTrack_ReadVoiceTarget()

void MusicTrack_ReadVoiceTarget ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads an unaligned little-endian voice target address from the sequence.

Definition at line 1078 of file engine.c.

◆ MusicTrack_SetVoiceKind()

void MusicTrack_SetVoiceKind ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice kind from the sequence.

Definition at line 1092 of file engine.c.

Referenced by MusicTrack_SetVoiceKind(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoiceAttack()

void MusicTrack_SetVoiceAttack ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice attack rate from the sequence.

Definition at line 1099 of file engine.c.

Referenced by MusicTrack_SetVoiceAttack(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoiceDecay()

void MusicTrack_SetVoiceDecay ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice decay rate from the sequence.

Definition at line 1106 of file engine.c.

Referenced by MusicTrack_SetVoiceDecay(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoiceSustain()

void MusicTrack_SetVoiceSustain ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice sustain level from the sequence.

Definition at line 1113 of file engine.c.

Referenced by MusicTrack_SetVoiceSustain(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoiceRelease()

void MusicTrack_SetVoiceRelease ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice release rate from the sequence.

Definition at line 1120 of file engine.c.

Referenced by MusicTrack_SetVoiceRelease(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetTailLevel()

void MusicTrack_SetTailLevel ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the note tail volume from the sequence.

Definition at line 1127 of file engine.c.

Referenced by MusicTrack_SetTailLevel(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetTailLength()

void MusicTrack_SetTailLength ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the note tail duration from the sequence.

Definition at line 1134 of file engine.c.

Referenced by MusicTrack_SetTailLength(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoiceLength()

void MusicTrack_SetVoiceLength ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the hardware note length from the sequence.

Definition at line 1141 of file engine.c.

Referenced by MusicTrack_SetVoiceLength(), and SoundDriver_ClearBuffer().

◆ MusicTrack_SetVoicePanOrSweep()

void MusicTrack_SetVoicePanOrSweep ( struct SoundPlayer * player,
struct SoundTrack * track )

Reads the voice pan or CGB sweep setting from the sequence.

Definition at line 1148 of file engine.c.

Referenced by MusicTrack_SetVoicePanOrSweep(), and SoundDriver_ClearBuffer().

◆ Runtime_CallWorkEntryWithArgs()

void Runtime_CallWorkEntryWithArgs ( )

Variable Documentation

◆ gSound_CommandTableTemplate

const SoundFunc gSound_CommandTableTemplate[]

Sequence commands copied for each player, and driver entry points.

Definition at line 65 of file tables.c.

◆ gSound_PcmPitchCodes

const u8 gSound_PcmPitchCodes[]
Initial value:
= {
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b
}

PCM pitches: the high four bits hold the octave, the low four the note.

Definition at line 105 of file tables.c.

Referenced by Audio_UmulHigh32(), and Pcm_KeyToFrequency().

◆ gSound_PcmFrequencySteps

const u32 gSound_PcmFrequencySteps[]
Initial value:
= {
0x80000000, 0x879c7c97, 0x8facd61e, 0x9837f052,
0xa14517cc, 0xaadc0848, 0xb504f334, 0xbfc886bb,
0xcb2ff52a, 0xd744fccb, 0xe411f03a, 0xf1a1bf39
}

Frequencies by note at octave zero, in 32-bit fixed point.

Definition at line 124 of file tables.c.

Referenced by Audio_UmulHigh32(), and Pcm_KeyToFrequency().

◆ gSound_FrameLengths

const u16 gSound_FrameLengths[]
Initial value:
= {
96, 132, 176, 224, 264, 304, 352, 448, 528, 608, 672, 704
}

Samples per frame for each playback frequency setting.

Definition at line 131 of file tables.c.

Referenced by AudioEngine_SetPcmRate(), and MusicTrack_HandleNote().

◆ gSound_CgbPitchCodes

const u8 gSound_CgbPitchCodes[]
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab
}

CGB channel pitches.

Definition at line 136 of file tables.c.

Referenced by Cgb_KeyToFrequency(), and MusicTrack_Stop().

◆ gSound_CgbFrequencySteps

const s16 gSound_CgbFrequencySteps[]
Initial value:
= {
-2004, -1891, -1785, -1685, -1591, -1501, -1417, -1337, -1262, -1192, -1125, -1062
}

Frequencies by note for CGB channels.

Definition at line 151 of file tables.c.

Referenced by Cgb_KeyToFrequency(), and MusicTrack_Stop().

◆ gSound_NoisePitchCodes

const u8 gSound_NoisePitchCodes[]
Initial value:
= {
0xd7, 0xd6, 0xd5, 0xd4, 0xc7, 0xc6, 0xc5, 0xc4, 0xb7, 0xb6, 0xb5, 0xb4,
0xa7, 0xa6, 0xa5, 0xa4, 0x97, 0x96, 0x95, 0x94, 0x87, 0x86, 0x85, 0x84,
0x77, 0x76, 0x75, 0x74, 0x67, 0x66, 0x65, 0x64, 0x57, 0x56, 0x55, 0x54,
0x47, 0x46, 0x45, 0x44, 0x37, 0x36, 0x35, 0x34, 0x27, 0x26, 0x25, 0x24,
0x17, 0x16, 0x15, 0x14, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
}

Noise channel pitches.

Definition at line 156 of file tables.c.

Referenced by Cgb_KeyToFrequency(), and MusicTrack_Stop().

◆ gSound_Cgb3LevelCodes

const u8 gSound_Cgb3LevelCodes[]
Initial value:
= {
0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x20, 0x20
}

CGB channel 3 waveform volumes.

Definition at line 165 of file tables.c.

Referenced by Cgb_UpdateChannels(), and MusicTrack_Stop().

◆ gSound_ClockLengths

const u8 gSound_ClockLengths[]
Initial value:
= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 28, 30, 32, 36, 40, 42, 44,
48, 52, 54, 56, 60, 64, 66, 68, 72, 76, 78, 80, 84, 88, 90, 92,
96
}

Note durations in clock ticks.

Definition at line 170 of file tables.c.

◆ gSound_ExtendedCommandTable

const SoundCommand gSound_ExtendedCommandTable[]
Initial value:
= {
}
void MusicTrack_SetVoiceAttack(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice attack rate from the sequence.
Definition engine.c:1099
void MusicTrack_SetVoiceRelease(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice release rate from the sequence.
Definition engine.c:1120
void MusicTrack_SetVoiceDecay(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice decay rate from the sequence.
Definition engine.c:1106
void MusicTrack_SetVoiceLength(struct SoundPlayer *player, struct SoundTrack *track)
Reads the hardware note length from the sequence.
Definition engine.c:1141
void MusicTrack_SetTailLength(struct SoundPlayer *player, struct SoundTrack *track)
Reads the note tail duration from the sequence.
Definition engine.c:1134
void MusicTrack_SetVoiceSustain(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice sustain level from the sequence.
Definition engine.c:1113
void MusicTrack_SetVoiceKind(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice kind from the sequence.
Definition engine.c:1092
void MusicTrack_SetVoicePanOrSweep(struct SoundPlayer *player, struct SoundTrack *track)
Reads the voice pan or CGB sweep setting from the sequence.
Definition engine.c:1148
void MusicTrack_SetTailLevel(struct SoundPlayer *player, struct SoundTrack *track)
Reads the note tail volume from the sequence.
Definition engine.c:1127
void MusicTrack_ReadVoiceTarget(struct SoundPlayer *player, struct SoundTrack *track)
Reads an unaligned little-endian voice target address from the sequence.
Definition engine.c:1078
void Runtime_CallWorkEntryWithArgs(struct SoundPlayer *player, struct SoundTrack *track)
Finishes a track through the base command table entry.
Definition engine.c:1070
void(*) SoundCommand(struct SoundPlayer *player, struct SoundTrack *track)
A command table entry: the driver calls it with the player and the track.
Definition tables.c:11

Extended commands; entries zero and three do nothing.

Definition at line 178 of file tables.c.

Referenced by MusicTrack_DispatchStreamCommand(), and STATIC_ASSERT().