sndgrp interface - Outerra/anteworld GitHub Wiki
From vehicle_script, aircraft_script or charob_script
this.snd = this.sound();
From vehicle_script, aircraft_script or charob_script
self.snd = self:sound()
void attach_to_geom_inst(const pkg::geomob* obj); |
||
Parameter Description | Returns | Description |
---|---|---|
obj: geometric object to attach to | Attaches to object's geometric instance. | |
void attach_to_geom_inst(entity_handle entity); |
||
Parameter Description | Returns | Description |
entity: entity handle to attach to | Attaches to entity's geometric instance. | |
uint load_sound(const coid::token& filename); |
||
Parameter Description | Returns | Description |
filename: relative path to the sound file | sound ID | Loads a sound file from the object or package directory. For independent sound groups, the filename refers to a path in the data or program directory. |
uint create_source(uint bone, ot::sound_type type = ot::sound_type::universal, float ref_distance = 0); |
||
Parameter Description | Returns | Description |
bone: bone ID type: sound type (default: universal) ref_distance: reference distance for attenuation (default: 0) |
source ID | Creates a sound source associated with a specific bone. |
uint create_source_wo_bone(ot::sound_type type = ot::sound_type::universal); |
||
Parameter Description | Returns | Description |
type: sound type (default: universal) |
source ID | Creates a sound source. |
void set_source_ecef(uint source_id, const double3& pos); |
||
Parameter Description | Returns | Description |
source_id: ID of the source pos: position in ECEF coordinates |
Sets the position of the source in ECEF coordinates. Once used, the source always relies on ECEF positioning. | |
void set_source_class(uint sourceid, ot::sound_class sndclass); |
||
Parameter Description | Returns | Description |
source_id: ID of the source sndclass: sound class |
Sets source type. | |
void play(uint sourceid, uint snd, bool looping, bool enqueue, bool break_prev_loops = true); |
||
Parameter Description | Returns | Description |
sourceid: ID of the source snd: sound ID looping: whether the sound should loop enqueue: whether the sound should be enqueued and wait until the previous one ends break_prev_loops: removes existing loops if true, otherwise the new sound is added to the loop chain (default: true) |
Plays sound. | |
void play_sound(uint id, uint snd); |
||
Parameter Description | Returns | Description |
id: ID of the sound source snd: ID of the sound to play |
Plays the sound once, discarding any previously playing sounds. | |
void play_loop(uint id, uint snd); |
||
Parameter Description | Returns | Description |
id: ID of the sound source snd: ID of the sound to play |
Plays the sound in a loop, breaking any previously playing sounds. | |
void enqueue_sound(uint id, uint snd); |
||
Parameter Description | Returns | Description |
id: ID of the sound source snd: ID of the sound to enqueue |
Enqueues the sound to be played once previous loops are finished and then discarded. | |
void enqueue_loop(uint id, uint snd, bool break_prev_loops = true); |
||
Parameter Description | Returns | Description |
id: ID of the sound source snd: ID of the sound to enqueue break_prev_loops: if true, breaks any existing loops (default: true) |
Enqueues the sound to play in a loop. If break_prev_loops is true, it removes any existing loops, otherwise the new sound is added to the loop chain. | |
bool is_playing(uint id); |
||
Parameter Description | Returns | Description |
id: ID of the sound source | True if sound is playing, false otherwise | Checks if the specified sound source is currently playing. |
bool is_looping(uint id); |
||
Parameter Description | Returns | Description |
id: ID of the sound source | True if sound is looping, false otherwise | Checks if the specified sound source is currently looping. |
void stop(uint id); |
||
Parameter Description | Returns | Description |
id: ID of the source | Stops sounds on the specified sound source. | |
void set_pitch(uint id, float pitch); |
||
Parameter Description | Returns | Description |
id: ID of the sound source pitch: pitch value to set for the sound |
Sets the pitch of the sound source. | |
void set_ref_distance(uint id, float ref_dist); |
||
Parameter Description | Returns | Description |
id: ID of the sound source ref_dist: reference distance for sound attenuation |
Sets the reference distance. Open AL distance attenuation model https://www.desmos.com/calculator/f20nyvlupa |
|
void set_gain(uint id, float gain); |
||
Parameter Description | Returns | Description |
id: ID of the source gain: gain (volume) level |
Sets the gain (volume) for the specified sound source. | |