diff --git a/README.md b/README.md index a9ec8098befc7b8ac9a2ecb57cd6052c0d49819e..43579cd2f3c91dd7dee0ff0d714c1ac47cd96acd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,70 @@ # gdpd -Godot add-on for loading and processing Pure Data patches +gdpd is a Godot add-on for loading and processing Pure Data patches. + +# Using + +In a script, + +1. Initalize gdpd + +```python +onready var gdpd = load("res://addons/gdpd/bin/gdpd.gdns").new() +``` + +2. Initialize the audio inputs and outputs + +```python +#retrieve the list of available input and outputs +var inps = _gdpd.get_available_input_devices() +var outs = _gdpd.get_available_output_devices() + +#initialise the first ones +_gdpd.init_devices(inps[0], outs[0]) +``` + +4. Load a patch + +```python +var patch = ProjectSettings.globalize_path("res://patch.pd") + +var patch_name = patch.split("/")[-1] +var patch_dir = patch.trim_suffix(patch_name) + +gdpd.openfile(patch_name, patch_dir) +``` + +5. Send a message to the patch + +```python +#send message to [receive from_godot] with one symbol +_gdpd.start_message(1) +_gdpd.add_symbol("hello") +_gdpd.finish_list("from_godot") +``` + +6. Subscribe and receive messages from the patch + +```python +func _ready : + #listen to messages sent with [send to_godot] + _gdpd.subscribe("to_godot") + + +func _process : + while _gdpd.has_message() : + #msg is an array with the list of symbols/floats sent to to_godot + var msg = _gdpd.get_next() + print("got message from pd ", msg) +``` + + +For a full working example, open the Godot project in the demo folder. # Compiling -## Compiling on GNU/Linux +## Compiling for GNU/Linux - Install the following packages : - scons @@ -14,16 +73,17 @@ Godot add-on for loading and processing Pure Data patches - cd gdpd - ./update.sh linux -## Compiling on Windows +## Cross-compiling for Windows on GNU/Linux -- Open the Windows Powershell +- Install the following packages : + - mingw-64 - Type the following commands : - git clone https://gitlab.univ-lille.fr/ivmi/gdpd.git - cd gdpd - ./update.sh windows -## Compiling on Mac OSX +## Compiling for Mac OSX ## Compiling for Android (/ Oculus Quest) diff --git a/SConstruct b/SConstruct index a7076dd7583cbe8156ace4527eb728bf64c89b14..e223cea9dc19b7353134daabe6872374e93a8a4a 100644 --- a/SConstruct +++ b/SConstruct @@ -10,9 +10,9 @@ env = Environment(ENV = os.environ) opts.Add(EnumVariable('target', "Compilation target", 'release', ['d', 'debug', 'r', 'release'])) opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx'])) opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx'])) -opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) +opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'yes')) opts.Add(BoolVariable('use_mingw', "Use the MingW for cross-compiling", 'no')) -opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'GdpdExample/addons/gdpd/bin/')) +opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'demo/addons/gdpd/bin/')) opts.Add(PathVariable('target_name', 'The library name.', 'libgdpd', PathVariable.PathAccept)) # Local dependency paths, adapt them to your setup diff --git a/demo/project.godot b/demo/project.godot index 1daf32513ea13ea5cd4b3482417820a0bd9c6849..7ad6ab0d873eb848fbed384952c6683aaff2acea 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -14,7 +14,7 @@ _global_script_class_icons={ [application] -config/name="GdpdExample" +config/name="GdPd" run/main_scene="res://Main.tscn" run/low_processor_mode=true config/icon="res://icon.png" diff --git a/src/rtaudio/RtAudio.os b/src/rtaudio/RtAudio.os index 7da86472b3334fa616dd67ddc74050896c89bd0d..0b9b2a139f8fa92fbdef5de69509e3323e993406 100644 Binary files a/src/rtaudio/RtAudio.os and b/src/rtaudio/RtAudio.os differ diff --git a/update.sh b/update.sh index bc4883808013ce976ea9b2a604523f2ba52d7258..0dc54b3ae8bbdb793715a7a074df70f96cfa27fa 100755 --- a/update.sh +++ b/update.sh @@ -2,6 +2,6 @@ git config --global url."https://".insteadOf git:// git submodule update --init --recursive cd src/godot-cpp -scons platform=$1 generate_bindings=yes target=release +scons platform=$1 generate_bindings=yes target=release use_mingw=yes cd ../.. -scons platform=$1 target=release +scons platform=$1 target=release use_mingw=yes