Audio#

Contains functions related to sfx and music.

Access with Audio->.

Variables#

int

PanStyle

const int

MIDI

const int

NumMusics

const bool

EngineMusicActive

int[]

Volume deprecated

int

MusicRefresh

bool[]

MusicRefreshFlags

Functions#

void

PlaySound(int sfx)

void

EndSound(int sfx)

void

PauseSound(int sfx)

void

ResumeSound(int sfx)

void

ContinueSound(int sfx)

void

AdjustMusicVolume(int percent)

void

AdjustSFXVolume(int percent)

void

PauseCurMIDI()

void

ResumeCurMIDI()

void

PlayMusic(int music_index)

musicdata

LoadMusicData(int music_index)

void

PlayMIDI(int midi)

bool

PlayEnhancedMusic(char32[] filename, int track = 0)

void

AdjustSound(int id, int volume, int pan = 0, long freq = -1L, bool loop_sfx = false)

bool

PlayOgg(char32[] filename, int track = 0) deprecated

int

GetMusicPos()

void

SetMusicPos(int pos)

void

SetMusicSpeed(int speed)

int

GetMusicLength()

void

SetMusicLoop(int start, int end)

void

PlaySoundEx(int id, int volume, int pan = 0, long freq = -1L, bool loop_sfx = false)

int

GetSoundCompletion(int sfx)

bool

CrossfadeEnhancedMusic(char32[] filename, int track, int fadeoutframes, int fadeinframes, int delayframes = 0, int startpos = 0)

Enumerations#

enum SoundEffect: ๐Ÿ”— Source

Sound effect IDs. Used with Audio->PlaySound().

SoundEffect SFX_ARROW = 1

Arrow is fired.

SoundEffect SFX_BEAM = 2

Sword beam is fired.

SoundEffect SFX_BOMB = 3

Bomb explodes.

SoundEffect SFX_BRANG = 4

Boomerang spinning.

SoundEffect SFX_CHARGE1 = 35

Sword powering up.

SoundEffect SFX_CHARGE2 = 36

Sword powering up again (Hurricane Spin).

SoundEffect SFX_CURSOR = 5

Subscreen cursor.

Shield is hit.

SoundEffect SFX_CLEARED = 7

Chime when screen item appears.

SoundEffect SFX_DINSFIRE = 37

Dinโ€™s Fire blast.

SoundEffect SFX_DODONGO = 8

Dodongoโ€™s roar.

SoundEffect SFX_SHUTTER = 9

Shutter bang.

SoundEffect SFX_EDEAD = 10

Enemy is killed.

SoundEffect SFX_EHIT = 11

Enemy is hit.

SoundEffect SFX_LOWHP = 12

Low hearts warning beep.

SoundEffect SFX_FALL = 38

Enemy falls from ceiling (unused).

SoundEffect SFX_FARORESWIND = 39

Faroreโ€™s Wind spell.

SoundEffect SFX_FIRE = 13

Flame roar.

SoundEffect SFX_FIREBALL = 40

Enemy fireball.

SoundEffect SFX_GANON = 14

Music when Ganon appears/dies.

SoundEffect SFX_GASP = 15

Boss is hit.

SoundEffect SFX_GRASSCUT = 41

Grass or bush slashed.

SoundEffect SFX_HAMMER = 16

Hammer pound.

SoundEffect SFX_HAMMERPOST = 42

Pounded a post.

SoundEffect SFX_HOOKSHOT = 17

Hookshot chain rattle.

SoundEffect SFX_HOVER = 43

Hover boots.

SoundEffect SFX_ICE = 44

Unused.

SoundEffect SFX_JUMP = 45

Jumping.

SoundEffect SFX_LENSOFF = 46

Lens of Truth off.

SoundEffect SFX_LENSON = 47

Lens of Truth on.

SoundEffect SFX_MSG = 18

Message typing.

SoundEffect SFX_NAYRUSLOVE1 = 48

Nayruโ€™s Love shield hum.

SoundEffect SFX_NAYRUSLOVE2 = 49

Nayruโ€™s Love shield running out.

SoundEffect SFX_OUCH = 19

Link is hit.

SoundEffect SFX_PICKUP = 20

Chime when item is held above head.

SoundEffect SFX_PLACE = 21

Bomb is placed.

