diff --git a/src/gdpd.cpp b/src/gdpd.cpp index 2d09a81045be73f85be1d1e6d4a5d47d585ecaee..ceef2acb018e1dff70ba0732f7bee3ca616543ad 100644 --- a/src/gdpd.cpp +++ b/src/gdpd.cpp @@ -413,7 +413,7 @@ bool GdPd::open_patch() { std::string pdPatchStr; std::string pdDirStr; - /* + //If opening from editor, just set the paths if(OS::get_singleton()->has_feature("editor")) { print("Loading patch from editor"); String fullpath = ProjectSettings::get_singleton() @@ -427,7 +427,8 @@ bool GdPd::open_patch() { pdPatchStr = std::string(pat.utf8().get_data()); pdDirStr = std::string(dir.utf8().get_data()); } - else {*/ + else { + // Otherwise, copy the files to user folder print("Loading patch from package"); String userPath; @@ -457,14 +458,15 @@ bool GdPd::open_patch() { std::vector<String> gdpdFiles{"gdpd.pd", "gdpd_send.pd", "gdpd_receive.pd"}; for(auto& f : gdpdFiles) { - DirAccess::copy_absolute("res://addons/gdpd/patches/"+f, - userPath+patchDir+"/"+f); + Ref<DirAccess> diracc = DirAccess::open("res://"); + diracc->copy("res://addons/gdpd/patches/"+f, + userPath+patchDir+"/"+f); } //Define new paths pdPatchStr = std::string(patch.utf8().get_data()); pdDirStr = std::string((userPath+patchDir).utf8().get_data()); - //} + } // Open the patch @@ -477,6 +479,8 @@ bool GdPd::open_patch() { else { print("Opened patch "+pdPatchStr); m_patchOpened=true; + std::string patchStr(pd_patch.utf8().get_data()); + m_patchsMap[patchStr] = p1; } return true; } @@ -490,28 +494,29 @@ void GdPd::recurseCopy(String fromPath, String toPath) { PackedStringArray files = DirAccess::get_files_at(fromPath); for(int i=0; i<files.size(); ++i) { String fileName = files[i]; - print("File "+std::string(fileName.utf8().get_data())); - DirAccess::copy_absolute(fromPath+"/"+fileName, - toPath+"/"+fileName); + Ref<DirAccess> diracc = DirAccess::open("res://"); + diracc->copy(fromPath+"/"+fileName, toPath+"/"+fileName); + print("Copying "+ std::string(fileName.utf8().get_data())); } //For each dir, call recursCopy PackedStringArray dirs = DirAccess::get_directories_at(fromPath); for(int i=0; i<dirs.size(); ++i) { String dirName = dirs[i]; - print("Dir "+std::string(dirName.utf8().get_data())); + recurseCopy(fromPath+"/"+dirName, toPath+"/"+dirName); } } void GdPd::close_patch() { - /* - std::string patchStr(patch.utf8().get_data()); + //FIXME handle multiple patches + std::string patchStr(pd_patch.utf8().get_data()); if(m_patchsMap.find(patchStr)!=m_patchsMap.end()) { m_pd.closePatch(m_patchsMap[patchStr]); m_patchsMap.erase(patchStr); + m_patchOpened=false; print("Closed patch "+patchStr); - }*/ + } } void GdPd::print(const std::string& message) { diff --git a/src/gdpd.h b/src/gdpd.h index 7f0c7a2d698a0380dd8e04a7d111681e14770af4..4d8b67e371c6fc81b719e2e88b1a334550e6d5b6 100644 --- a/src/gdpd.h +++ b/src/gdpd.h @@ -141,17 +141,6 @@ public: void send(String destination, Array arguments); - /* - bool has_message(); - Array get_next(); - int blocksize(); - void subscribe(String symbStr); - int start_message(int nbValues); - void add_symbol(String symbStr); - void add_float(float val); - int finish_list(String destStr); - */ - virtual void print(const std::string& message); //libpd hooks diff --git a/src/rtaudio/RtAudio.os b/src/rtaudio/RtAudio.os index 878497f7ee40775d7ea2c760d1f7ffbf11e63e0a..1ec3e45a8b107c72164645ecd3c180df9bc90664 100644 Binary files a/src/rtaudio/RtAudio.os and b/src/rtaudio/RtAudio.os differ