.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_SamplePlayer: SamplePlayer ============ **Inherits:** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Sample Player node. Member Functions ---------------- +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_chorus` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_chorus` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_filter_cutoff` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_filter_gain` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_filter_resonance` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_default_filter_type` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_pan` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_pan_depth` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_pan_height` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_pitch_scale` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_reverb` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_default_reverb_room` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_volume` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_volume_db` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_filter_cutoff` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_filter_gain` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_filter_resonance` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_filter_type` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_mix_rate` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_pan` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_pan_depth` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_pan_height` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_pitch_scale` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_polyphony` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_reverb` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_reverb_room` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SampleLibrary` | :ref:`get_sample_library` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_volume` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_volume_db` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_active` **(** **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_voice_active` **(** :ref:`int` voice **)** const | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`play` **(** :ref:`String` name, :ref:`bool` unique=false **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_chorus` **(** :ref:`int` voice, :ref:`float` send **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_chorus` **(** :ref:`float` send **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_filter` **(** :ref:`int` type, :ref:`float` cutoff_hz, :ref:`float` resonance, :ref:`float` gain=0 **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_pan` **(** :ref:`float` pan, :ref:`float` depth=0, :ref:`float` height=0 **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_pitch_scale` **(** :ref:`float` ratio **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_reverb` **(** :ref:`int` room_type, :ref:`float` send **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_volume` **(** :ref:`float` volume **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_volume_db` **(** :ref:`float` db **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_filter` **(** :ref:`int` voice, :ref:`int` type, :ref:`float` cutoff_hz, :ref:`float` resonance, :ref:`float` gain=0 **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_mix_rate` **(** :ref:`int` voice, :ref:`int` hz **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_pan` **(** :ref:`int` voice, :ref:`float` pan, :ref:`float` depth=0, :ref:`float` height=0 **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_pitch_scale` **(** :ref:`int` voice, :ref:`float` ratio **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_polyphony` **(** :ref:`int` max_voices **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_reverb` **(** :ref:`int` voice, :ref:`int` room_type, :ref:`float` send **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_sample_library` **(** :ref:`SampleLibrary` library **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_volume` **(** :ref:`int` voice, :ref:`float` volume **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_volume_db` **(** :ref:`int` voice, :ref:`float` db **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop` **(** :ref:`int` voice **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop_all` **(** **)** | +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Numeric Constants ----------------- - **FILTER_NONE** = **0** --- Filter is disabled for voice. - **FILTER_LOWPASS** = **1** --- Low-pass filter is used for voice. - **FILTER_BANDPASS** = **2** --- Band-pass filter is used for voice. - **FILTER_HIPASS** = **3** --- High-pass filter is used for voice. - **FILTER_NOTCH** = **4** --- Notch (band reject) filter is used for voice. - **FILTER_PEAK** = **5** --- Peak (exclusive band) filter is used for voice. - **FILTER_BANDLIMIT** = **6** --- Band-limit filter is used for voice, in this case resonance is the high-pass cutoff. A band-limit filter has a different frequency response than a notch filter, but otherwise both are band-rejecting filters. - **FILTER_LOW_SHELF** = **7** --- Low-shelf filter is used for voice. - **FILTER_HIGH_SHELF** = **8** --- High-shelf filter is used for voice. - **REVERB_SMALL** = **0** --- Small reverberation room (house room). - **REVERB_MEDIUM** = **1** --- Medium reverberation room (street) - **REVERB_LARGE** = **2** --- Large reverberation room (theatre) - **REVERB_HALL** = **3** --- Huge reverberation room (cathedral, warehouse). - **INVALID_VOICE_ID** = **-1** --- Value returned if the voice ID is invalid. Description ----------- SamplePlayer is a :ref:`Node` meant for simple sample playback. A library of samples is loaded and played back "as is", without positioning or anything. Member Function Description --------------------------- .. _class_SamplePlayer_get_chorus: - :ref:`float` **get_chorus** **(** :ref:`int` voice **)** const Return the current chorus send level for a given voice. .. _class_SamplePlayer_get_default_chorus: - :ref:`float` **get_default_chorus** **(** **)** const Return the default chorus send level of the player. .. _class_SamplePlayer_get_default_filter_cutoff: - :ref:`float` **get_default_filter_cutoff** **(** **)** const Return the default filter cutoff frequency of the player. .. _class_SamplePlayer_get_default_filter_gain: - :ref:`float` **get_default_filter_gain** **(** **)** const Return the default filter gain of the player. .. _class_SamplePlayer_get_default_filter_resonance: - :ref:`float` **get_default_filter_resonance** **(** **)** const Return the default filter resonance of the player. .. _class_SamplePlayer_get_default_filter_type: - :ref:`int` **get_default_filter_type** **(** **)** const Return the default filter type in use (see FILTER\_\* constants) for the player. .. _class_SamplePlayer_get_default_pan: - :ref:`float` **get_default_pan** **(** **)** const Return the default panning of the player. .. _class_SamplePlayer_get_default_pan_depth: - :ref:`float` **get_default_pan_depth** **(** **)** const Return the default pan depth of the player. .. _class_SamplePlayer_get_default_pan_height: - :ref:`float` **get_default_pan_height** **(** **)** const Return the default pan height of the player. .. _class_SamplePlayer_get_default_pitch_scale: - :ref:`float` **get_default_pitch_scale** **(** **)** const Return the default pitch scale of the player. .. _class_SamplePlayer_get_default_reverb: - :ref:`float` **get_default_reverb** **(** **)** const Return the default reverberation send level of the player. .. _class_SamplePlayer_get_default_reverb_room: - :ref:`int` **get_default_reverb_room** **(** **)** const Return the default reverberation room type of the player (see REVERB\_\* enum). .. _class_SamplePlayer_get_default_volume: - :ref:`float` **get_default_volume** **(** **)** const Return the default volume (on a linear scale) of the player. .. _class_SamplePlayer_get_default_volume_db: - :ref:`float` **get_default_volume_db** **(** **)** const Return the default volume (in dB) of the player. .. _class_SamplePlayer_get_filter_cutoff: - :ref:`float` **get_filter_cutoff** **(** :ref:`int` voice **)** const Return the current filter cutoff frequency for a given voice. .. _class_SamplePlayer_get_filter_gain: - :ref:`float` **get_filter_gain** **(** :ref:`int` voice **)** const Return the current filter gain for a given voice. .. _class_SamplePlayer_get_filter_resonance: - :ref:`float` **get_filter_resonance** **(** :ref:`int` voice **)** const Return the current filter resonance for a given voice. .. _class_SamplePlayer_get_filter_type: - :ref:`int` **get_filter_type** **(** :ref:`int` voice **)** const Return the current filter type in use (see FILTER\_\* constants) for a given voice. .. _class_SamplePlayer_get_mix_rate: - :ref:`int` **get_mix_rate** **(** :ref:`int` voice **)** const Return the current mix rate for a given voice. .. _class_SamplePlayer_get_pan: - :ref:`float` **get_pan** **(** :ref:`int` voice **)** const Return the current panning for a given voice. .. _class_SamplePlayer_get_pan_depth: - :ref:`float` **get_pan_depth** **(** :ref:`int` voice **)** const Return the current pan depth for a given voice. .. _class_SamplePlayer_get_pan_height: - :ref:`float` **get_pan_height** **(** :ref:`int` voice **)** const Return the current pan height for a given voice. .. _class_SamplePlayer_get_pitch_scale: - :ref:`float` **get_pitch_scale** **(** :ref:`int` voice **)** const Return the current pitch scale for a given voice. .. _class_SamplePlayer_get_polyphony: - :ref:`int` **get_polyphony** **(** **)** const Return the polyphony of the player. .. _class_SamplePlayer_get_reverb: - :ref:`float` **get_reverb** **(** :ref:`int` voice **)** const Return the current reverberation send level for a given voice. .. _class_SamplePlayer_get_reverb_room: - :ref:`int` **get_reverb_room** **(** :ref:`int` voice **)** const Return the current reverberation room type for a given voice (see REVERB\_\* enum). .. _class_SamplePlayer_get_sample_library: - :ref:`SampleLibrary` **get_sample_library** **(** **)** const Return the sample library used by the player. .. _class_SamplePlayer_get_volume: - :ref:`float` **get_volume** **(** :ref:`int` voice **)** const Return the current volume (on a linear scale) for a given voice. .. _class_SamplePlayer_get_volume_db: - :ref:`float` **get_volume_db** **(** :ref:`int` voice **)** const Return the current volume (in dB) for a given voice. .. _class_SamplePlayer_is_active: - :ref:`bool` **is_active** **(** **)** const Return whether the player is currently active. .. _class_SamplePlayer_is_voice_active: - :ref:`bool` **is_voice_active** **(** :ref:`int` voice **)** const Return whether the given voice is currently active. .. _class_SamplePlayer_play: - :ref:`int` **play** **(** :ref:`String` name, :ref:`bool` unique=false **)** Play a sample referenced by its name. Optionally, the playback can be made "unique" to force stopping all other samples currently played. The voices allocated for playback will then be returned. .. _class_SamplePlayer_set_chorus: - void **set_chorus** **(** :ref:`int` voice, :ref:`float` send **)** Set the chorus send level of a voice (from 0 to 1.0). For setting chorus parameters, see :ref:`AudioServer`. .. _class_SamplePlayer_set_default_chorus: - void **set_default_chorus** **(** :ref:`float` send **)** Set the default chorus send level of the player (from 0 to 1.0). For setting chorus parameters, see :ref:`AudioServer`. .. _class_SamplePlayer_set_default_filter: - void **set_default_filter** **(** :ref:`int` type, :ref:`float` cutoff_hz, :ref:`float` resonance, :ref:`float` gain=0 **)** Set the default filter for the player, using the given type (see FILTER\_\* constants), cutoff frequency (from 20 to 16,384 Hz) and resonance (from 0 to 4.0). Optionally, a gain can also be given (from 0 to 2.0). .. _class_SamplePlayer_set_default_pan: - void **set_default_pan** **(** :ref:`float` pan, :ref:`float` depth=0, :ref:`float` height=0 **)** Set the default panning of the player. Panning goes from -1.0 (left) to +1.0 (right). Optionally, for hardware than support 3D sound, one can also set depth and height (also in range -1.0 to +1.0). .. _class_SamplePlayer_set_default_pitch_scale: - void **set_default_pitch_scale** **(** :ref:`float` ratio **)** Set the default pitch scale of the player. A ratio of 1.0 is the normal scale. .. _class_SamplePlayer_set_default_reverb: - void **set_default_reverb** **(** :ref:`int` room_type, :ref:`float` send **)** Set the default reverberation type (see REVERB\_\* constants) and send level (from 0 to 1.0) of the player. .. _class_SamplePlayer_set_default_volume: - void **set_default_volume** **(** :ref:`float` volume **)** Set the default volume of the player using a linear scale. The "volume" argument should be a positive factor ranging from 0.0 (mute) up to 16.0 (i.e. 24 dB). A factor of 1.0 means that the voice will be played at normal system volume. Factors above 1.0 might be limited by the platform's audio output. .. _class_SamplePlayer_set_default_volume_db: - void **set_default_volume_db** **(** :ref:`float` db **)** Set the default volume of the player in dB. The "dB" argument can range from -80 to 24 dB, 0 dB being the maximum volume. Every 6 dB (resp. -6 dB), the volume is increased (resp. reduced) by half. .. _class_SamplePlayer_set_filter: - void **set_filter** **(** :ref:`int` voice, :ref:`int` type, :ref:`float` cutoff_hz, :ref:`float` resonance, :ref:`float` gain=0 **)** Set the filter for a given voice, using the given type (see FILTER\_\* constants), cutoff frequency (from 20 to 16,384 Hz) and resonance (from 0 to 4.0). Optionally, a gain can also be given (from 0 to 2.0). .. _class_SamplePlayer_set_mix_rate: - void **set_mix_rate** **(** :ref:`int` voice, :ref:`int` hz **)** Set the mix rate (in Hz) of a given voice. .. _class_SamplePlayer_set_pan: - void **set_pan** **(** :ref:`int` voice, :ref:`float` pan, :ref:`float` depth=0, :ref:`float` height=0 **)** Set the panning of a voice. Panning goes from -1.0 (left) to +1.0 (right). Optionally, for hardware than support 3D sound, one can also set depth and height (also in range -1.0 to +1.0). .. _class_SamplePlayer_set_pitch_scale: - void **set_pitch_scale** **(** :ref:`int` voice, :ref:`float` ratio **)** Set the pitch scale of a given voice. A ratio of 1.0 is the normal scale. .. _class_SamplePlayer_set_polyphony: - void **set_polyphony** **(** :ref:`int` max_voices **)** Set the polyphony of the player (maximum amount of simultaneous voices). .. _class_SamplePlayer_set_reverb: - void **set_reverb** **(** :ref:`int` voice, :ref:`int` room_type, :ref:`float` send **)** Set the reverberation type (see REVERB\_\* constants) and send level (from 0 to 1.0) of a voice. .. _class_SamplePlayer_set_sample_library: - void **set_sample_library** **(** :ref:`SampleLibrary` library **)** Set the sample library for the player. .. _class_SamplePlayer_set_volume: - void **set_volume** **(** :ref:`int` voice, :ref:`float` volume **)** Set the volume of a given voice using a linear scale. The "volume" argument should be a positive factor ranging from 0.0 (mute) up to 16.0 (i.e. 24 dB). A factor of 1.0 means that the voice will be played at normal system volume. Factors above 1.0 might be limited by the platform's audio output. .. _class_SamplePlayer_set_volume_db: - void **set_volume_db** **(** :ref:`int` voice, :ref:`float` db **)** Set the volume of a given voice in dB. The "dB" argument can range from -80 to 24 dB, 0 dB being the maximum volume. Every 6 dB (resp. -6 dB), the volume is increased (resp. reduced) by half. .. _class_SamplePlayer_stop: - void **stop** **(** :ref:`int` voice **)** Stop a given voice. .. _class_SamplePlayer_stop_all: - void **stop_all** **(** **)** Stop all playing voices.