Heart/Rupee is collected.

SoundEffect SFX_PUSHBLOCK = 50

Pushed a block.

SoundEffect SFX_REFILL = 23

Hearts being refilled.

SoundEffect SFX_ROAR = 24

Aquamentus, Gleeok and Ganonโ€™s roar.

SoundEffect SFX_ROCK = 51

Octorok rock is fired.

SoundEffect SFX_ROCKETDOWN = 52

Spell rocket descends.

SoundEffect SFX_ROCKETUP = 53

Spell rocket launched.

SoundEffect SFX_SCALE = 25

Chime when fairy appears/is picked up.

SoundEffect SFX_SEA = 26

โ€œOcean SFXโ€ ambience.

SoundEffect SFX_SECRET = 27

Chime when secret is discovered.

SoundEffect SFX_SPINATTACK = 54

Sword spin.

SoundEffect SFX_SPIRAL = 28

Link dies.

SoundEffect SFX_SPLASH = 55

Splashing in shallow water.

SoundEffect SFX_STAIRS = 29

Link marches down stairs.

SoundEffect SFX_SUMMON = 56

Summoner magic.

SoundEffect SFX_SWORD = 30

Sword swipe.

SoundEffect SFX_TAP1 = 57

Sword taps wall.

SoundEffect SFX_TAP2 = 58

Sword taps bombable wall.

SoundEffect SFX_PATRA = 31

Patra and Manhandlaโ€™s shriek.

SoundEffect SFX_WAND = 32

Magic is fired by Wizzrobes or Link.

SoundEffect SFX_WHIRLWIND = 59

Whistle whirlwind.

SoundEffect SFX_WHISTLE = 33

Whistle is played.

SoundEffect SFX_ZELDA = 34

Music when ending sequence begins.


enum VolumeIndex: ๐Ÿ”— Source

Used with Audio->Volume[].

VolumeIndex VOL_MIDI = 0

VolumeIndex VOL_DIGI = 1

VolumeIndex VOL_MUSIC = 2

VolumeIndex VOL_SFX = 3


enum MusicRefreshMode: ๐Ÿ”— Source

Used with Audio->MusicRefresh.

MusicRefreshMode MR_SCREEN = 0

Refresh on every screen transition.

MusicRefreshMode MR_DMAP = 1

Refresh when the dmap changes.

MusicRefreshMode MR_LEVEL = 2

Refresh when the level changes.

MusicRefreshMode MR_NEVER = 3

Never refresh on a screen transition.

MusicRefreshMode MR_REGION = 4

Refresh when the region changes


enum MusicRefreshFlag: ๐Ÿ”— Source

Used with Audio->MusicRefreshFlags[].

MusicRefreshFlag MRF_NOCUT = 0

MusicRefreshFlag MRF_REVERT = 1


Variable descriptions#

int PanStyle ๐Ÿ”— Source

value Undocumented - see https://github.com/ZQuestClassic/ZQuestClassic/blob/5b2e5ccb2ee020ed0a72a0cce69e3b3ed81811eb/src/zc/zc_sys.cpp#L8393C9-L8393C13

The audio panning style.


const int MIDI ๐Ÿ”— Source


const int NumMusics ๐Ÿ”— Source

Returns the number of :ref:`musicdata<classes_musicdata>`s that exist in the quest.


const bool EngineMusicActive ๐Ÿ”— Source

Returns true if the โ€˜engine musicโ€™ is active. (โ€˜engine musicโ€™ means the music set for the current screen, or current dmap if the screen has MUSIC_INHERIT set)

If true, changing Screen->Music or mapdata::Music for the screen the player is on, or changing dmapdata::Music for the current dmap if the current screenโ€™s music is MUSIC_INHERIT, will result in the currently playing music changing to match.


int[] Volume ๐Ÿ”— Source

Deprecated: Use AdjustMusicVolume() or AdjustSFXVolume() instead.


int MusicRefresh ๐Ÿ”— Source

value MusicRefreshMode (MR_)

Controls how often the engine refreshes the currently playing music while changing screens.


bool[] MusicRefreshFlags ๐Ÿ”— Source

index MusicRefreshFlag (MRF_)

Flags for handling extra effects on MusicRefresh.


Function descriptions#

void PlaySound(int sfx) ๐Ÿ”— Source

