Playback Control API

Contents

Playback Control API#

FmodChannelControl#

Inherits: RefCounted

Base class for shared Channel and ChannelGroup controls

Description#

FmodChannelControl wraps the shared FMOD::ChannelControl features used by FmodChannel and FmodChannelGroup, including playback control, volume, 3D spatialization, pan and mix matrices, filtering, DSP chains, and sample-accurate scheduling.

This class is mainly used as a base class. Instances are usually obtained through FmodChannel or FmodChannelGroup.

Properties#

Type

Name

Default

Description

bool

pasued

false

Pause state. current name as pasued, as set_paused() / get_paused()

float

pitch

1.0

Relative pitch and playback speed.

float

volume_db

0.0

Volume in decibels.

bool

volume_ramp

false

Whether volume changes use a smooth ramp.

bool

mute

false

Mute state.

PackedVector3Array

3d_custom_rolloff

PackedVector3Array()

3D distance attenuation.

float

3d_doppler_level

1.0

Doppler effect.

float

3d_level

1.0

3D and 2D.

float

3d_min_distance

1.0

3D distance attenuation distance.

float

3d_max_distance

10000.0

3D distance attenuation distance.

float

3d_spread

0.0

3D sound in.

float

gain

1.0

/ distance filtering.

Signals#

Signals

Description

callback_received(type: int)

FMOD ChannelControl callback when, type as callback.

Methods#

Validity Check#

bool channel_control_is_valid() const#

Returns true if underlying FMOD::ChannelControl handle.

bool channel_control_is_null() const#

Returns true if the underlying FMOD::ChannelControl handle is null or unavailable.

Controls.#

bool is_playing() const#

Returns Channel or ChannelGroup current in.

void stop()#

Stop Channel, or stop in ChannelGroup Channel.

void set_paused(paused: bool)#

Sets pause state. true will pause, false will resume.

bool get_paused() const#

Returns current pause state.

void set_mode(mode: FmodMode)#

Sets FMOD playback mode flags for behavior such as looping, 2D/3D mode, and distance attenuation.

FmodMode get_mode() const#

Returns current mode flags.

void set_pitch(pitch: float)#

Sets pitch and playback speed. 1.0 as pitch, 2.0 as, 0.5 as.

float get_pitch() const#

Returns current pitch and playback speed.

Volume controls.#

float get_audibility() const#

Returns volume, mute, 3D attenuation and mixing after can.

void set_volume_db(volume: float)#

Sets volume, unit as.

float get_volume_db() const#

Returns current volume, unit as.

void set_volume_ramp(ramp: bool)#

Sets volume FMOD. after can volume when.

bool get_volume_ramp() const#

Returns volume.

void set_mute(mute: bool)#

Sets mute state.

bool get_mute() const#

Returns current mute state.

Spatialization.#

void set_3d_attributes(pos: Vector3, vel: Vector3)#

Sets the 3D position and velocity used for panning, distance attenuation, and Doppler calculation.

Dictionary get_3d_attributes() const#

Returns 3D, pos and vel.

void set_3d_cone_orientation(orientation: Vector3)#

Sets 3D sound direction, used for direction occlusion and attenuation.

Vector3 get_3d_cone_orientation() const#

Returns current 3D sound direction.

void set_3d_cone_settings(inside_cone_angle: float, outside_cone_angle: float, outside_volume_db: float)#

Sets direction 3D sound, and volume attenuation.

Dictionary get_3d_cone_settings() const#

Returns sets, inside_cone_angle, outside_cone_angle and outside_volume_db.

void set_3d_custom_rolloff(points: PackedVector3Array)#

Sets 3D distance attenuation. usually needs FMOD_MODE_3D_CUSTOMROLLOFF.

PackedVector3Array get_3d_custom_rolloff() const#

Returns current 3D distance attenuation.

void set_3d_distance_filter(custom: bool, custom_level: float, center_freq: float)#

Sets 3D distance filter, used for distance / filtering.

Dictionary get_3d_distance_filter() const#

Returns distance filter sets, custom, custom_level and center_freq.

void set_3d_doppler_level(level: float)#

Sets Doppler effect. used for Channel.

float get_3d_doppler_level() const#

Returns Doppler effect.

void set_3d_level(level: float)#

Sets 3D and 2D.

float get_3d_level() const#

Returns 3D and 2D.

void set_3d_min_distance(min: float)#

Sets 3D distance attenuation before distance.

