From 44d62a9f4b6ac892b1fb9b8998be4162409952e3 Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 23 Aug 2021 14:53:27 -0300 Subject: 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. --- scene/3d/audio_stream_player_3d.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scene/3d') diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index d2424c9a3b..3b44580264 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -624,8 +624,12 @@ void AudioStreamPlayer3D::set_stream(Ref 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(); -- cgit v1.2.3