Plays the quest SFX sfx.


void EndSound(int sfx) ๐Ÿ”— Source

If sfx is playing, immediately stop it.


void PauseSound(int sfx) ๐Ÿ”— Source

If sfx is playing, pause it (so that it may be resumed later).


void ResumeSound(int sfx) ๐Ÿ”— Source

Resume sfx from where it was paused.


void ContinueSound(int sfx) ๐Ÿ”— Source

Resume sfx from where it was paused.


void AdjustMusicVolume(int percent) ๐Ÿ”— Source

Adjusts a multiplier for the volume of all MIDI, DIGI, and Enhanced Music.


void AdjustSFXVolume(int percent) ๐Ÿ”— Source

Adjusts a multiplier for the volume of all Sound Effects (WAV).


void PauseCurMIDI() ๐Ÿ”— Source

Pauses the currently playing MIDI so that it may be resumed later.


void ResumeCurMIDI() ๐Ÿ”— Source

Resumes the previously paused MIDI.


void PlayMusic(int music_index) ๐Ÿ”— Source

Plays the Music music_index. See MusicRefresh for details on when the engine will change the music back. Index 0 will stop currently playing music. Index -1 will play the music of the current screen/dmap, as the engine would. Otherwise, the index should be > 0 and <= NumMusics.


musicdata LoadMusicData(int music_index) ๐Ÿ”— Source

Loads a musicdata ref for the music ID music_index. Returns MUSIC_SILENCE without error for ID 0. Fails (returning MUSIC_SILENCE, with error) if the ID is < 0 or > NumMusics


void PlayMIDI(int midi) ๐Ÿ”— Source

Plays the MIDI midi. See MusicRefresh for details on when the engine will change the music back.


bool PlayEnhancedMusic(char32[] filename, int track = 0) ๐Ÿ”— Source

Play the specified enhanced music if available. If the music cannot be played, the current music will continue. Reverts to normal upon leaving the screen.

Returns true if the music file was loaded successfully.

filename cannot be more than 255 characters.

If the music format does not support multiple tracks, track is ignored.


void AdjustSound(int id, int volume, int pan = 0, long freq = -1L, bool loop_sfx = false) ๐Ÿ”— Source

Change properties on a currently playing sound.


bool PlayOgg(char32[] filename, int track = 0) ๐Ÿ”— Source

Deprecated: Use PlayEnhancedMusic() instead!


int GetMusicPos() ๐Ÿ”— Source

Returns the current seek position of the currently playing enhanced music in seconds.

CURRENTLY ONLY SUPPORTS MP3 / OGG / IT / XM / S3M / MOD


void SetMusicPos(int pos) ๐Ÿ”— Source

Sets the position for the currently playing enhanced music, in seconds.

CURRENTLY ONLY SUPPORTS MP3 / OGG / IT / XM / S3M / MOD


void SetMusicSpeed(int speed) ๐Ÿ”— Source

Sets the playback speed of the currently playing enhanced music.

CURRENTLY ONLY SUPPORTS MP3 / OGG / IT / XM / S3M / MOD


int GetMusicLength() ๐Ÿ”— Source

Returns the length of the current playing enhanced music in seconds.

CURRENTLY ONLY SUPPORTS MP3 / OGG / IT / XM / S3M / MOD


void SetMusicLoop(int start, int end) ๐Ÿ”— Source

Loops the currently playing enhanced music between two timestamps in seconds.

CURRENTLY ONLY SUPPORTS MP3 / OGG / IT / XM / S3M / MOD


void PlaySoundEx(int id, int volume, int pan = 0, long freq = -1L, bool loop_sfx = false) ๐Ÿ”— Source

Plays the quest SFX sfx but with different properties.


int GetSoundCompletion(int sfx) ๐Ÿ”— Source

Returns a rough completion percentage (0-100) for how much of a sound has played.


bool CrossfadeEnhancedMusic(char32[] filename, int track, int fadeoutframes, int fadeinframes, int delayframes = 0, int startpos = 0) ๐Ÿ”— Source

Crossfade to the specified enhanced music if available. If the music cannot be played, the current music will continue.

Reverts to normal upon leaving the screen.

Returns true if loaded successfully.

filename cannot be more than 255 characters.

Currently only supports MP3 / OGG / IT / XM / S3M / MOD.