Skip to content
reduz edited this page Apr 10, 2014 · 10 revisions

SamplePlayer

####Inherits: Node ####Category: Core

Brief Description

Sample Player node.

Member Functions

Numeric Constants

  • FILTER_NONE = 0 - Filter is disabled for voice.
  • FILTER_LOWPASS = 1 - Lowpass filter is used for voice.
  • FILTER_BANDPASS = 2 - Bandpass filter is used for voice.
  • FILTER_HIPASS = 3 - HighPass filter is used for voice.
  • FILTER_NOTCH = 4 - Notch filter is used for voice.
  • FILTER_PEAK = 5
  • FILTER_BANDLIMIT = 6 - Band-Limit filter is used for voice, in this case resonance is the highpass cutoff.
  • FILTER_LOW_SHELF = 7
  • FILTER_HIGH_SHELF = 8
  • REVERB_SMALL = 0 - Small reverb room (house room).
  • REVERB_MEDIUM = 1 - Medium reverb room (street)
  • REVERB_LARGE = 2 - Large reverb room (Theather)
  • REVERB_HALL = 3 - Huge reverb room (cathedral, warehouse).

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

  • void set_voice_count ( int max_voices )

Set the amount of simultaneous voices that will be used for playback.

  • int get_voice_count ( ) const

Return the amount of simultaneous voices that will be used for playback.

Play back sample, given it"apos;s identifier "name". if "unique" is true, all othere previous samples will be stopped. The voice allocated for playback will be returned.

  • void stop ( int voice )

Stop a voice "voice". (see play).

  • void set_mix_rate ( int voice, int hz )

Change the mix rate of a voice "voice" to given "hz".

  • void set_pitch_scale ( int voice, float ratio )

Scale the pitch (mix rate) of a voice by a ratio value "ratio". A ratio of 1.0 means the voice is unscaled.

  • void set_volume ( int voice, float nrg )

Set the volume of a voice, 0db is maximum volume (every about -6db, volume is reduced in half). "db" does in fact go from zero to negative.

Set the panning of a voice. Panning goes from -1 (left) to +1 (right). Optionally, if the hardware supports 3D sound, also set depth and height (also in range -1 to +1).

Set and enable a filter of a voice, with type "type" (see FILTER_* enum), cutoff (0 to 22khz) frequency and resonance (0+).

  • void set_chorus ( int voice, float send )

Set the chorus send level of a voice (0 to 1). For setting chorus parameters, see AudioServer.

  • void set_reverb ( int voice, int room_type, float send )

Set the reverb send level and type of a voice (0 to 1). (see REVERB_* enum for type).

  • int get_mix_rate ( int voice ) const

Return the current mix rate for a given voice.

  • float get_pitch_scale ( int voice ) const

Return the current pitch scale for a given voice.

Return the current volume (in db) for a given voice. 0db is maximum volume (every about -6db, volume is reduced in half). "db" does in fact go from zero to negative.

Return the current panning for a given voice. Panning goes from -1 (left) to +1 (right).

  • float get_pan_depth ( int voice ) const

Return the current pan depth for a given voice (not used unless the hardware supports 3D sound)

  • float get_pan_height ( int voice ) const

Return the current pan height for a given voice (not used unless the hardware supports 3D sound)

  • int get_filter_type ( int voice ) const

Return the current filter type in use (see FILTER_* enum) for a given voice.

  • float get_filter_cutoff ( int voice ) const

Return the current filter cutoff for a given voice. Cutoff goes from 0 to 22khz.

  • float get_filter_resonance ( int voice ) const

Return the current filter resonance for a given voice. Resonance goes from 0 up.

Return the current chorus send level for a given voice. (0 to 1).

  • float get_reverb_room ( int voice ) const

Return the current reverb room type for a given voice (see REVERB_* enum).

Return the current reverb send level for a given voice. (0 to 1).

Clone this wiki locally