zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit eb6d143a6f4b418d9d15ceaf1f144682dfc186c7
parent 511d287f7b209f7da6f5b6160c4303b9773a3331
Author: fundamental <[email protected]>
Date:   Tue, 26 Jul 2016 16:35:50 -0400

Fix Windows/Linux Combined Build

Diffstat:
Msrc/Plugin/ZynAddSubFX/CMakeLists.txt | 22++++++++--------------
Msrc/main.cpp | 73+++++++++++++++++++++++++++++++++++++++++++------------------------------
2 files changed, 51 insertions(+), 44 deletions(-)

diff --git a/src/Plugin/ZynAddSubFX/CMakeLists.txt b/src/Plugin/ZynAddSubFX/CMakeLists.txt @@ -66,26 +66,20 @@ 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} - ws2_32 - wsock32 - "-static" iphlpapi - "-static" winpthread) + ${PLATFORM_LIBRARIES}) target_link_libraries(ZynAddSubFX_vst zynaddsubfx_core ${OS_LIBRARIES} ${LIBLO_LIBRARIES} - ws2_32 - wsock32 - "-static" iphlpapi - "-static" winpthread) + ${PLATFORM_LIBRARIES}) -#install(TARGETS ZynAddSubFX_lv2 LIBRARY DESTINATION ${PluginLibDir}/lv2/ZynAddSubFX.lv2/) -#install(TARGETS ZynAddSubFX_vst LIBRARY DESTINATION ${PluginLibDir}/vst/) +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) +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/main.cpp b/src/main.cpp @@ -117,6 +117,7 @@ void exitprogram(const Config& config) } //Windows MIDI OH WHAT A HACK... +#ifdef WIN32 #include <windows.h> #include <mmsystem.h> extern InMgr *in; @@ -136,35 +137,35 @@ void CALLBACK WinMidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD dwInstance, int cmdtype=(cmd>>4)&0x0f; int tmp=0; -MidiEvent ev; + MidiEvent ev; switch (cmdtype) { - case(0x8)://noteon - ev.type = 1; -ev.num = par1; -ev.channel = cmdchan; -ev.value = 0; -in->putEvent(ev); - break; - case(0x9)://noteoff - ev.type = 1; -ev.num = par1; -ev.channel = cmdchan; -ev.value = par2&0xff; -in->putEvent(ev); - break; - case(0xb)://controller - ev.type = 2; -ev.num = par1; -ev.channel = cmdchan; -ev.value = par2&0xff; -in->putEvent(ev); - break; - case(0xe)://pitch wheel - //tmp=(par1+par2*(long int) 128)-8192; - //winmaster->SetController(cmdchan,C_pitchwheel,tmp); - break; - default: - break; + case(0x8)://noteon + ev.type = 1; + ev.num = par1; + ev.channel = cmdchan; + ev.value = 0; + in->putEvent(ev); + break; + case(0x9)://noteoff + ev.type = 1; + ev.num = par1; + ev.channel = cmdchan; + ev.value = par2&0xff; + in->putEvent(ev); + break; + case(0xb)://controller + ev.type = 2; + ev.num = par1; + ev.channel = cmdchan; + ev.value = par2&0xff; + in->putEvent(ev); + break; + case(0xe)://pitch wheel + //tmp=(par1+par2*(long int) 128)-8192; + //winmaster->SetController(cmdchan,C_pitchwheel,tmp); + break; + default: + break; }; }; @@ -190,6 +191,9 @@ void InitWinMidi(int midi) // midiInStop(winmidiinhandle); // midiInClose(winmidiinhandle); //}; +#else +void InitWinMidi(int) {} +#endif int main(int argc, char *argv[]) @@ -584,11 +588,18 @@ int wmidi = -1; middleware->enableAutoSave(auto_save_interval); } printf("[INFO] NSM Stuff\n"); -#if USE_NSM + + //TODO move this stuff into Cmake +#if USE_NSM && defined(WIN32) #undef USE_NSM #define USE_NSM 0 #endif +#if LASH && defined(WIN32) +#undef LASH +#define LASH 0 +#endif + #if USE_NSM char *nsm_url = getenv("NSM_URL"); @@ -617,7 +628,7 @@ int wmidi = -1; printf("[INFO] Main Loop...\n"); while(Pexitprogram == 0) { -#if 0 +#ifndef WIN32 #if USE_NSM if(nsm) { nsm->check(); @@ -650,7 +661,9 @@ done: GUI::tickUi(gui); #endif middleware->tick(); +#ifdef WIN32 Sleep(1); +#endif } exitprogram(config);