Skip to content

Sound Source

Mike-MF edited this page Jun 18, 2024 · 1 revision

This page will explain the usage of the Sound Source function.


/*
 * Author: Mike
 * Plays a looping sound via createSoundSource with optional automatic deletion.
 * Supports custom sounds for loop created through Description.ext
 * If deletion time is greater than 0 it will automatically delete it after the delay specified.
 *
 * Call on the server only.
 *
 * Arguments
 * 0: Object <OBJECT>
 * 1: Sound <STRING>
 * 2: Time until deletion <NUMBER> (default: 0)
 *
 * Return Value:
 * Sound Source <OBJECT>
 *
 * Example:
 * [Loudspeaker, "Sound_Alarm", 30] call MFUNC(soundSource)
 * GVAR(myLoudSpeakerSound) = [Loudspeaker, "Sound_Alarm"] call MFUNC(soundSource)
*/

Usage

This function creates a looping sound with optional automatic deletion. It can be used for Alarms, firefight effects or any custom made sound. The return from this function is the sound source itself which must be used to delete the sound when you no longer require it.

Call on the server only

Example:

GVAR(myLoopingSound) = [My_Speaker_Object, "Sound_Alarm"] call MFUNC(soundSource);

Example with auto deletion:

[My_Speaker_Object, "Sound_Alarm", 300] call MFUNC(soundSource);
Clone this wiki locally