From 2caf1548a5e95cd6506c4a3574597b9229414368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 26 Sep 2015 23:45:17 +0200 Subject: Fix return type of get_reverb_room --- scene/audio/sample_player.cpp | 6 +++--- scene/audio/sample_player.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scene/audio/sample_player.cpp b/scene/audio/sample_player.cpp index 4e2c3f5dfd..7c0a926324 100644 --- a/scene/audio/sample_player.cpp +++ b/scene/audio/sample_player.cpp @@ -460,9 +460,9 @@ float SamplePlayer::get_chorus(VoiceID p_voice) const { return v.chorus_send; } -float SamplePlayer::get_reverb_room(VoiceID p_voice) const { +SamplePlayer::ReverbRoomType SamplePlayer::get_reverb_room(VoiceID p_voice) const { - _GET_VOICE_V(0); + _GET_VOICE_V(REVERB_SMALL); return v.reverb_room; } @@ -591,7 +591,7 @@ float SamplePlayer::get_default_chorus() const { return _default.chorus_send; } -float SamplePlayer::get_default_reverb_room() const { +SamplePlayer::ReverbRoomType SamplePlayer::get_default_reverb_room() const { return _default.reverb_room; } diff --git a/scene/audio/sample_player.h b/scene/audio/sample_player.h index 4637313dd2..75a01aff86 100644 --- a/scene/audio/sample_player.h +++ b/scene/audio/sample_player.h @@ -161,7 +161,7 @@ public: float get_filter_resonance(VoiceID p_voice) const; float get_filter_gain(VoiceID p_voice) const; float get_chorus(VoiceID p_voice) const; - float get_reverb_room(VoiceID p_voice) const; + ReverbRoomType get_reverb_room(VoiceID p_voice) const; float get_reverb(VoiceID p_voice) const; @@ -185,7 +185,7 @@ public: float get_default_filter_resonance() const; float get_default_filter_gain() const; float get_default_chorus() const; - float get_default_reverb_room() const; + ReverbRoomType get_default_reverb_room() const; float get_default_reverb() const; SamplePlayer(); -- cgit v1.2.3 From 7c1a79089ad8303c3b8f0fc243b0950854015759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 26 Sep 2015 23:57:51 +0200 Subject: Update documentation for all Sample* classes --- doc/base/classes.xml | 196 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 127 insertions(+), 69 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 5afbad090b..cbc1188995 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -27974,7 +27974,7 @@ - Audio Sample (sound) class. + Audio sample (sound) class. Sample provides an audio sample class, containing audio data, together with some information for playback, such as format, mix rate and loop. It is used by sound playback routines. @@ -27988,21 +27988,22 @@ - Create new data for the sample, with format "format" (see FORMAT_* enum), stereo hint, and length in frames (not samples or bytes!) "frame". Calling create overrides previous existing data if it exists. Stereo samples are interleaved pairs of left and right (in that order) points + Create new data for the sample, with format (see FORMAT_* constants), stereo hint, and length in frames (not samples or bytes!). + Calling this method overrides previously existing data. Stereo samples are interleaved pairs of left and right points (in that order). - Return the sample format (see FORMAT_* enum). + Return the sample format. - Return true if the sample was created stereo. + Return whether the current sample was created as stereo. @@ -28016,14 +28017,15 @@ - Set sample data. Data must be little endian, no matter the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long. + Set sample data. Data must be little endian, no matter the host platform, and exactly as long as to fit all frames. + For example, if data is stereo, 16 bits, 256 frames, it will be 1024 bytes long. - Return sample data. Data will be little endian, no matter the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long. + Return sample data as little endian. @@ -28037,28 +28039,28 @@ - Return the mix rate for the sample (expected playback frequency). + Return the mix rate for the sample. - Set the loop format, see LOOP_* enum + Set the loop format (use LOOP_* constants as argument). - Return the loop format, see LOOP_* enum. + Return the loop format. - Set the loop begin position, it must be a valid frame and less than the loop end position. + Set the loop begin position. It must be a valid frame and less than the loop end position. @@ -28072,23 +28074,23 @@ - Set the loop end position, it must be a valid frame and greater than the loop begin position. + Set the loop end position. It must be a valid frame and greater than the loop begin position. - Return the loop begin position. + Return the loop end position. - 8-Bits signed little endian PCM audio. + 8-bits signed little endian PCM audio. - 16-Bits signed little endian PCM audio. + 16-bits signed little endian PCM audio. IMA-ADPCM Audio. @@ -28097,19 +28099,19 @@ No loop enabled. - Forward looping (when playback reaches loop end, goes back to loop begin) + Forward looping (when playback reaches loop end, goes back to loop begin). - Ping-Pong looping (when playback reaches loop end, plays backward untilloop begin). Not available in all platforms. + Ping-pong looping (when playback reaches loop end, plays backward until loop begin). Not available in all platforms. - Library that contains a collection of Samples. + Library that contains a collection of samples. - Library that contains a collection of Samples, each identified by an text id. This is used as a data containeer for the majority of the SamplePlayer classes and derivatives. + Library that contains a collection of [Sample]s, each identified by a text ID. This is used as a data container for the majority of the SamplePlayer classes and derivatives. @@ -28118,7 +28120,7 @@ - Add a sample to the library, with a given text id. + Add a sample to the library, with a given text ID. @@ -28127,7 +28129,7 @@ - Return a sample from the library, from a given text-id. Return null if the sample is not found. + Return the sample from the library matching the given text ID. Return null if the sample is not found. @@ -28136,14 +28138,14 @@ - Return true if the sample text id exists in the library. + Return true if the sample text ID exists in the library. - Remove a sample given a specific text id. + Remove the sample matching the given text ID. @@ -28152,6 +28154,7 @@ + Set the volume (in dB) for the given sample. @@ -28160,6 +28163,7 @@ + Return the volume (in dB) for the given sample. @@ -28168,6 +28172,7 @@ + Set the pitch scale for the given sample. @@ -28176,6 +28181,7 @@ + Return the pitch scale for the given sample. @@ -28194,26 +28200,28 @@ + Set the sample library for the player. + Return the sample library used by the player. - + - Set the amount of simultaneous voices that will be used for playback. + Set the polyphony of the player (maximum amount of simultaneous voices). - + - Return the amount of simultaneous voices that will be used for playback. + Return the polyphony of the player. @@ -28224,18 +28232,20 @@ - Play back sample, given it's identifier "name". If "unique" is true, all othere previous samples will be stopped. The voice allocated for playback will be returned. + 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. - Stop a voice "voice". (see [method play]). + Stop a given voice. + Stop all playing voices. @@ -28244,7 +28254,7 @@ - Change the mix rate of a voice "voice" to given "hz". + Set the mix rate (in Hz) of a given voice. @@ -28253,24 +28263,28 @@ - Scale the pitch (mix rate) of a voice by a ratio value "ratio". A ratio of 1.0 means the voice is unscaled. + Set the pitch scale of a given voice. A ratio of 1.0 is the normal scale. - + - 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 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. @@ -28283,7 +28297,8 @@ - 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 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). @@ -28298,7 +28313,8 @@ - Set and enable a filter of a voice, with type "type" (see FILTER_* enum), cutoff (0 to 22khz) frequency and resonance (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). @@ -28307,7 +28323,7 @@ - Set the chorus send level of a voice (0 to 1). For setting chorus parameters, see [AudioServer]. + Set the chorus send level of a voice (from 0 to 1.0). For setting chorus parameters, see [AudioServer]. @@ -28318,7 +28334,7 @@ - Set the reverb send level and type of a voice (0 to 1). (see REVERB_* enum for type). + Set the reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of a voice. @@ -28345,7 +28361,7 @@ - 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 volume (on a linear scale) for a given voice. @@ -28354,6 +28370,7 @@ + Return the current volume (in dB) for a given voice. @@ -28362,7 +28379,7 @@ - Return the current panning for a given voice. Panning goes from -1 (left) to +1 (right). + Return the current panning for a given voice. @@ -28371,7 +28388,7 @@ - Return the current pan depth for a given voice (not used unless the hardware supports 3D sound) + Return the current pan depth for a given voice. @@ -28380,7 +28397,7 @@ - Return the current pan height for a given voice (not used unless the hardware supports 3D sound) + Return the current pan height for a given voice. @@ -28389,7 +28406,7 @@ - Return the current filter type in use (see FILTER_* enum) for a given voice. + Return the current filter type in use (see FILTER_* constants) for a given voice. @@ -28398,7 +28415,7 @@ - Return the current filter cutoff for a given voice. Cutoff goes from 0 to 22khz. + Return the current filter cutoff frequency for a given voice. @@ -28407,7 +28424,7 @@ - Return the current filter resonance for a given voice. Resonance goes from 0 up. + Return the current filter resonance for a given voice. @@ -28416,6 +28433,7 @@ + Return the current filter gain for a given voice. @@ -28424,16 +28442,16 @@ - Return the current chorus send level for a given voice. (0 to 1). + Return the current chorus send level for a given voice. - + - Return the current reverb room type for a given voice (see REVERB_* enum). + Return the current reverberation room type for a given voice (see REVERB_* enum). @@ -28442,25 +28460,31 @@ - Return the current reverb send level for a given voice. (0 to 1). + Return the current reverberation send level for a given voice. + Set the default pitch scale of the player. A ratio of 1.0 is the normal scale. - + + 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. + 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. @@ -28471,6 +28495,8 @@ + 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). @@ -28483,12 +28509,15 @@ + 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 chorus send level of the player (from 0 to 1.0). For setting chorus parameters, see [AudioServer]. @@ -28497,90 +28526,105 @@ + Set the default reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of the player. + Return the default pitch scale of the player. + Return the default volume (on a linear scale) of the player. + Return the default volume (in dB) of the player. + Return the default panning of the player. + Return the default pan depth of the player. + Return the default pan height of the player. + Return the default filter type in use (see FILTER_* constants) for the player. + Return the default filter cutoff frequency of the player. + Return the default filter resonance of the player. + Return the default filter gain of the player. + Return the default chorus send level of the player. - + + Return the default reverberation room type of the player (see REVERB_* enum). + Return the default reverberation send level of the player. + Return whether the player is currently active. @@ -28589,6 +28633,7 @@ + Return whether the given voice is currently active. @@ -28597,46 +28642,52 @@ Filter is disabled for voice. - Lowpass filter is used for voice. + Low-pass filter is used for voice. - Bandpass filter is used for voice. + Band-pass filter is used for voice. - Highpass filter is used for voice. + High-pass filter is used for voice. Notch (band reject) filter is used for voice. + Peak (exclusive band) filter is used for voice. - Band-limit filter is used for voice, in this case resonance is the highpass cutoff. A band-limit filter has a different frequency response than a notch filter, but otherwise both are band-rejecting filters. + 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. + Low-shelf filter is used for voice. + High-shelf filter is used for voice. - Small reverb room (house room). + Small reverberation room (house room). - Medium reverb room (street) + Medium reverberation room (street) - Large reverb room (Theather) + Large reverberation room (theatre) - Huge reverb room (cathedral, warehouse). + Huge reverberation room (cathedral, warehouse). + + + Value returned if the voice ID is invalid. - Sample player for Positional 2D Sound. + Sample player for positional 2D Sound. - Sample player for Positional 2D Sound. Plays sound samples positionally, left and right depending on the distance/place on the screen. + Sample player for positional 2D Sound. Plays sound samples positionally, left and right depending on the distance/place on the screen. @@ -28650,11 +28701,11 @@ - Return the sample library used for the player. + Return the sample library used by the player. - + Set the polyphony of the player (maximum amount of simultaneous voices). @@ -28664,7 +28715,7 @@ - Return the polyphony of the player (maximum amount of simultaneous voices). + Return the polyphony of the player. @@ -28675,7 +28726,8 @@ - Play a sample, an internal polyphony id can be passed, or else it's assigned automatically. Returns a voice id which can be used to modify the voice parameters. + Play a sample. An internal polyphony ID can optionally be passed, or defaults to NEXT_VOICE. + Return a voice ID which can be used to modify the voice parameters, or INVALID_VOICE if the voice or sample are invalid. @@ -28693,7 +28745,7 @@ - Change the volume scale of a currently playing voice (using dB). + Change the volume scale (in dB) of a currently playing voice. @@ -28702,7 +28754,7 @@ - Return true if a voice is still active (false if it stopped playing). + Return whether a voice is still active or has stopped playing. @@ -28721,20 +28773,26 @@ + Set the amplitude for random pitch scale variations. If different from zero, the pitch scale will vary randomly around 1.0 in a range defined by val. + The actual pitch scale will be, with "variation" ranging from -val to val: + * variation > 0: 1.0 + variation + * variation < 0: 1.0/(1.0 - variation) + Return the amplitude used for random pitch scale variations. - If the voice is invalid, this is returned. + Value returned if the voice or sample are invalid. + Default voice for the play method. Corresponds to the first voice following the last used voice. @@ -35196,10 +35254,10 @@ - Update the timer at fixed intervals (framerate processing). + Update the timer at fixed intervals (framerate processing). - Update the timer during the idle time at each frame. + Update the timer during the idle time at each frame. -- cgit v1.2.3