diff --git a/.gitignore b/.gitignore
index e42ed33..dfcad0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ project/addons/godot-steam-audio/bin/*.ilk
project/addons/godot-steam-audio/bin/*.exp
project/addons/godot-steam-audio/bin/*.lib
project/addons/godot-steam-audio/bin/*.dylib
+src/gen/*
diff --git a/.gitmodules b/.gitmodules
index 8f753a4..b2e21d0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,7 +1,7 @@
[submodule "src/lib/godot-cpp"]
path = src/lib/godot-cpp
url = https://github.com/stechyo/godot-cpp
- branch = gdext/steam-audio
+ branch = 4.3-steam-audio
[submodule "src/lib/steamaudio"]
path = src/lib/steamaudio
url = https://github.com/ValveSoftware/steam-audio
diff --git a/README.md b/README.md
index fca4233..ecb16f0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# godot-steam-audio
This is a GDExtension that integrates the [steam-audio](https://valvesoftware.github.io/steam-audio/) library
-into Godot 4.2. This adds sound effects such as occlusion and reverb into the engine.
+into Godot 4.3. This adds sound effects such as occlusion and reverb into the engine.
### [Demo Video](https://www.youtube.com/watch?v=vRnzfnb93Gw)
![A picture of the editor screen with some godot-steam-audio nodes.](doc/imgs/editor.png)
diff --git a/SConstruct b/SConstruct
index fa85731..4699775 100644
--- a/SConstruct
+++ b/SConstruct
@@ -24,6 +24,10 @@ elif env["platform"] == "macos":
env.Append(LIBPATH=[f'{steam_audio_lib_path}/osx'])
env.Append(LIBS=["libphonon.dylib"])
+if env["target"] in ["editor", "template_debug"]:
+ doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
+ sources.append(doc_data)
+
library = env.SharedLibrary(
"project/addons/godot-steam-audio/bin/godot-steam-audio{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
diff --git a/doc_classes/SteamAudioConfig.xml b/doc_classes/SteamAudioConfig.xml
new file mode 100644
index 0000000..1f2f85b
--- /dev/null
+++ b/doc_classes/SteamAudioConfig.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+ This node makes [SteamAudioServer] tick. You must have one, and only one, instance of it in your scene if you'd like the extension to do anything.
+
+
+
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings17numDiffuseSamplesE]IPLSimulationSettings.numDiffuseSamples[/url]
+
+
+ The global log level for this extension. Setting it to a lower level will show more logs.
+
+
+ Audio volume (see [url=https://valvesoftware.github.io/steam-audio/doc/capi/hrtf.html#_CPPv4N15IPLHRTFSettings6volumeE]IPLHRTFSettings.volume[/url])
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings8maxOrderE]IPLSimulationSettings.maxOrder[/url]
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings22maxNumOcclusionSamplesE]IPLSimulationSettings.maxNumOcclusionSamples[/url]
+
+
+ Higher values will result in more realistic reflections, but this will impact performance - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings11maxDurationE]IPLSimulationSettings.maxDuration[/url]
+
+
+ Overrides each source's max_reflection_rays setting - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings10maxNumRaysE]IPLSimulationSettings.maxNumRays[/url]
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings13maxNumSourcesE]IPLSimulationSettings.maxNumSources[/url]
+
+
+ Number of threads that reflection simulation will use (see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N21IPLSimulationSettings10numThreadsE]IPLSimulationSettings.numThreads[/url])
+
+
+ The ray tracing implementation to use - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/scene.html#_CPPv412IPLSceneType]IPLSceneType[/url]
+
+
+
diff --git a/doc_classes/SteamAudioDynamicGeometry.xml b/doc_classes/SteamAudioDynamicGeometry.xml
new file mode 100644
index 0000000..bdc3b86
--- /dev/null
+++ b/doc_classes/SteamAudioDynamicGeometry.xml
@@ -0,0 +1,32 @@
+
+
+
+ Dynamic geometry that will affect SteamAudio simulation.
+
+
+ This node will attempt to get a mesh from its parent at [code]_ready()[/code] and add it to the internal SteamAudio scene. Adding a node after the game has started probably works, but it is not supported. If this object isn't going to move, then just use [SteamAudioGeometry].
+
+ This node can extract meshes from the following nodes:
+ - [MeshInstance3D]
+ - [CollisionShape3D], [b]if its shape is one of[/b]:
+ - [BoxShape3D]
+ - [CylinderShape3D]
+ - [CapsuleShape3D]
+ - [SphereShape3D]
+ - [ConcavePolygonShape3D]
+
+
+
+
+
+
+
+
+
+
+
+
+ The geometry's material.
+
+
+
diff --git a/doc_classes/SteamAudioGeometry.xml b/doc_classes/SteamAudioGeometry.xml
new file mode 100644
index 0000000..34a7840
--- /dev/null
+++ b/doc_classes/SteamAudioGeometry.xml
@@ -0,0 +1,35 @@
+
+
+
+ Static geometry that will affect SteamAudio simulation.
+
+
+ This node will attempt to get a mesh from its parent at [code]_ready()[/code] and add it to the internal SteamAudio scene. Adding a node after the game has started probably works, but it is not supported. If you want to move this node's transform at runtime, use [code]recalculate()[/code] or consider (if you want more detailed simulation and don't mind worse performance) [SteamAudioDynamicGeometry].
+ This node can extract meshes from the following nodes:
+ - [MeshInstance3D]
+ - [CollisionShape3D], [b]if its shape is one of[/b]:
+ - [BoxShape3D]
+ - [CylinderShape3D]
+ - [CapsuleShape3D]
+ - [SphereShape3D]
+ - [ConcavePolygonShape3D]
+
+
+
+
+
+
+
+ Changes the internal SteamAudio scene to reflect any changes in transform that you may have made to the object. If you plan on calling this every frame to account for an object's motion, it's probably better to use [SteamAudioDynamicGeometry].
+
+
+
+
+
+ Whether the geometry is disabled.
+
+
+ The geometry's material.
+
+
+
diff --git a/doc_classes/SteamAudioListener.xml b/doc_classes/SteamAudioListener.xml
new file mode 100644
index 0000000..11f56b2
--- /dev/null
+++ b/doc_classes/SteamAudioListener.xml
@@ -0,0 +1,27 @@
+
+
+
+ This node's transform is used for simulating the listener's transform in the SteamAudio simulation. You'll likely want to have this as a child of your [Camera3D].
+
+
+
+
+
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N25IPLSimulationSharedInputs21irradianceMinDistanceE]IPLSimulationSharedInputs.irradianceMinDistance[/url]
+
+
+ May be overriden by [SteamAudioConfig] - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N25IPLSimulationSharedInputs5orderE]IPLSimulationSharedInputs.order[/url]
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N25IPLSimulationSharedInputs10numBouncesE]IPLSimulationSharedInputs.numBounces[/url]
+
+
+ May be overriden by [SteamAudioConfig] - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N25IPLSimulationSharedInputs8durationE]IPLSimulationSharedInputs.duration[/url]
+
+
+ May be overriden by [SteamAudioConfig] - see [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N25IPLSimulationSharedInputs7numRaysE]IPLSimulationSharedInputs.numRays[/url]
+
+
+
diff --git a/doc_classes/SteamAudioMaterial.xml b/doc_classes/SteamAudioMaterial.xml
new file mode 100644
index 0000000..ac51a07
--- /dev/null
+++ b/doc_classes/SteamAudioMaterial.xml
@@ -0,0 +1,34 @@
+
+
+
+ The acoustic properties of a surface.
+
+
+ This resource is a Godot translation of [url=https://valvesoftware.github.io/steam-audio/doc/capi/scene.html?highlight=iplmaterial#_CPPv411IPLMaterial]IPLMaterial[/url]. Low, middle, and high refer to frequency bands with center frequencies of 400Hz, 2.5kHz and 15kHz.
+
+
+
+
+
+ Fraction of sound energy absorbed at high frequencies.
+
+
+ Fraction of sound energy absorbed at low frequencies.
+
+
+ Fraction of sound energy absorbed at mid frequencies.
+
+
+ Fraction of sound energy scattered in a random direction when reflecting.
+
+
+ Fraction of sound energy absorbed at high frequencies.
+
+
+ Fraction of sound energy absorbed at low frequencies.
+
+
+ Fraction of sound energy absorbed at mid frequencies.
+
+
+
diff --git a/doc_classes/SteamAudioPlayer.xml b/doc_classes/SteamAudioPlayer.xml
new file mode 100644
index 0000000..c10574a
--- /dev/null
+++ b/doc_classes/SteamAudioPlayer.xml
@@ -0,0 +1,65 @@
+
+
+
+ This player's transform is used as the audio source transform in the SteamAudio simulation.
+
+
+
+
+
+
+
+
+
+ Returns the player's inner [AudioStream]
+
+
+
+
+
+ Returns the player's inner [AudioStreamPlayback]
+
+
+
+
+
+
+
+
+
+ Plays the given stream starting at from_offset, at the defined volume and pitch scale.
+ [b]A very important note[/b]: play_stream is what you want to use if you'd like to change a SteamAudioPlayer's stream at runtime. Do not try to set the player's stream directly through set_stream, as that will disable all SteamAudio effects for that player. At runtime, the stream you've configured will be replaced with a [SteamAudioStream]. This stream has an inner stream which corresponds to what you configured in the scene.
+
+
+
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/ambisonics-encode-effect.html#_CPPv4N31IPLAmbisonicsEncodeEffectParams5orderE]IPLAmbisonicsEncodeEffectParams.order[/url].
+
+
+ Whether SteamAudio distance attenuation is enabled. Keep in mind that this is disabled by default, and enabling it will disable Godot's built-in attenuation, which you can only re-enable when you disable this.
+
+
+ The maximum distance from the listener at which reflection simulation is run for this audio source. Keep in mind that this does not disable reflection if it has already been simulated, it just doesn't update the effect.
+
+
+ See
+ [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N27IPLDistanceAttenuationModel11minDistanceE]IPLDistanceAttenuationModel.minDistance[/url], and note the distance attenuation type in godot-steam-audio is always [code]IPL_DISTANCEATTENUATIONTYPE_INVERSEDISTANCE[/code].
+
+
+ Whether SteamAudio occlusion and transmission is enabled.
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N19IPLSimulationInputs15occlusionRadiusE]IPLSimulationInputs.occlusionRadius[/url].
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N19IPLSimulationInputs19numOcclusionSamplesE]IPLSimulationInputs.numOcclusionSamples.
+
+
+ Whether SteamAudio reflection is on.
+
+
+ See [url=https://valvesoftware.github.io/steam-audio/doc/capi/simulation.html#_CPPv4N19IPLSimulationInputs19numTransmissionRaysE]IPLSimulationInputs.numTransmissionRays[/url].
+
+
+
diff --git a/doc_classes/SteamAudioServer.xml b/doc_classes/SteamAudioServer.xml
new file mode 100644
index 0000000..cdc9d96
--- /dev/null
+++ b/doc_classes/SteamAudioServer.xml
@@ -0,0 +1,22 @@
+
+
+
+ This is a singleton that handles all SteamAudio global state. You should not interact with it directly.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc_classes/SteamAudioStream.xml b/doc_classes/SteamAudioStream.xml
new file mode 100644
index 0000000..aa2915a
--- /dev/null
+++ b/doc_classes/SteamAudioStream.xml
@@ -0,0 +1,10 @@
+
+
+
+ You do not need to, and [b]should not[/b] assign this stream to your [SteamAudioPlayer], as the extension handles that for you.
+
+
+
+
+
+
diff --git a/doc_classes/SteamAudioStreamPlayback.xml b/doc_classes/SteamAudioStreamPlayback.xml
new file mode 100644
index 0000000..96ba642
--- /dev/null
+++ b/doc_classes/SteamAudioStreamPlayback.xml
@@ -0,0 +1,21 @@
+
+
+
+ This playback will contain an audio stream that you provided when configuring your Godot scene, and it will apply the SteamAudio effects configured in the corresponding [SteamAudioPlayer] to it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/addons/godot-steam-audio/bin/libgodot-steam-audio.gdextension b/project/addons/godot-steam-audio/bin/libgodot-steam-audio.gdextension
index e5e7511..c2c34de 100644
--- a/project/addons/godot-steam-audio/bin/libgodot-steam-audio.gdextension
+++ b/project/addons/godot-steam-audio/bin/libgodot-steam-audio.gdextension
@@ -1,14 +1,12 @@
[configuration]
entry_symbol = "init_extension"
-compatibility_minimum = 4.2
+compatibility_minimum = 4.3
[libraries]
linux.x86_64.debug ="res://addons/godot-steam-audio/bin/libgodot-steam-audio.linux.template_debug.x86_64.so"
linux.x86_64.release = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.linux.template_release.x86_64.so"
-linux.debug.arm64 = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.linux.template_debug.arm64.so"
-linux.release.arm64 = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.linux.template_release.arm64.so"
windows.x86_64.debug = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.windows.template_debug.x86_64.dll"
windows.x86_64.release = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.windows.template_release.x86_64.dll"
macos.debug = "res://addons/godot-steam-audio/bin/libgodot-steam-audio.macos.template_debug.universal.dylib"
diff --git a/project/project.godot b/project/project.godot
index 47542ff..296c6d0 100644
--- a/project/project.godot
+++ b/project/project.godot
@@ -12,50 +12,50 @@ config_version=5
config/name="Godot-SteamAudio Demo"
run/main_scene="res://scenes/demo.tscn"
-config/features=PackedStringArray("4.2")
+config/features=PackedStringArray("4.3")
config/icon="res://icon.svg"
[input]
ui_left={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
-, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
+, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
-, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
+, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
-, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
+, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
-, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
+, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
toggle_door={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
]
}
move_door={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
]
}
diff --git a/project/scenes/demo.tscn b/project/scenes/demo.tscn
index 9be67e2..e13d7f0 100644
--- a/project/scenes/demo.tscn
+++ b/project/scenes/demo.tscn
@@ -46,9 +46,7 @@ material = SubResource("StandardMaterial3D_dg8l6")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_w72gs"]
streams_count = 2
stream_0/stream = ExtResource("5_00edw")
-stream_0/weight = 1.0
stream_1/stream = ExtResource("6_dw5dv")
-stream_1/weight = 1.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pyn86"]
albedo_color = Color(0.976471, 0.133333, 0.286275, 1)
diff --git a/src/lib/godot-cpp b/src/lib/godot-cpp
index 1d5ef38..45aeb1c 160000
--- a/src/lib/godot-cpp
+++ b/src/lib/godot-cpp
@@ -1 +1 @@
-Subproject commit 1d5ef3878945b536b56ab1cfe3205363bf124ac6
+Subproject commit 45aeb1c69c72c915461cdf3473c7be882de62b90
diff --git a/src/register_types.cpp b/src/register_types.cpp
index 8eb9325..a659ed7 100644
--- a/src/register_types.cpp
+++ b/src/register_types.cpp
@@ -3,6 +3,7 @@
#include "config.hpp"
#include "geometry.hpp"
#include "geometry_dynamic.hpp"
+#include "godot_cpp/core/memory.hpp"
#include "listener.hpp"
#include "material.hpp"
#include "player.hpp"
@@ -16,6 +17,8 @@
using namespace godot;
+SteamAudioServer *srv;
+
void init_ext(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE && p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
return;
@@ -34,13 +37,15 @@ void init_ext(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
GDREGISTER_CLASS(SteamAudioServer);
- auto sa = memnew(SteamAudioServer);
+ srv = memnew(SteamAudioServer);
}
}
void uninit_ext(ModuleInitializationLevel p_level) {
- if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE && p_level != MODULE_INITIALIZATION_LEVEL_SERVERS) {
- return;
+ if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
+ // Should call this to not leak, but thread->wait_for_finish() crashes...
+ // the program is exiting anyway so I'm not too concerned
+ // memdelete(srv);
}
}
diff --git a/src/server.cpp b/src/server.cpp
index b7be93f..aab9fa3 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2,6 +2,7 @@
#include "godot_cpp/classes/engine.hpp"
#include "godot_cpp/classes/project_settings.hpp"
#include "godot_cpp/core/class_db.hpp"
+#include "godot_cpp/core/memory.hpp"
#include "godot_cpp/variant/callable_method_pointer.hpp"
#include "phonon.h"
#include "server_init.hpp"
@@ -208,7 +209,7 @@ GlobalSteamAudioState *SteamAudioServer::get_global_state(bool should_init) {
}
void SteamAudioServer::start_refl_sim() {
- refl_thread.start(callable_mp(this, &SteamAudioServer::run_refl_sim));
+ refl_thread->start(callable_mp(this, &SteamAudioServer::run_refl_sim));
}
void SteamAudioServer::run_refl_sim() {
@@ -290,11 +291,13 @@ SteamAudioServer::SteamAudioServer() {
is_refl_thread_processing.store(false);
is_running.store(true);
local_states_have_changed.store(false);
+ refl_thread = memnew(Thread);
}
SteamAudioServer::~SteamAudioServer() {
is_running.store(false);
- refl_thread.wait_to_finish();
+ refl_thread->wait_to_finish();
+ memdelete(refl_thread);
if (!self->is_global_state_init.load()) {
return;
diff --git a/src/server.hpp b/src/server.hpp
index 6421636..ef15603 100644
--- a/src/server.hpp
+++ b/src/server.hpp
@@ -32,12 +32,12 @@ class SteamAudioServer : public Object {
std::vector dynamic_meshes_to_add;
// TODO: allow for multiple
- SteamAudioListener *listener;
+ SteamAudioListener *listener = nullptr;
void init_scene(IPLSceneSettings *scene_cfg);
void start_refl_sim();
void run_refl_sim();
- Thread refl_thread = Thread();
+ Thread *refl_thread = nullptr;
protected:
static void _bind_methods();
diff --git a/src/stream.cpp b/src/stream.cpp
index 23eff02..6560674 100644
--- a/src/stream.cpp
+++ b/src/stream.cpp
@@ -67,7 +67,7 @@ int32_t SteamAudioStreamPlayback::_mix(AudioFrame *buffer, double rate_scale, in
return frames;
}
- PackedVector2Array mixed_frames = stream_playback->get_raw_audio(rate_scale, frames);
+ PackedVector2Array mixed_frames = stream_playback->mix_audio(rate_scale, frames);
frames = int(mixed_frames.size());
for (int i = 0; i < frames; i++) {