summaryrefslogtreecommitdiff
path: root/doc/classes/AudioStreamSample.xml
blob: bb418f3c36e930cb194d30b5712e19f9edadba56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.2">
	<brief_description>
		Stores audio data loaded from WAV files.
	</brief_description>
	<description>
		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.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="save_to_wav">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="path" type="String">
			</argument>
			<description>
				Saves the AudioStreamSample as a WAV file to [code]path[/code]. Samples with IMA ADPCM format can't be saved.
				[b]Note:[/b] A [code].wav[/code] extension is automatically appended to [code]path[/code] if it is missing.
			</description>
		</method>
	</methods>
	<members>
		<member name="data" type="PoolByteArray" setter="set_data" getter="get_data" default="PoolByteArray(  )">
			Contains the audio data in bytes.
			[b]Note:[/b] This property expects signed PCM8 data. To convert unsigned PCM8 to signed PCM8, subtract 128 from each byte.
		</member>
		<member name="format" type="int" setter="set_format" getter="get_format" enum="AudioStreamSample.Format" default="0">
			Audio format. See [enum Format] constants for values.
		</member>
		<member name="loop_begin" type="int" setter="set_loop_begin" getter="get_loop_begin" default="0">
			Loop start in bytes.
		</member>
		<member name="loop_end" type="int" setter="set_loop_end" getter="get_loop_end" default="0">
			Loop end in bytes.
		</member>
		<member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="AudioStreamSample.LoopMode" default="0">
			Loop mode. See [enum LoopMode] constants for values.
		</member>
		<member name="mix_rate" type="int" setter="set_mix_rate" getter="get_mix_rate" default="44100">
			The sample rate for mixing this audio.
		</member>
		<member name="stereo" type="bool" setter="set_stereo" getter="is_stereo" default="false">
			If [code]true[/code], audio is stereo.
		</member>
	</members>
	<constants>
		<constant name="FORMAT_8_BITS" value="0" enum="Format">
			8-bit audio codec.
		</constant>
		<constant name="FORMAT_16_BITS" value="1" enum="Format">
			16-bit audio codec.
		</constant>
		<constant name="FORMAT_IMA_ADPCM" value="2" enum="Format">
			Audio is compressed using IMA ADPCM.
		</constant>
		<constant name="LOOP_DISABLED" value="0" enum="LoopMode">
			Audio does not loop.
		</constant>
		<constant name="LOOP_FORWARD" value="1" enum="LoopMode">
			Audio loops the data between [member loop_begin] and [member loop_end] playing forward only.
		</constant>
		<constant name="LOOP_PING_PONG" value="2" enum="LoopMode">
			Audio loops the data between [member loop_begin] and [member loop_end] playing back and forth.
		</constant>
		<constant name="LOOP_BACKWARD" value="3" enum="LoopMode">
			Audio loops the data between [member loop_begin] and [member loop_end] playing backward only.
		</constant>
	</constants>
</class>