float get_3d_min_distance() const#

Returns 3D distance attenuation distance.

void set_3d_max_distance(max: float)#

Sets 3D distance attenuation distance.

float get_3d_max_distance() const#

Returns 3D distance attenuation distance.

void set_3d_occlusion(direct_occlusion: float, reverb_occlusion: float)#

Sets and reverb path occlusion attenuation, range usually as 0.0 to 1.0.

Dictionary get_3d_occlusion() const#

Returns occlusion, direct_occlusion and reverb_occlusion.

void set_3d_spread(angle: float)#

Sets 3D sound in.

float get_3d_spread() const#

Returns 3D sound.

And.#

void set_pan(pan: float)#

Sets . -1.0 as, 0.0 as, 1.0 as.

void set_mix_levels_input(levels: PackedFloat32Array)#

As input input channel sets. used for Channel.

void set_mix_levels_output(front_left: float, front_right: float, center: float, lfe: float, surround_left: float, surround_right: float, back_left: float, back_right: float)#

As output sets volume.

void set_mix_matrix(matrix: PackedFloat32Array, outchannels: int, inchannels: int, inchannel_hop: int = 0)#

Sets input channel to output. matrix outchannels * inchannel_hop, inchannel_hop as 0 when inchannels.

See also

Mix matrix, mixing and mixing and Mix Matrix.

Dictionary get_mix_matrix() const#

Returns the current mix matrix information, including the matrix data, output channel count, input channel count, and input channel stride.

Filtering#

void set_reverb_properties(instance: int, wet: float)#

Sets the send level for the specified global reverb instance.

float get_reverb_properties(instance: int) const#

Returns the send level for the specified global reverb instance.

void set_low_pass_gain(gain: float)#

Sets / distance filtering when.

float get_low_pass_gain() const#

Returns / distance filtering when.

DSP.#

void add_dsp(index: int, dsp: FmodDSP)#

In DSP specified index DSP.

void remove_dsp(dsp: FmodDSP)#

DSP removes specified DSP.

int get_num_dsps() const#

Returns DSP DSP.

FmodDSP get_dsp(index: int) const#

Returns DSP specified index DSP.

void set_dsp_index(dsp: FmodDSP, index: int)#

Sets the index of the specified DSP unit in the DSP chain.

int get_dsp_index(dsp: FmodDSP) const#

Returns the index of the specified DSP unit in the DSP chain.

Sample-accurate Scheduling#

Dictionary get_dsp_clock() const#

Returns current DSP when, usually current when and when.

void set_delay(start: int, end: int, stopchannels: bool = true)#

Sets for ChannelGroup DSP when and stop when.

Dictionary get_delay() const#

Returns the sample-accurate delay settings, including the start clock, end clock, and stop behavior.

void add_fade_point(dspclock: int, volume: float)#

In specified DSP when adds volume.

void set_fade_point_ramp(dspclock: int, volume: float)#

Adds current volume to specified DSP when volume.

void remove_fade_points(start: int, end: int)#

Removes DSP when.

Dictionary get_fade_points() const#

Returns current.

Callback.#

void set_callback()#

Sets ChannelControl FMOD callback, and through callback_received Godot.

void clear_callback()#

ChannelControl callback.

FmodChannel#

: FmodChannelControl

channel controls object.

Description#

FmodChannel represents one real or virtual sound playback instance in FMOD. It inherits the common controls from FmodChannelControl and adds access to playback frequency, priority, playback position, loop points, the owning ChannelGroup, the current sound, and the channel index.

Methods#

Validity Check#

bool channel_is_valid() const#

Returns true if underlying FMOD::Channel handle.

bool channel_is_null() const#

Returns true if the underlying FMOD::Channel handle is null or unavailable.

Parameter.#

void set_frequency(frequency: float)#

Sets unit as. will velocity and pitch.

float get_frequency() const#

Returns current, unit as.

void set_priority(priority: int)#

Sets .

int get_priority() const#

Returns current.

void set_position(position: int, timeunit: FmodTimeUnit = FMOD_TIME_UNIT_MS)#

Sets current playback position. default when unit.

int get_position(timeunit: FmodTimeUnit = FMOD_TIME_UNIT_MS) const#

Returns current playback position. default when unit.

void set_channel_group(channel_group: FmodChannelGroup)#

Sets Channel output to ChannelGroup.

FmodChannelGroup get_channel_group() const#

Returns Channel current output to ChannelGroup.

