commit 14dd9cf33883eb0238aba0427f5adea0ebe5fadf
parent 195de5fe4ce3bdd103fc154e5748e738c7a069e6
Author: fundamental <[email protected]>
Date: Wed, 20 Jul 2016 16:06:05 -0400
Add Changes Needed For Mingw Build
Diffstat:
20 files changed, 177 insertions(+), 45 deletions(-)
diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake
@@ -0,0 +1,17 @@
+#Find FFTW
+
+find_path(FFTW_INCLUDE_DIR
+ NAMES fftw3.h
+ PATHS ${FFTW_INCLUDE_DIRS}
+ )
+
+find_library(FFTW_LIBRARIES
+ NAMES fftw3
+ PATHS ${FFTW_LIBRARY_DIRS}
+ )
+
+set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR)
+set(FFTW_PROCESS_LIBS FFTW_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW DEFAULT_MSG
+ FFTW_INCLUDE_DIR FFTW_LIBRARIES)
diff --git a/cmake/FindLIBLO.cmake b/cmake/FindLIBLO.cmake
@@ -0,0 +1,17 @@
+#Find Lo
+
+find_path(LIBLO_INCLUDE_DIR
+ NAMES lo/lo.h
+ PATHS ${LIBLO_INCLUDE_DIRS}
+ )
+
+find_library(LIBLO_LIBRARIES
+ NAMES lo
+ PATHS ${LIBLO_LIBRARY_DIRS}
+ )
+
+set(LIBLO_PROCESS_INCLUDES LIBLO_INCLUDE_DIR)
+set(LIBLO_PROCESS_LIBS LIBLO_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLO DEFAULT_MSG
+ LIBLO_INCLUDE_DIR LIBLO_LIBRARIES)
diff --git a/cmake/FindMXML.cmake b/cmake/FindMXML.cmake
@@ -0,0 +1,17 @@
+#Find MXML
+
+find_path(MXML_INCLUDE_DIR
+ NAMES mxml.h
+ PATHS ${MXML_INCLUDE_DIRS}
+ )
+
+find_library(MXML_LIBRARIES
+ NAMES mxml
+ PATHS ${MXML_LIBRARY_DIRS}
+ )
+
+set(MXML_PROCESS_INCLUDES MXML_INCLUDE_DIR)
+set(MXML_PROCESS_LIBS MXML_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MXML DEFAULT_MSG
+ MXML_INCLUDE_DIR MXML_LIBRARIES)
diff --git a/cmake/FindPA.cmake b/cmake/FindPA.cmake
@@ -0,0 +1,17 @@
+#Find FFTW
+
+find_path(FFTW_INCLUDE_DIR
+ NAMES fftw3.h
+ PATHS ${FFTW_INCLUDE_DIRS}
+ )
+
+find_library(FFTW_LIBRARIES
+ NAMES fftw3
+ PATHS ${FFTW_LIBRARY_DIRS}
+ )
+
+set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR)
+set(FFTW_PROCESS_LIBS FFTW_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW DEFAULT_MSG
+ FFTW_INCLUDE_DIR FFTW_LIBRARIES)
diff --git a/cmake/FindPORTAUDIO.cmake b/cmake/FindPORTAUDIO.cmake
@@ -0,0 +1,15 @@
+#Find PORTAUDIO
+
+find_path(PORTAUDIO_INCLUDE_DIR
+ NAMES portaudio.h
+ PATHS ${PORTAUDIO_INCLUDE_DIRS}
+ )
+
+find_library(PORTAUDIO_LIBRARIES
+ NAMES portaudio
+ PATHS ${PORTAUDIO_LIBRARY_DIRS}
+ )
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG
+ PORTAUDIO_INCLUDE_DIR PORTAUDIO_LIBRARIES)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -7,20 +7,24 @@ include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(CheckCXXCompilerFlag)
-find_package(PkgConfig REQUIRED)
+if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
+ find_package(PkgConfig)
+endif()
find_package(zlib REQUIRED)
find_package(X11)
check_include_file(X11/xpm.h HAS_XPM)
-pkg_check_modules(FFTW REQUIRED fftw3)
-pkg_check_modules(MXML REQUIRED mxml)
+find_package(FFTW REQUIRED)
+find_package(MXML REQUIRED)
+find_package(LIBLO REQUIRED)
find_package(Threads REQUIRED)
find_package(OSS)
find_package(Alsa)
-pkg_check_modules(JACK jack)
-pkg_check_modules(PORTAUDIO portaudio-2.0>=19)
-set(FLTK_SKIP_OPENGL true)
-pkg_check_modules(NTK ntk)
-pkg_check_modules(NTK_IMAGES ntk_images)
+#pkg_check_modules(JACK jack)
+find_package(PORTAUDIO)
+#pkg_check_modules(PORTAUDIO portaudio-2.0>=19)
+#set(FLTK_SKIP_OPENGL true)
+#pkg_check_modules(NTK ntk)
+#pkg_check_modules(NTK_IMAGES ntk_images)
find_package(FLTK)
find_package(OpenGL) #for FLTK
find_package(CxxTest)
@@ -28,12 +32,15 @@ if(CXXTEST_FOUND)
set(CXXTEST_USE_PYTHON TRUE)
endif()
# lash
-pkg_search_module(LASH lash-1.0)
-mark_as_advanced(LASH_LIBRARIES)
-pkg_search_module(DSSI dssi>=0.9.0)
-mark_as_advanced(DSSI_LIBRARIES)
-pkg_search_module(LIBLO liblo>=0.26 REQUIRED)
-mark_as_advanced(LIBLO_LIBRARIES)
+if(PkgConfig_FOUND AND NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
+message("Looking For pkg config modules")
+ pkg_search_module(LASH lash-1.0)
+ mark_as_advanced(LASH_LIBRARIES)
+ pkg_search_module(DSSI dssi>=0.9.0)
+ mark_as_advanced(DSSI_LIBRARIES)
+ pkg_search_module(LIBLO liblo>=0.26 REQUIRED)
+ mark_as_advanced(LIBLO_LIBRARIES)
+endif()
CHECK_FUNCTION_EXISTS(sched_setscheduler HAVE_SCHEDULER)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
@@ -88,6 +95,7 @@ SET (PluginLibDir "lib" CACHE STRING
# Add version information
add_definitions(-DVERSION="${VERSION}")
+add_definitions(-static)
if(NOT "Darwin" STREQUAL ${CMAKE_SYSTEM_NAME})
# Add scheduler function existance info (OSX compatiability)
@@ -273,7 +281,9 @@ else (BuildForDebug)
message (STATUS "Building for ${CMAKE_BUILD_TYPE}, flags: ${CMAKE_CXX_FLAGS_RELEASE}")
endif (BuildForDebug)
-add_definitions(-fPIC)
+if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
+ add_definitions(-fPIC)
+endif()
if(FLTK_FOUND)
mark_as_advanced(FORCE FLTK_BASE_LIBRARY)
@@ -406,7 +416,7 @@ target_link_libraries(zynaddsubfx_core
${FFTW_LIBRARIES}
${MXML_LIBRARIES}
${OS_LIBRARIES}
- pthread
+winpthread
rtosc rtosc-cpp)
if(CompileTests)
@@ -425,7 +435,10 @@ target_link_libraries(zynaddsubfx
${GUI_LIBRARIES}
${NIO_LIBRARIES}
${AUDIO_LIBRARIES}
- )
+ ws2_32
+ wsock32
+ "-static" iphlpapi
+ "-static" winpthread)
if (DssiEnable)
add_library(zynaddsubfx_dssi SHARED
diff --git a/src/DSP/SVFilter.cpp b/src/DSP/SVFilter.cpp
@@ -18,6 +18,7 @@
#include "../Misc/Util.h"
#include "SVFilter.h"
+#define errx(...)
#ifndef errx
#include <err.h>
#endif
diff --git a/src/DSP/Unison.cpp b/src/DSP/Unison.cpp
@@ -18,6 +18,8 @@
#include "Unison.h"
#include "globals.h"
+#define errx(...)
+#define warnx(...)
#ifndef errx
#include <err.h>
#endif
diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp
@@ -79,7 +79,7 @@ static const rtosc::Ports local_ports = {
//update parameters as well
strncpy(loc, d.loc, 1024);
- char *tail = rindex(loc, '/');
+ char *tail = strrchr(loc, '/');
if(!tail)
return;
for(int i=0;i<128;++i) {
diff --git a/src/Misc/BankDb.cpp b/src/Misc/BankDb.cpp
@@ -16,7 +16,8 @@ BankEntry::BankEntry(void)
bool sfind(std::string hay, std::string needle)
{
- return strcasestr(hay.c_str(), needle.c_str());
+ //return strcasestr(hay.c_str(), needle.c_str());
+ return false;
}
bool BankEntry::match(string s) const
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -21,6 +21,7 @@
#include <rtosc/undo-history.h>
#include <rtosc/thread-link.h>
#include <rtosc/ports.h>
+#define WIN32
#include <lo/lo.h>
#include <unistd.h>
@@ -49,6 +50,8 @@
#include <atomic>
#include <list>
+#define errx(...)
+#define warnx(...)
#ifndef errx
#include <err.h>
#endif
@@ -148,7 +151,7 @@ static int handler_function(const char *path, const char *types, lo_arg **argv,
lo_message_serialise(msg, path, buffer, &size);
if(!strcmp(buffer, "/path-search") && !strcmp("ss", rtosc_argument_string(buffer))) {
path_search(buffer, mw->activeUrl().c_str());
- } else if(buffer[0]=='/' && rindex(buffer, '/')[1]) {
+ } else if(buffer[0]=='/' && strrchr(buffer, '/')[1]) {
mw->transmitMsg(rtosc::Ports::collapsePath(buffer));
}
@@ -489,7 +492,7 @@ public:
assert(actual_load[npart] <= pending_load[npart]);
//load part in async fashion when possible
-#if HAVE_ASYNC
+#if 0
auto alloc = std::async(std::launch::async,
[master,filename,this,npart](){
Part *p = new Part(*master->memory, synth,
@@ -1604,7 +1607,7 @@ void MiddleWareImpl::kitEnable(int part, int kit, int type)
void MiddleWareImpl::handleMsg(const char *msg)
{
//Check for known bugs
- assert(msg && *msg && rindex(msg, '/')[1]);
+ assert(msg && *msg && strrchr(msg, '/')[1]);
assert(strstr(msg,"free") == NULL || strstr(rtosc_argument_string(msg), "b") == NULL);
assert(strcmp(msg, "/part0/Psysefxvol"));
assert(strcmp(msg, "/Penabled"));
@@ -1619,7 +1622,7 @@ void MiddleWareImpl::handleMsg(const char *msg)
fprintf(stdout, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40);
}
- const char *last_path = rindex(msg, '/');
+ const char *last_path = strrchr(msg, '/');
if(!last_path) {
printf("Bad message in handleMsg() <%s>\n", msg);
assert(false);
diff --git a/src/Misc/Schema.cpp b/src/Misc/Schema.cpp
@@ -168,7 +168,7 @@ void dump_param_cb(const rtosc::Port *p, const char *full_name, void *v)
const char *max = meta["max"];
for(auto m:meta) {
- if(strlen(m.title) >= 5 && !bcmp(m.title, "map ", 4)) {
+ if(strlen(m.title) >= 5 && !memcmp(m.title, "map ", 4)) {
int id = atoi(m.title+4);
std::string val = m.value;
options.push_back(std::make_pair(id, val));
diff --git a/src/Misc/Util.cpp b/src/Misc/Util.cpp
@@ -29,6 +29,7 @@
#include <sched.h>
#endif
+#define errx(...)
#ifndef errx
#include <err.h>
#endif
diff --git a/src/Plugin/CMakeLists.txt b/src/Plugin/CMakeLists.txt
@@ -5,8 +5,6 @@ CHECK_LIBRARY_EXISTS(dl dlopen "" LIBDL_FOUND)
IF(LIBDL_FOUND)
target_link_libraries(lv2-ttl-generator "dl")
-ENDIF(LIBDL_FOUND)
-
add_subdirectory(AlienWah)
add_subdirectory(Chorus)
add_subdirectory(Distortion)
@@ -14,4 +12,6 @@ add_subdirectory(DynamicFilter)
add_subdirectory(Echo)
add_subdirectory(Phaser)
add_subdirectory(Reverb)
+ENDIF(LIBDL_FOUND)
+
add_subdirectory(ZynAddSubFX)
diff --git a/src/Plugin/ZynAddSubFX/CMakeLists.txt b/src/Plugin/ZynAddSubFX/CMakeLists.txt
@@ -66,18 +66,26 @@ set_target_properties(ZynAddSubFX_lv2 PROPERTIES PREFIX "")
set_target_properties(ZynAddSubFX_vst PROPERTIES COMPILE_DEFINITIONS "DISTRHO_PLUGIN_TARGET_VST")
set_target_properties(ZynAddSubFX_vst PROPERTIES LIBRARY_OUTPUT_DIRECTORY "vst")
-set_target_properties(ZynAddSubFX_vst PROPERTIES OUTPUT_NAME "ZynAddSubFX")
+#set_target_properties(ZynAddSubFX_vst PROPERTIES OUTPUT_NAME "ZynAddSubFX")
set_target_properties(ZynAddSubFX_vst PROPERTIES PREFIX "")
-target_link_libraries(ZynAddSubFX_lv2 zynaddsubfx_core ${OS_LIBRARIES} ${LIBLO_LIBRARIES})
-target_link_libraries(ZynAddSubFX_vst zynaddsubfx_core ${OS_LIBRARIES} ${LIBLO_LIBRARIES})
-
-install(TARGETS ZynAddSubFX_lv2 LIBRARY DESTINATION ${PluginLibDir}/lv2/ZynAddSubFX.lv2/)
-install(TARGETS ZynAddSubFX_vst LIBRARY DESTINATION ${PluginLibDir}/vst/)
-
-add_custom_command(TARGET ZynAddSubFX_lv2 POST_BUILD
- COMMAND ../../lv2-ttl-generator $<TARGET_FILE:ZynAddSubFX_lv2>
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lv2)
+target_link_libraries(ZynAddSubFX_lv2 zynaddsubfx_core ${OS_LIBRARIES} ${LIBLO_LIBRARIES}
+ ws2_32
+ wsock32
+ "-static" iphlpapi
+ "-static" winpthread)
+target_link_libraries(ZynAddSubFX_vst zynaddsubfx_core ${OS_LIBRARIES} ${LIBLO_LIBRARIES}
+ ws2_32
+ wsock32
+ "-static" iphlpapi
+ "-static" winpthread)
+
+#install(TARGETS ZynAddSubFX_lv2 LIBRARY DESTINATION ${PluginLibDir}/lv2/ZynAddSubFX.lv2/)
+#install(TARGETS ZynAddSubFX_vst LIBRARY DESTINATION ${PluginLibDir}/vst/)
+
+#add_custom_command(TARGET ZynAddSubFX_lv2 POST_BUILD
+# COMMAND ../../lv2-ttl-generator $<TARGET_FILE:ZynAddSubFX_lv2>
+# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lv2)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lv2/manifest.ttl
diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp
@@ -27,8 +27,6 @@
#include <rtosc/ports.h>
#include <rtosc/port-sugar.h>
-pthread_t main_thread;
-
#define rObject OscilGen
const rtosc::Ports OscilGen::non_realtime_ports = {
rSelf(OscilGen),
@@ -96,7 +94,7 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
phase = rtosc_argument(m,0).i;
//XXX hack hack
char *repath = strdup(d.loc);
- char *edit = rindex(repath, '/')+1;
+ char *edit = strrchr(repath, '/')+1;
strcpy(edit, "prepare");
OscilGen &o = *((OscilGen*)d.obj);
fft_t *data = new fft_t[o.synth.oscilsize / 2];
@@ -120,7 +118,7 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
//printf("setting magnitude\n\n");
//XXX hack hack
char *repath = strdup(d.loc);
- char *edit = rindex(repath, '/')+1;
+ char *edit = strrchr(repath, '/')+1;
strcpy(edit, "prepare");
OscilGen &o = *((OscilGen*)d.obj);
fft_t *data = new fft_t[o.synth.oscilsize / 2];
@@ -228,6 +226,10 @@ const rtosc::MergePorts OscilGen::ports{
&OscilGen::non_realtime_ports
};
+#ifndef M_PI_2
+# define M_PI_2 1.57079632679489661923 /* pi/2 */
+#endif
+
//operations on FFTfreqs
inline void clearAll(fft_t *freqs, int oscilsize)
diff --git a/src/Synth/SUBnote.cpp b/src/Synth/SUBnote.cpp
@@ -28,6 +28,10 @@
#include "../Misc/Util.h"
#include "../Misc/Allocator.h"
+#ifndef M_PI
+# define M_PI 3.14159265358979323846 /* pi */
+#endif
+
SUBnote::SUBnote(const SUBnoteParameters *parameters, SynthParams &spars)
:SynthNote(spars), pars(*parameters),
AmpEnvelope(nullptr),
diff --git a/src/UI/NSM.C b/src/UI/NSM.C
@@ -82,7 +82,7 @@ NSM_Client::command_open(const char *name,
char *new_filename;
- asprintf(&new_filename, "%s.xmz", name);
+ //asprintf(&new_filename, "%s.xmz", name);
struct stat st;
diff --git a/src/UI/NSM/Client.H b/src/UI/NSM/Client.H
@@ -19,6 +19,7 @@
#pragma once
+#define WIN32
#include <lo/lo.h>
namespace NSM
diff --git a/src/main.cpp b/src/main.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cmath>
#include <cctype>
+#include <ctime>
#include <algorithm>
#include <signal.h>
@@ -25,7 +26,6 @@
#include <getopt.h>
-#include <lo/lo.h>
#include <rtosc/ports.h>
#include <rtosc/thread-link.h>
#include "Params/PADnoteParameters.h"
@@ -69,7 +69,6 @@ char *instance_name = 0;
void exitprogram(const Config &config);
-extern pthread_t main_thread;
//cleanup on signaled exit
void sigterm_exit(int /*sig*/)
@@ -118,7 +117,6 @@ void exitprogram(const Config& config)
int main(int argc, char *argv[])
{
- main_thread = pthread_self();
SYNTH_T synth;
Config config;
config.init();
@@ -444,8 +442,10 @@ int main(int argc, char *argv[])
middleware->updateResources(master);
//Run the Nio system
+ printf("[INFO] Nio::start()\n");
bool ioGood = Nio::start();
+ printf("[INFO] exec-after-init\n");
if(!execAfterInit.empty()) {
cout << "Executing user supplied command: " << execAfterInit << endl;
if(system(execAfterInit.c_str()) == -1)
@@ -456,6 +456,7 @@ int main(int argc, char *argv[])
gui = NULL;
//Capture Startup Responses
+ printf("[INFO] startup OSC\n");
typedef std::vector<const char *> wait_t;
wait_t msg_waitlist;
middleware->setUiCallback([](void*v,const char*msg) {
@@ -466,12 +467,14 @@ int main(int argc, char *argv[])
wait.push_back(copy);
}, &msg_waitlist);
+ printf("[INFO] UI calbacks\n");
if(!noui)
gui = GUI::createUi(middleware->spawnUiApi(), &Pexitprogram);
middleware->setUiCallback(GUI::raiseUi, gui);
middleware->setIdleCallback([](void*){GUI::tickUi(gui);}, NULL);
//Replay Startup Responses
+ printf("[INFO] OSC replay\n");
for(auto msg:msg_waitlist) {
GUI::raiseUi(gui, msg);
delete [] msg;
@@ -489,12 +492,18 @@ int main(int argc, char *argv[])
"Default IO did not initialize.\nDefaulting to NULL backend.");
}
- if(auto_save_interval > 0) {
+ printf("[INFO] auto_save setup\n");
+ if(auto_save_interval > 0 && false) {
int old_save = middleware->checkAutoSave();
if(old_save > 0)
GUI::raiseUi(gui, "/alert-reload", "i", old_save);
middleware->enableAutoSave(auto_save_interval);
}
+ printf("[INFO] NSM Stuff\n");
+#if USE_NSM
+#undef USE_NSM
+#define USE_NSM 0
+#endif
#if USE_NSM
char *nsm_url = getenv("NSM_URL");
@@ -511,6 +520,7 @@ int main(int argc, char *argv[])
}
#endif
+ printf("[INFO] LASH Stuff\n");
#if USE_NSM
if(!nsm)
#endif
@@ -521,7 +531,9 @@ int main(int argc, char *argv[])
#endif
}
+ printf("[INFO] Main Loop...\n");
while(Pexitprogram == 0) {
+#if 0
#if USE_NSM
if(nsm) {
nsm->check();
@@ -552,6 +564,7 @@ int main(int argc, char *argv[])
done:
#endif
GUI::tickUi(gui);
+#endif
middleware->tick();
}