OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
Sound Effects

Functions

u8 snesmodLoadEffect (u16 sfxIndex)
 Load a sound effect from the soundbank.
u8 snesmodPlayEffect (u16 effectId, u8 volume, u8 pan, u16 pitch)
 Play a sound effect.

Detailed Description

Function Documentation

◆ snesmodLoadEffect()

u8 snesmodLoadEffect ( u16 sfxIndex)

Load a sound effect from the soundbank.

Loads a single source/sample for use as a sound effect.

Parameters
sfxIndexSource index in the soundbank
Returns
Effect slot ID for use with snesmodPlayEffect

◆ snesmodPlayEffect()

u8 snesmodPlayEffect ( u16 effectId,
u8 volume,
u8 pan,
u16 pitch )

Play a sound effect.

Triggers a sound effect, potentially interrupting module playback on one channel temporarily.

Parameters
effectIdEffect slot ID (from snesmodLoadEffect or soundbank.h)
volumeVolume level (0-127)
panPan position (0=left, 128=center, 255=right)
pitchPitch value ($1000 = normal, $2000 = octave up)
Returns
Channel used for effect
// Play jump sound at full volume, center pan, normal pitch
snesmodPlayEffect(SFX_JUMP, 127, 128, 0x1000);
// Play with higher pitch
snesmodPlayEffect(SFX_JUMP, 127, 128, 0x1800);
u8 snesmodPlayEffect(u16 effectId, u8 volume, u8 pan, u16 pitch)
Play a sound effect.