void set_loop_count(loop_count: int)#

Sets stop before loop. -1 usually represents loop.

int get_loop_count() const#

Returns stop before loop.

void set_loop_points(start: int, end: int, timeunit: FmodTimeUnit = FMOD_TIME_UNIT_MS)#

Sets loop and.

Dictionary get_loop_points(timeunit: FmodTimeUnit = FMOD_TIME_UNIT_MS) const#

Returns loop, start and end.

State and Information#

bool is_virtual() const#

Returns Channel current FMOD.

FmodSound get_current_sound() const#

Returns Channel current sound.

int get_index() const#

Returns Channel in FMOD channel index.

FmodChannelGroup#

: FmodChannelControl

Channel group for organizing and mixing multiple Channels.

Description#

FmodChannelGroup represents an FMOD ChannelGroup that can act as the input target for multiple Channels or child ChannelGroups. It inherits common playback, volume, DSP, and scheduling controls, making it suitable for grouped mixing, bus-style control, and stopping groups of sounds.

Methods#

Validity Check#

bool channel_group_is_valid() const#

Returns true if underlying FMOD::ChannelGroup handle.

bool channel_group_is_null() const#

Returns true if the underlying FMOD::ChannelGroup handle is null or unavailable.

Channel manages.#

int get_num_channels() const#

Returns Channel.

FmodChannel get_channel(index: int) const#

Returns the Channel at the specified index.

ChannelGroup manages.#

void add_group(channel_group: FmodChannelGroup, propagatedspclock: bool = true)#

ChannelGroup adds as current input. propagatedspclock controls DSP when.

int get_num_groups() const#

Returns ChannelGroup.

FmodChannelGroup get_group(index: int) const#

Returns input specified index ChannelGroup.

FmodChannelGroup get_parent_group() const#

Returns current ChannelGroup output to ChannelGroup.

Overview#

String get_name() const#

Returns creates ChannelGroup when name.

void release()#

Releases ChannelGroup. releases after underlying handle.

FmodSoundGroup#

Inherits: RefCounted

used for and manages FmodSound as object.

Description#

FmodSoundGroup wraps FMOD::SoundGroup and lets a group of sounds share a maximum audible count, overflow behavior, mute fade speed, and overall volume.

Properties#

Type

Name

Default

Description

int

max_audible

-1

Maximum number of simultaneously audible playbacks.

Behavior

max_audible_behavior

BEHAVIOR_FAIL

Can when.

float

mute_fade_speed

0.0

Mute velocity.

float

volume_db

0.0

SoundGroup volume, unit as.

Methods#

Validity Check#

bool sound_group_is_valid() const#

Returns true if underlying FMOD::SoundGroup handle.

bool sound_group_is_null() const#

Returns true if the underlying FMOD::SoundGroup handle is null or unavailable.

Basic Features#

void set_max_audible(max_audible: int)#

Sets the maximum number of playbacks that can be audible at the same time in the SoundGroup.

int get_max_audible() const#

Returns the maximum number of playbacks that can be audible at the same time in the SoundGroup.

void set_max_audible_behavior(behavior: Behavior)#

Sets the behavior used when the maximum audible count is exceeded.

Behavior get_max_audible_behavior() const#

Returns the behavior used when the maximum audible count is exceeded.

void set_mute_fade_speed(speed: float)#

Sets the fade speed used when muting or restoring sounds because of the maximum audible count limit.

float get_mute_fade_speed() const#

Returns mute velocity.

void set_volume_db(volume_db: float)#

Sets SoundGroup volume, unit as.

float get_volume_db() const#

Returns SoundGroup volume, unit as.

Effect Features#

int get_num_sounds() const#

Returns SoundGroup FmodSound.

FmodSound get_sound(index: int) const#

Returns SoundGroup specified index FmodSound.

int get_num_playing() const#

Returns SoundGroup current in Channel.

void stop()#

Stop SoundGroup in sound.

Overview#

String get_name() const#

Returns SoundGroup name.

void release()#

Releases SoundGroup, and sound returns SoundGroup.

Enumerations#

Behavior#

Member

Value

Description

BEHAVIOR_FAIL

0

Playback fails when the playback API is called and the maximum audible count is exceeded.

BEHAVIOR_MUTE

1

Sound mute, to sound stop after can.

BEHAVIOR_STEAL_LOWEST

2

When current sound.

BEHAVIOR_MAX

3

Number of behavior enum values.