W3cubDocs

/Godot 2.1

EventPlayer

Inherits: Node < Object

Category: Core

Brief Description

Class for event stream playback.

Member Functions

float get_channel_last_note_time ( int channel ) const
float get_channel_volume ( int channel ) const
float get_length ( ) const
int get_loop_count ( ) const
float get_pitch_scale ( ) const
float get_pos ( ) const
EventStream get_stream ( ) const
String get_stream_name ( ) const
float get_tempo_scale ( ) const
float get_volume ( ) const
float get_volume_db ( ) const
bool has_autoplay ( ) const
bool has_loop ( ) const
bool is_paused ( ) const
bool is_playing ( ) const
void play ( )
void seek_pos ( float time )
void set_autoplay ( bool enabled )
void set_channel_volume ( int channel, float channel_volume )
void set_loop ( bool enabled )
void set_paused ( bool paused )
void set_pitch_scale ( float pitch_scale )
void set_stream ( EventStream stream )
void set_tempo_scale ( float tempo_scale )
void set_volume ( float volume )
void set_volume_db ( float db )
void stop ( )

Description

Class for event stream playback. Event streams are music expressed as a series of events (note on, note off, instrument change...), as opposed to audio streams, which are just audio data. Examples of event-based streams are MIDI files, or MOD music.

Currently, only MOD, S3M, IT, and XM music is supported.

Member Function Description

float get_channel_last_note_time ( int channel ) const

Return the time at which the last note of a given channel in the stream plays.

float get_channel_volume ( int channel ) const

Return the volume scale for an individual channel of the stream.

float get_length ( ) const

Return the song length. May be in seconds, but depends on the stream type.

int get_loop_count ( ) const

Return the number of times the playback has looped.

float get_pitch_scale ( ) const

Return the pitch scale factor for this player.

float get_pos ( ) const

Return the playback position. May be in seconds, but depends on the stream type.

EventStream get_stream ( ) const

Return the currently assigned stream.

String get_stream_name ( ) const

Return the name of the currently assigned stream. This is not the file name, but a field inside the file. If no stream is assigned, if returns “<No Stream>”.

float get_tempo_scale ( ) const

Return the tempo multiplier.

float get_volume ( ) const

Return the playback volume for this player.

float get_volume_db ( ) const

Return the playback volume for this player, in decibels.

bool has_autoplay ( ) const

Return whether this player will start playing as soon as it enters the scene tree.

bool has_loop ( ) const

Return whether this player will be restart the playback at the end.

bool is_paused ( ) const

Return whether the playback is currently paused.

bool is_playing ( ) const

Return whether this player is playing.

void play ( )

Play the currently assigned stream.

void seek_pos ( float time )

Set the playback position. May be in seconds, but depends on the stream type.

void set_autoplay ( bool enabled )

Set whether this player will start playing as soon as it enters the scene tree.

void set_channel_volume ( int channel, float channel_volume )

Set the volume scale for an individual channel of the stream, with the same value range as set_volume. The channel number depends on the stream format. For example, MIDIs range from 0 to 15, and MODs from 0 to 63.

Many stream formats are multichannel, so this allows to affect only a part of the music.

void set_loop ( bool enabled )

Set whether the stream will be restarted at the end.

void set_paused ( bool paused )

Pause stream playback.

void set_pitch_scale ( float pitch_scale )

Set the pitch multiplier for all sounds coming from this stream. A value of 2.0 shifts all pitches one octave up, and a value of 0.5 shifts pitches one octave down.

void set_stream ( EventStream stream )

Set the EventStream this player will play.

void set_tempo_scale ( float tempo_scale )

Set the tempo multiplier. This allows to slow down or speed up the music, without affecting its pitch.

void set_volume ( float volume )

Set the playback volume for this player. This is a float between 0.0 (silent) and 1.0 (full volume). Values over 1.0 may amplify sound even more, but may introduce distortion. Negative values may just invert the output waveform, which produces no audible difference.

The effect of these special values ultimately depends on the low-level implementation of the file format being played.

void set_volume_db ( float db )

Set the playback volume for this player, in decibels. This is a float between -80.0 (silent) and 0.0 (full volume). Values under -79.0 get truncated to -80, but values over 0.0 do not, so the warnings for over amplifying (see set_volume) still apply.

void stop ( )

Stop playing.

© 2014–2017 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/2.1/classes/class_eventplayer.html