From 44aa02db69853451e58827f33137f7da953ecda8 Mon Sep 17 00:00:00 2001 From: Florent Berthaut <florent.berthaut@univ-lille.fr> Date: Tue, 2 Jan 2024 00:53:35 +0100 Subject: [PATCH] Add return for opening file --- SConstruct | 9 +++++++++ src/gdpd.cpp | 7 ++++--- src/gdpd.h | 2 +- src/rtaudio/RtAudio.os | Bin 74776 -> 74776 bytes 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 1a43d50..a304607 100644 --- a/SConstruct +++ b/SConstruct @@ -91,8 +91,17 @@ if env["platform"] == "linux": '-fPIC', '-O3', '-ffast-math', '-funroll-loops', '-fomit-frame-pointer']) env.Append(CXXFLAGS=['-std=c++17']) +elif env["platform"] == "android": + env.Append(CPPDEFINES=['__UNSPECIFIED__', 'HAVE_LIBDL']) + env.Append(CFLAGS=['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast', + '-Wno-discarded-qualifiers', + '-fPIC', '-O3', '-ffast-math', '-funroll-loops', + '-fomit-frame-pointer']) + env.Append(CXXFLAGS=['-std=c++17']) elif env["platform"] == "windows": env.Append(CPPDEFINES=['NOMINMAX', '__WINDOWS_DS__', 'PD_INTERNAL']) +elif env["platform"] == "macos": + env.Append(CPPDEFINES=['NOMINMAX', '__MACOSX_CORE__', 'PD_INTERNAL']) if env["platform"] == "macos": library = env.SharedLibrary( diff --git a/src/gdpd.cpp b/src/gdpd.cpp index 91ee7b0..40481db 100644 --- a/src/gdpd.cpp +++ b/src/gdpd.cpp @@ -97,7 +97,6 @@ int GdPd::init_devices(String inputDevice, String outputDevice) { std::string inpStr(inputDevice.utf8().get_data()); std::string outStr(outputDevice.utf8().get_data()); - for(int d=0; d<m_audio.getDeviceCount(); d++) { std::string n = m_audio.getDeviceInfo(d).name; if(n.compare(inpStr)==0) { @@ -202,23 +201,25 @@ void GdPd::processAudio(void *outputBuffer, void *inputBuffer, } } -void GdPd::openfile(godot::String baseStr, godot::String dirStr) { +bool GdPd::openfile(godot::String baseStr, godot::String dirStr) { std::string baseS(baseStr.utf8().get_data()); std::string dirS(dirStr.utf8().get_data()); if(m_patchsMap.find(baseS)!=m_patchsMap.end()) { print("Patch "+baseS+" already opened"); - return; + return true; } pd::Patch p1 = m_pd.openPatch(baseS.c_str(), dirS.c_str()); if(!p1.isValid()) { print("Could not open patch "+baseS); + return false; } else { print("Opened patch "+baseS); m_patchsMap[baseS] = p1; } + return true; } void GdPd::closefile(godot::String baseStr) { diff --git a/src/gdpd.h b/src/gdpd.h index bde2e85..d3c491d 100644 --- a/src/gdpd.h +++ b/src/gdpd.h @@ -76,7 +76,7 @@ public: int init(int nbInputs, int nbOutputs, int sampleRate, int bufferSize); int start(); void stop(); - void openfile(String basename, String dirname); + bool openfile(String basename, String dirname); void closefile(String basename); bool has_message(); Array get_next(); diff --git a/src/rtaudio/RtAudio.os b/src/rtaudio/RtAudio.os index a5bc4699ab088cd25dc56c9930a9e76e7e118ffb..4dd83fb517790ff7e696d80faeef48fc2feb7ed5 100644 GIT binary patch delta 16 YcmbPnf@Q`DmJPMVjOLr`if3&A06(S&j{pDw delta 16 YcmbPnf@Q`DmJPMVjHa9Gif3&A06&@sjQ{`u -- GitLab