+
Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

SoundEffect

rankaisija edited this page Aug 27, 2023 · 3 revisions

Usage

Add your custom sample (wav/aiff/mp3) inside src/sound/sfx/SampleName/*

Utilize generated enum for the samples from src/lib_user/sfx_enum.h. This is included by default through uLib.h, remember to have #include <uLib.h> in your actor to use these. Alternatively you can also use #include <sfx_enum.h>

Functions to use with these are the following:

#define DEFAULT_REVERB 0.1f
#define DEFAULT_RANGE 1000.0f

void SoundEffect_PlayOneshot(SoundFile id, f32 vol, f32 pitch, Vec3f* pos, f32 reverb, f32 range, void* origin);
void SoundEffect_PlayHeld(SoundFile id, f32 vol, f32 pitch, f32 stepRelease, Vec3f* pos, f32 reverb, f32 range, void* origin);

SoundEffect_PlayOneshot

  • sound: The sound ID
  • vol: Volume.
    • Default value: 1.0f
    • Range: 0.0f - 1.0f
  • pitch:
    • Default value: 1.0f
    • Range: 0.0f - 4.0f
  • pos: Pointer to a position. If NULL, sound will be played centered.
  • reverb: Bigger value makes reverb louder.
    • Default value: 0.1f
    • Range: 0.0f - 1.0f
  • range: Sound range. Default value: 1000.0f
  • origin: Pointer to the origin of caller. For actors, use the instance, this. Always aim to have this pointing to something.

SoundEffect_PlayHeld

  • sound: The sound ID
  • vol: Not recommended adjusting on the fly
    • Default value: 1.0f
    • Range: 0.0f - 4.0f
  • pitch: Can be adjusted on the fly
    • Default value: 1.0f
    • Range: 0.0f - 4.0f
  • stepRelease: How fast it releases. 1.0f is the fastest, lower value gives slower release.
  • pos: pointer to a position. If NULL, sound will be played centered.
  • reverb: Bigger value makes reverb louder.
    • Default value: 0.1f
    • Range: 0.0f - 1.0f
  • range: Sound range. Default value: 1000.0f
  • origin: Pointer to the origin of caller. For actors, use the instance, this. Always aim to have this pointing to something.

If Sound does not have pos, it will use reverb as the reverb volume. Range does nothing with pos being null.

Clone this wiki locally
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载