SamplePlayer¶
Category: Core
Brief Description¶
Sample Player node.
Member Functions¶
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 Node meant for simple sample playback. A library of samples is loaded and played back “as is”, without positioning or anything.
Member Function Description¶
Return the current chorus send level for a given voice.
- float get_default_chorus ( ) const
Return the default chorus send level of the player.
- float get_default_filter_cutoff ( ) const
Return the default filter cutoff frequency of the player.
- float get_default_filter_gain ( ) const
Return the default filter gain of the player.
- float get_default_filter_resonance ( ) const
Return the default filter resonance of the player.
- int get_default_filter_type ( ) const
Return the default filter type in use (see FILTER_* constants) for the player.
- float get_default_pan ( ) const
Return the default panning of the player.
- float get_default_pan_depth ( ) const
Return the default pan depth of the player.
- float get_default_pan_height ( ) const
Return the default pan height of the player.
- float get_default_pitch_scale ( ) const
Return the default pitch scale of the player.
- float get_default_reverb ( ) const
Return the default reverberation send level of the player.
- int get_default_reverb_room ( ) const
Return the default reverberation room type of the player (see REVERB_* enum).
- float get_default_volume ( ) const
Return the default volume (on a linear scale) of the player.
- float get_default_volume_db ( ) const
Return the default volume (in dB) of the player.
Return the current filter cutoff frequency for a given voice.
Return the current filter gain for a given voice.
Return the current filter resonance for a given voice.
Return the current filter type in use (see FILTER_* constants) for a given voice.
Return the current mix rate for a given voice.
Return the current panning for a given voice.
Return the current pan depth for a given voice.
Return the current pan height for a given voice.
Return the current pitch scale for a given voice.
- int get_polyphony ( ) const
Return the polyphony of the player.
Return the current reverberation send level for a given voice.
Return the current reverberation room type for a given voice (see REVERB_* enum).
- SampleLibrary get_sample_library ( ) const
Return the sample library used by the player.
Return the current volume (on a linear scale) for a given voice.
Return the current volume (in dB) for a given voice.
- bool is_active ( ) const
Return whether the player is currently active.
Return whether the given voice is currently active.
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.
Set the chorus send level of a voice (from 0 to 1.0). For setting chorus parameters, see AudioServer.
- void set_default_chorus ( float send )
Set the default chorus send level of the player (from 0 to 1.0). For setting chorus parameters, see AudioServer.
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).
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).
- void set_default_pitch_scale ( float ratio )
Set the default pitch scale of the player. A ratio of 1.0 is the normal scale.
Set the default reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of the player.
- void set_default_volume ( 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.
- void set_default_volume_db ( 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.
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).
Set the mix rate (in Hz) of a given voice.
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).
Set the pitch scale of a given voice. A ratio of 1.0 is the normal scale.
- void set_polyphony ( int max_voices )
Set the polyphony of the player (maximum amount of simultaneous voices).
Set the reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of a voice.
- void set_sample_library ( SampleLibrary library )
Set the sample library for the player.
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.
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.
- void stop ( int voice )
Stop a given voice.
- void stop_all ( )
Stop all playing voices.