diff --git a/README.md b/README.md index 527a23bddce4a409835a786e7bb9fdea4e8ad8a5..a40a3ead781b0ad9c929eb2551ac36cfddd66913 100644 --- a/README.md +++ b/README.md @@ -80,29 +80,44 @@ For a full working example, open the Godot project in the demo folder. - Install the following packages : - scons - Open a terminal and type the following commands : - - git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git - - cd gdpd - - git submodule update --init --recursive - - scons + +```sh +git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git +cd gdpd +git submodule update --init --recursive +scons +``` ## Cross-compiling for Windows on GNU/Linux - Install the following packages : - mingw-64 - Type the following commands : - - git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git - - cd gdpd - - git submodule update --init --recursive - - scons platform=windows + +```sh +git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git +cd gdpd +git submodule update --init --recursive +scons platform=windows +``` ## Compiling for Mac OSX todo -## Compiling for Android (/Quest) +## Compiling for Android (/Quest) on GNU/Linux + +- Define the ANDROID_HOME environment variable that contains the android ndk + folder +- Install the following packages : + - scons +- Open a terminal and type : ```sh +git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git +cd gdpd +git submodule update --init --recursive scons platform=android ``` diff --git a/demo/Main.tscn b/demo/Main.tscn index 810ce477b0a1883d9e949d9c95ca2ea3c2ab72d0..dd3ecf60f4e091218b2aaa2d0d9e81067694af8c 100644 --- a/demo/Main.tscn +++ b/demo/Main.tscn @@ -16,13 +16,23 @@ func _process(delta): print(\"got message from pd \", msg) pass -func _load_patch(pd_patch) : +func _load_patch(pd_patch : String) : + var fullpath = \"\" + if OS.has_feature(\"editor\"): + fullpath = ProjectSettings.globalize_path(pd_patch) + else: + fullpath = OS.get_executable_path().get_base_dir().path_join(pd_patch.lstrip(\"res://\")) + #fullpath = pd_patch + #print(DirAccess.get_files_at(\"res://\")) + + print(fullpath) + # separate file name from directory - var patch_name = pd_patch.split(\"/\")[-1] - var patch_dir = pd_patch.trim_suffix(patch_name) + var patch_name = fullpath.split(\"/\")[-1] + var patch_dir = fullpath.trim_suffix(patch_name) # load patch - _gdpd.openfile(patch_name, patch_dir) + _gdpd.openfile(patch_name, \"./\") func _on_Start_pressed() : # retrieve the list of available input and outputs @@ -33,8 +43,8 @@ func _on_Start_pressed() : _gdpd.init_devices(inps[0], outs[0]) # the patch path should be absolute - _load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\")) - _load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\")) + _load_patch(\"res://patch1.pd\") + _load_patch(\"res://patch2.pd\") # send message to [receive from_godot] with one symbol _gdpd.start_message(1) @@ -50,8 +60,8 @@ func _on_start_non_rt_pressed(): _gdpd.init_nort() # the patch path should be absolute - _load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\")) - _load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\")) + _load_patch(\"res://patch1.pd\") + _load_patch(\"res://patch2.pd\") # send message to [receive from_godot] with one symbol _gdpd.start_message(1) @@ -80,8 +90,6 @@ func _on_HSlider2_value_changed(value): _gdpd.add_symbol(\"pitch\") _gdpd.add_float(value) _gdpd.finish_list(\"from_godot\") - - " [node name="Control" type="Control"] diff --git a/demo/patch1.pd b/demo/patch1.pd index 30acf1a8d97430581802ad5ec65b61388a90ae1f..82d8b965ff63eba8b115f18be8216809c79ee721 100644 Binary files a/demo/patch1.pd and b/demo/patch1.pd differ diff --git a/demo/project.godot b/demo/project.godot index c1177ea0e708664e8247b0e61c0e13eed3862e40..f1d685070a54afedab01fe3d1321f9546232ebac 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -12,12 +12,13 @@ config_version=5 config/name="GdPd" run/main_scene="res://Main.tscn" -config/features=PackedStringArray("4.2") +config/features=PackedStringArray("4.3") run/low_processor_mode=true config/icon="res://icon.png" [rendering] +textures/vram_compression/import_etc2_astc=true environment/defaults/default_environment="res://default_env.tres" quality/driver/driver_name="GLES2" vram_compression/import_etc=true diff --git a/src/gdpd.cpp b/src/gdpd.cpp index aae9f73dfe9545a101ab79f7a5bd805003093ae2..e5dd8aa6d4cc62b9b7c0edecfda8fa084d0cbfa6 100644 --- a/src/gdpd.cpp +++ b/src/gdpd.cpp @@ -158,11 +158,10 @@ int GdPd::init_nort() { m_init=true; // Create stream player - AudioStreamPlayer* p = new AudioStreamPlayer(); + AudioStreamPlayer* p = memnew(AudioStreamPlayer()); add_child(p); - Ref<GdPdStream> s; - s.instantiate(); + Ref<GdPdStream> s = memnew(GdPdStream()); s->setGdPd(this); p->set_stream(s); @@ -360,8 +359,8 @@ GdPdStream::GdPdStream() { } Ref<AudioStreamPlayback> GdPdStream::_instantiate_playback() const { - Ref<GdPdStreamPlayback> gdPlayback; - gdPlayback.instantiate(); + Ref<GdPdStreamPlayback> gdPlayback = memnew(GdPdStreamPlayback()); + //gdPlayback.instantiate(); gdPlayback->m_base = Ref<GdPdStream>(this); return gdPlayback; } @@ -392,6 +391,6 @@ int32_t GdPdStreamPlayback::_mix_resampled(AudioFrame *buffer, return nbFrames; } -double GdPdStreamPlayback::_get_stream_sampling_rate() const { +float GdPdStreamPlayback::_get_stream_sampling_rate() const { return AudioServer::get_singleton()->get_mix_rate(); } diff --git a/src/gdpd.h b/src/gdpd.h index c1698930eb4e5c34cb25c3c405ac9f06ee7f5c6c..90e8d590b86979cb732ee61c7c101b14fe9e4900 100644 --- a/src/gdpd.h +++ b/src/gdpd.h @@ -158,7 +158,7 @@ public: ~GdPdStreamPlayback(); int32_t _mix_resampled(AudioFrame *dst_buffer, int32_t frame_count) override; - double _get_stream_sampling_rate() const override; + float _get_stream_sampling_rate() const override; bool _is_playing() const override {return active;} void _start(double from_pos) override {active=true;} diff --git a/src/godot-cpp b/src/godot-cpp index 98c143a48365f3f3bf5f99d6289a2cb25e6472d1..1cce4d15abc3afb22724f9bf083ed7769330b43e 160000 --- a/src/godot-cpp +++ b/src/godot-cpp @@ -1 +1 @@ -Subproject commit 98c143a48365f3f3bf5f99d6289a2cb25e6472d1 +Subproject commit 1cce4d15abc3afb22724f9bf083ed7769330b43e diff --git a/src/rtaudio/RtAudio.os b/src/rtaudio/RtAudio.os index 1ec3e45a8b107c72164645ecd3c180df9bc90664..878497f7ee40775d7ea2c760d1f7ffbf11e63e0a 100644 Binary files a/src/rtaudio/RtAudio.os and b/src/rtaudio/RtAudio.os differ