From 6bcc69d2038f0bacbbba2c3e24ed655799795df2 Mon Sep 17 00:00:00 2001 From: stechyo Date: Sat, 23 Nov 2024 09:19:21 +0000 Subject: [PATCH] Compat changes for 4.4. --- .gitmodules | 2 +- project/project.godot | 14 +++++++------- project/scenes/demo.tscn | 8 ++++---- src/lib/godot-cpp | 2 +- src/stream.cpp | 2 +- src/stream.hpp | 5 +---- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.gitmodules b/.gitmodules index b2e21d0..b110cfa 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 = 4.3-steam-audio + branch = master [submodule "src/lib/steamaudio"] path = src/lib/steamaudio url = https://github.com/ValveSoftware/steam-audio diff --git a/project/project.godot b/project/project.godot index 296c6d0..eec9eca 100644 --- a/project/project.godot +++ b/project/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="Godot-SteamAudio Demo" run/main_scene="res://scenes/demo.tscn" -config/features=PackedStringArray("4.3") +config/features=PackedStringArray("4.4") config/icon="res://icon.svg" [input] @@ -22,7 +22,7 @@ ui_left={ "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,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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={ @@ -30,7 +30,7 @@ ui_right={ "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,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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={ @@ -38,7 +38,7 @@ ui_up={ "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,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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={ @@ -46,16 +46,16 @@ ui_down={ "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,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"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 e13d7f0..6704cc3 100644 --- a/project/scenes/demo.tscn +++ b/project/scenes/demo.tscn @@ -112,8 +112,8 @@ tracks/1/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_b3x3w"] _data = { -"RESET": SubResource("Animation_elb2f"), -"fade": SubResource("Animation_8pkb1") +&"RESET": SubResource("Animation_elb2f"), +&"fade": SubResource("Animation_8pkb1") } [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v6p4c"] @@ -251,7 +251,7 @@ mesh = SubResource("SphereMesh_s7swq") [node name="AnimationPlayer" type="AnimationPlayer" parent="Wooden House with RandomStream/Pluck Randomizer"] libraries = { -"": SubResource("AnimationLibrary_b3x3w") +&"": SubResource("AnimationLibrary_b3x3w") } [node name="Door House" parent="." instance=ExtResource("3_tysju")] @@ -281,7 +281,7 @@ mesh = SubResource("SphereMesh_s7swq") [node name="AnimationPlayer" type="AnimationPlayer" parent="Door House/Pluck Randomizer"] libraries = { -"": SubResource("AnimationLibrary_b3x3w") +&"": SubResource("AnimationLibrary_b3x3w") } [node name="Door" type="MeshInstance3D" parent="Door House"] diff --git a/src/lib/godot-cpp b/src/lib/godot-cpp index 45aeb1c..c7661c7 160000 --- a/src/lib/godot-cpp +++ b/src/lib/godot-cpp @@ -1 +1 @@ -Subproject commit 45aeb1c69c72c915461cdf3473c7be882de62b90 +Subproject commit c7661c7839b762a44dad79dde92222f02ad81f19 diff --git a/src/stream.cpp b/src/stream.cpp index 88d5fe2..4581485 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -32,7 +32,7 @@ Ref SteamAudioStream::get_stream() { return this->stream; } SteamAudioStreamPlayback::SteamAudioStreamPlayback() {} SteamAudioStreamPlayback::~SteamAudioStreamPlayback() {} -int32_t SteamAudioStreamPlayback::_mix(AudioFrame *buffer, double rate_scale, int32_t frames) { +int32_t SteamAudioStreamPlayback::_mix(AudioFrame *buffer, float rate_scale, int32_t frames) { if (parent == nullptr) { return frames; } diff --git a/src/stream.hpp b/src/stream.hpp index 33021b1..16e608b 100644 --- a/src/stream.hpp +++ b/src/stream.hpp @@ -1,10 +1,8 @@ #ifndef STEAM_AUDIO_STREAM_H #define STEAM_AUDIO_STREAM_H -#include "godot_cpp/classes/node3d.hpp" #include "godot_cpp/classes/ref.hpp" #include "player.hpp" -#include "steam_audio.hpp" #include #include #include @@ -54,8 +52,7 @@ class SteamAudioStreamPlayback : public AudioStreamPlayback { void set_stream(Ref p_stream); Ref get_stream_playback(); - virtual int32_t _mix(AudioFrame *buffer, double rate_scale, - int32_t frames) override; + virtual int32_t _mix(AudioFrame *buffer, float rate_scale, int32_t frames) override; int play_stream(const Ref &p_stream, float p_from_offset, float p_volume_db, float p_pitch_scale); void _start(double from_pos) override;