diff options
author | reduz <reduzio@gmail.com> | 2021-08-23 14:53:27 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-08-23 19:58:40 -0300 |
commit | 44d62a9f4b6ac892b1fb9b8998be4162409952e3 (patch) | |
tree | cbc5ffa6979314def8adbc229cd94b4adf8afb1c /scene/audio | |
parent | 679b9be9d30001e8ffc8087e412097f7394cacdd (diff) |
Implement NativeExtension pointer arguments
* Allows calling into native extensions directly with a pointer
* Makes it easier to implement some APIs more efficiently
* Appears with a "*" in the documentation for the argument.
* Implementing the pointer handling is entirely up to the implementation, although the extension API provides some hint.
* AudioStream has been implemented as an example, allowing to create NativeExtension based AudioStreams.
Diffstat (limited to 'scene/audio')
-rw-r--r-- | scene/audio/audio_stream_player.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 298d75b668..9383355292 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -202,8 +202,12 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { } if (p_stream.is_valid()) { - stream = p_stream; stream_playback = p_stream->instance_playback(); + if (stream_playback.is_valid()) { + stream = p_stream; + } else { + stream.unref(); + } } AudioServer::get_singleton()->unlock(); |