2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "AudioStreamSample" inherits= "AudioStream" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
2019-06-22 07:04:47 +08:00
Stores audio data loaded from WAV files.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
AudioStreamSample stores sound samples loaded from WAV files. To play the stored sound, use an [AudioStreamPlayer] (for non-positional audio) or [AudioStreamPlayer2D]/[AudioStreamPlayer3D] (for positional audio). The sound can be looped.
This class can also be used to store dynamically-generated PCM audio data.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
2018-08-21 06:35:30 +08:00
<method name= "save_to_wav" >
2019-03-12 22:48:52 +08:00
<return type= "int" enum= "Error" >
2018-08-21 06:35:30 +08:00
</return>
<argument index= "0" name= "path" type= "String" >
</argument>
<description >
2019-03-12 22:48:52 +08:00
Saves the AudioStreamSample as a WAV file to [code]path[/code]. Samples with IMA ADPCM format can't be saved.
2019-06-22 07:04:47 +08:00
[b]Note:[/b] A [code].wav[/code] extension is automatically appended to [code]path[/code] if it is missing.
2018-08-21 06:35:30 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
</methods>
<members >
2020-02-18 20:59:24 +08:00
<member name= "data" type= "PackedByteArray" setter= "set_data" getter= "get_data" default= "PackedByteArray( )" >
2018-04-26 03:04:03 +08:00
Contains the audio data in bytes.
2019-09-01 02:14:58 +08:00
[b]Note:[/b] This property expects signed PCM8 data. To convert unsigned PCM8 to signed PCM8, subtract 128 from each byte.
2018-04-26 03:04:03 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "format" type= "int" setter= "set_format" getter= "get_format" enum= "AudioStreamSample.Format" default= "0" >
2019-12-07 06:09:20 +08:00
Audio format. See [enum Format] constants for values.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "loop_begin" type= "int" setter= "set_loop_begin" getter= "get_loop_begin" default= "0" >
2020-04-16 05:38:12 +08:00
The loop start point (in number of samples, relative to the beginning of the sample). This information will be imported automatically from the WAV file if present.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "loop_end" type= "int" setter= "set_loop_end" getter= "get_loop_end" default= "0" >
2020-04-16 05:38:12 +08:00
The loop end point (in number of samples, relative to the beginning of the sample). This information will be imported automatically from the WAV file if present.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "loop_mode" type= "int" setter= "set_loop_mode" getter= "get_loop_mode" enum= "AudioStreamSample.LoopMode" default= "0" >
2020-04-16 05:38:12 +08:00
The loop mode. This information will be imported automatically from the WAV file if present. See [enum LoopMode] constants for values.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "mix_rate" type= "int" setter= "set_mix_rate" getter= "get_mix_rate" default= "44100" >
2017-09-17 05:12:52 +08:00
The sample rate for mixing this audio.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "stereo" type= "bool" setter= "set_stereo" getter= "is_stereo" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], audio is stereo.
2017-09-13 04:42:36 +08:00
</member>
</members>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "FORMAT_8_BITS" value= "0" enum= "Format" >
2019-06-22 07:04:47 +08:00
8-bit audio codec.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "FORMAT_16_BITS" value= "1" enum= "Format" >
2019-06-22 07:04:47 +08:00
16-bit audio codec.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "FORMAT_IMA_ADPCM" value= "2" enum= "Format" >
2019-06-22 07:04:47 +08:00
Audio is compressed using IMA ADPCM.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LOOP_DISABLED" value= "0" enum= "LoopMode" >
2017-09-17 05:12:52 +08:00
Audio does not loop.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LOOP_FORWARD" value= "1" enum= "LoopMode" >
2020-04-16 05:38:12 +08:00
Audio loops the data between [member loop_begin] and [member loop_end], playing forward only.
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LOOP_PING_PONG" value= "2" enum= "LoopMode" >
2020-04-16 05:38:12 +08:00
Audio loops the data between [member loop_begin] and [member loop_end], playing back and forth.
2017-09-16 07:46:14 +08:00
</constant>
2018-10-29 02:37:14 +08:00
<constant name= "LOOP_BACKWARD" value= "3" enum= "LoopMode" >
2020-04-16 05:38:12 +08:00
Audio loops the data between [member loop_begin] and [member loop_end], playing backward only.
2018-10-29 02:37:14 +08:00
</constant>
2017-09-13 04:42:36 +08:00
</constants>
</class>