Skip to content

Commit 8e5be12

Browse files
committed
added mhilbrunner suggested changes
fix audiostream change ; to : for list of items change doc to this guide
1 parent 8d13d96 commit 8e5be12

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

development/cpp/custom_audiostreams.rst

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ Introduction
77
------------
88

99
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
1111
into an AudioServer which manages audio drivers.
1212

13-
All audio resources requires two audio based classes; AudioStream
13+
All audio resources require two audio based classes: AudioStream
1414
and AudioStreamPlayback. As a data container, AudioStream contains
1515
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
1717
AudioStream into PCM data.
1818

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
2020
:ref:`doc_custom_modules_in_c++`.
2121

2222
References:
@@ -38,9 +38,9 @@ Create an AudioStream
3838
---------------------
3939

4040

41-
An AudioStream consists of three components; data container, stream name,
41+
An AudioStream consists of three components: data container, stream name,
4242
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,
4444
internal/external buffer, or a file reference.
4545

4646

@@ -72,6 +72,7 @@ Therefore, playback state must be self contained in AudioStreamPlayback.
7272
virtual Ref<AudioStreamPlayback> instance_playback();
7373
virtual String get_stream_name() const;
7474
void gen_tone(int16_t *, int frames);
75+
virtual float get_length() const { return 0; } //if supported, otherwise return 0
7576
AudioStreamMyTone();
7677
7778
protected:
@@ -123,8 +124,9 @@ References:
123124
Create an AudioStreamPlayback
124125
-----------------------------
125126

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.
127128

129+
Since AudioStreamPlayback is controlled by the audio thread, i/o and dynamic memory allocation are forbidden.
128130

129131
.. code:: cpp
130132

0 commit comments

Comments
 (0)