Commit 24051ef4 authored by BERTHAUT Florent's avatar BERTHAUT Florent
Browse files

Changed to single libpd

parent cacb0f5f
......@@ -4,17 +4,10 @@
script/source = "extends Control
var gdpd = load(\"res://addons/gdpd/bin/gdpd.gdns\")
var patch
#var patch
func _ready():
#initialize pd
patch = gdpd.new()
#retrieve
var inps = patch.get_available_input_devices()
var outs = patch.get_available_output_devices()
patch.init_devices(inps[0], outs[0])
#the patch path should be the absolute one
_load_patch(ProjectSettings.globalize_path(\"res://patch1.pd\"))
_load_patch(ProjectSettings.globalize_path(\"res://patch2.pd\"))
......@@ -25,6 +18,15 @@ func _load_patch(pd_patch) :
var patch_name = pd_patch.split(\"/\")[-1]
var patch_dir = pd_patch.trim_suffix(patch_name)
#initialize pd
var patch = gdpd.new()
#retrieve
var inps = patch.get_available_input_devices()
var outs = patch.get_available_output_devices()
patch.init_devices(inps[0], outs[0])
#load patch
patch.openfile(patch_name, patch_dir)
"
......
[general]
singleton=false
load_once=true
load_once=false
symbol_prefix="godot_"
reloadable=true
......@@ -13,6 +13,6 @@ OSX.64="res://addons/gdpd/bin/osx/libgdpd.dylib"
[dependencies]
X11.64=[]
X11.64=[ ]
Windows.64=[ ]
OSX.64=[ ]
......@@ -156,7 +156,7 @@ int Gdpd::start() {
void Gdpd::stop() {
m_audio.stopStream();
m_audio.closeStream();
m_pd.closePatch(m_patch);
m_pd.clear();
m_pd.computeAudio(false);
print("Stopped");
}
......@@ -181,13 +181,16 @@ void Gdpd::openfile(godot::String baseStr, godot::String dirStr) {
std::string dirS(dirWs.begin(), dirWs.end());
//libpd_openfile(baseS.c_str(), dirS.c_str());
m_patch = m_pd.openPatch(baseS.c_str(), dirS.c_str());
//m_patch = m_pd.openPatch(baseS.c_str(), dirS.c_str());
m_pd.openPatch(baseS.c_str(), dirS.c_str());
print("Opened patch");
}
void Gdpd::closefile() {
m_pd.closePatch(m_patch);
void Gdpd::closefile(godot::String baseStr) {
std::wstring baseWs = baseStr.unicode_str();
std::string baseS(baseWs.begin(), baseWs.end());
m_pd.closePatch(baseS.c_str());
}
void Gdpd::subscribe(String symbStr) {
......
......@@ -48,7 +48,7 @@ public:
int start();
void stop();
void openfile(String basename, String dirname);
void closefile();
void closefile(String basename);
bool has_message();
Array get_next();
int blocksize();
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment