@@ -7,16 +7,16 @@ Introduction
7
7
------------
8
8
9
9
AudioStream is the base class of all audio emitting objects.
10
- AudioStreamPlayer binds onto an AudioStream to emit pcm data
10
+ AudioStreamPlayer binds onto an AudioStream to emit PCM data
11
11
into an AudioServer which manages audio drivers.
12
12
13
- All audio resources requires two audio based classes; AudioStream
13
+ All audio resources require two audio based classes: AudioStream
14
14
and AudioStreamPlayback. As a data container, AudioStream contains
15
15
the resource and exposes itself to GDScript. AudioStream references
16
- its own internal custom AudioStreamPlayback which translate
16
+ its own internal custom AudioStreamPlayback which translates
17
17
AudioStream into PCM data.
18
18
19
- This doc assumes the reader knows how to create C++ Modules . If not, refer to this guide
19
+ This guide assumes the reader knows how to create C++ modules . If not, refer to this guide
20
20
:ref: `doc_custom_modules_in_c++ `.
21
21
22
22
References:
@@ -38,9 +38,9 @@ Create an AudioStream
38
38
---------------------
39
39
40
40
41
- An AudioStream consists of three components; data container, stream name,
41
+ An AudioStream consists of three components: data container, stream name,
42
42
and an AudioStreamPlayback friend class generator. Audio data can be
43
- loaded a number of ways such as an internal counter for a tone generator,
43
+ loaded in a number of ways such as with an internal counter for a tone generator,
44
44
internal/external buffer, or a file reference.
45
45
46
46
@@ -72,6 +72,7 @@ Therefore, playback state must be self contained in AudioStreamPlayback.
72
72
virtual Ref<AudioStreamPlayback> instance_playback();
73
73
virtual String get_stream_name() const;
74
74
void gen_tone(int16_t *, int frames);
75
+ virtual float get_length() const { return 0; } //if supported, otherwise return 0
75
76
AudioStreamMyTone();
76
77
77
78
protected:
@@ -123,8 +124,9 @@ References:
123
124
Create an AudioStreamPlayback
124
125
-----------------------------
125
126
126
- AudioStreamPlayer uses ``mix `` callback to obtain pcm data. The callback must match sample rate and fill the buffer.
127
+ AudioStreamPlayer uses ``mix `` callback to obtain PCM data. The callback must match sample rate and fill the buffer.
127
128
129
+ Since AudioStreamPlayback is controlled by the audio thread, i/o and dynamic memory allocation are forbidden.
128
130
129
131
.. code :: cpp
130
132
0 commit comments