diff options
-rw-r--r-- | CMakeLists.txt | 128 | ||||
-rw-r--r-- | app/CMakeLists.txt | 30 | ||||
-rw-r--r-- | app/synthpod_app.c | 8 | ||||
-rw-r--r-- | bin/CMakeLists.txt | 92 | ||||
-rw-r--r-- | bundle/CMakeLists.txt | 6 | ||||
-rw-r--r-- | data/CMakeLists.txt | 37 | ||||
-rw-r--r-- | plugins/CMakeLists.txt | 222 | ||||
-rw-r--r-- | plugins/manifest.ttl.in | 29 | ||||
-rw-r--r-- | plugins/synthpod_ui.ttl | 40 | ||||
-rw-r--r-- | sandbox_ui.lv2/sandbox_efl.c | 190 | ||||
-rw-r--r-- | sandbox_ui.lv2/sandbox_ui.c | 393 | ||||
-rw-r--r-- | ui/CMakeLists.txt | 11 |
12 files changed, 201 insertions, 985 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aec8eea3..d13e4708 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) project(synthpod) @@ -11,8 +11,28 @@ include(FindUnixCommands) include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_BINARY_DIR}) - +include_directories(${PROJECT_SOURCE_DIR}/app) +include_directories(${PROJECT_SOURCE_DIR}/ardour.lv2) +include_directories(${PROJECT_SOURCE_DIR}/bin) +include_directories(${PROJECT_SOURCE_DIR}/bundle) +include_directories(${PROJECT_SOURCE_DIR}/ext_ui.lv2) +include_directories(${PROJECT_SOURCE_DIR}/include) +include_directories(${PROJECT_SOURCE_DIR}/jackey) +include_directories(${PROJECT_SOURCE_DIR}/libosc_stream) +include_directories(${PROJECT_SOURCE_DIR}/mapper.lv2) include_directories(${PROJECT_SOURCE_DIR}/netatom.lv2) +include_directories(${PROJECT_SOURCE_DIR}/nk_pugl) +include_directories(${PROJECT_SOURCE_DIR}/nuklear) +include_directories(${PROJECT_SOURCE_DIR}/osc.lv2) +include_directories(${PROJECT_SOURCE_DIR}/plugins) +include_directories(${PROJECT_SOURCE_DIR}/props.lv2) +include_directories(${PROJECT_SOURCE_DIR}/pugl) +include_directories(${PROJECT_SOURCE_DIR}/sandbox_ui.lv2) +include_directories(${PROJECT_SOURCE_DIR}/ui) +include_directories(${PROJECT_SOURCE_DIR}/varchunk) +include_directories(${PROJECT_SOURCE_DIR}/xpress.lv2) +include_directories(${PROJECT_SOURCE_DIR}/zero_worker.lv2) +include_directories(${PROJECT_SOURCE_DIR}/zero_writer.lv2) set(SYNTHPOD_BIN_DIR "bin") add_definitions("-DSYNTHPOD_BIN_DIR=\"${CMAKE_INSTALL_PREFIX}/${SYNTHPOD_BIN_DIR}/\"") @@ -26,6 +46,12 @@ add_definitions("-DSYNTHPOD_BUNDLE_DIR=\"${CMAKE_INSTALL_PREFIX}/${SYNTHPOD_BUND set(SYNTHPOD_PLUGIN_DIR "lib/lv2/synthpod.lv2") add_definitions("-DSYNTHPOD_PLUGIN_DIR=\"${CMAKE_INSTALL_PREFIX}/${SYNTHPOD_PLUGIN_DIR}/\"") +set(SYNTHPOD_ICON_DIR "share/icons/hicolor/256x256/apps") +add_definitions("-DSYNTHPOD_ICON_DIR=\"${CMAKE_INSTALL_PREFIX}/${SYNTHPOD_ICON_DIR}/\"") + +set(SYNTHPOD_DESKTOP_DIR "share/applications") +add_definitions("-DSYNTHPOD_DESKTOP_DIR=\"${CMAKE_INSTALL_PREFIX}/${SYNTHPOD_DESKTOP_DIR}/\"") + file(STRINGS "VERSION" SYNTHPOD_VERSION) string(REPLACE "." ";" VERSION_LIST ${SYNTHPOD_VERSION}) list(GET VERSION_LIST 0 SYNTHPOD_MAJOR_VERSION) @@ -45,6 +71,8 @@ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro -Wl,-z,defs ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-z,relro -Wl,-z,nodelete -Wl,-z,defs ${CMAKE_MODULE_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro -Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") +add_definitions("-D_GNU_SOURCE=1") # asprintf + include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES(" int main(int argc, char **argv) @@ -59,20 +87,43 @@ endif() # options option(BUILD_JACK "Build JACK standalone host" ON) -option(BUILD_ALSA "Build ALSA standalone host" OFF) +option(BUILD_ALSA "Build ALSA standalone host" ON) option(BUILD_DUMMY "Build DUMMY standalone host" OFF) -option(BUILD_DOT "Build Dot exporter" ON) + +option(BUILD_DOT "Build Dot exporter" OFF) + +option(BUILD_UI "Build graphical user interface(s)" ON) include(CMakeDependentOption) -option(BUILD_SANDBOX_LIB "Build sandbox library" ON) -cmake_dependent_option(BUILD_SANDBOX_X11 "Build X11 sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_GTK2 "Build GTK-2 sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_GTK3 "Build GTK-3 sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_QT4 "Build Qt-4 sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_QT5 "Build Qt-5 sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_EFL "Build EFL sandbox" ON "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_SHOW "Build show-iface sandbox" OFF "BUILD_SANDBOX_LIB" OFF) -cmake_dependent_option(BUILD_SANDBOX_KX "Build external-ui sandbox" OFF "BUILD_SANDBOX_LIB" OFF) +cmake_dependent_option(BUILD_SANDBOX_X11 "Build X11 sandbox" ON "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_GTK2 "Build GTK-2 sandbox" OFF "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_GTK3 "Build GTK-3 sandbox" OFF "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_QT4 "Build Qt-4 sandbox" OFF "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_QT5 "Build Qt-5 sandbox" OFF "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_SHOW "Build show-iface sandbox" ON "BUILD_UI" OFF) +cmake_dependent_option(BUILD_SANDBOX_KX "Build external-ui sandbox" ON "BUILD_UI" OFF) + +if(BUILD_SANDBOX_X11) + add_definitions("-DSANDBOX_X11") +endif() +if(BUILD_SANDBOX_GTK2) + add_definitions("-DSANDBOX_GTK2") +endif() +if(BUILD_SANDBOX_GTK3) + add_definitions("-DSANDBOX_GTK3") +endif() +if(BUILD_SANDBOX_QT4) + add_definitions("-DSANDBOX_QT4") +endif() +if(BUILD_SANDBOX_QT5) + add_definitions("-DSANDBOX_QT5") +endif() +if(BUILD_SANDBOX_SHOW) + add_definitions("-DSANDBOX_SHOW") +endif() +if(BUILD_SANDBOX_KX) + add_definitions("-DSANDBOX_KX") +endif() # vectorization include(CheckCCompilerFlag) @@ -124,46 +175,21 @@ include_directories(${LV2_INCLUDE_DIRS}) pkg_search_module(SRATOM REQUIRED sratom-0>=0.4) include_directories(${SRATOM_INCLUDE_DIRS}) -# elm -pkg_search_module(ELM REQUIRED elementary>=1.8) -include_directories(${ELM_INCLUDE_DIRS}) - -# evas-x11 -pkg_search_module(EVAS_OPENGL_X11 OPTIONAL evas-opengl-x11>=1.8) -pkg_search_module(EVAS_SOFTWARE_X11 OPTIONAL evas-software-x11>=1.8) -if( (NOT ${EVAS_OPENGL_X11_FOUND}) AND (NOT ${EVAS_SOFTWARE_X11_FOUND}) ) - message(WARNING "No Evas engine for X11 has been found: UI may not be functional on X11!") -endif() - -if((${ELM_VERSION} VERSION_EQUAL "1.10.0") OR (${ELM_VERSION} VERSION_GREATER "1.10.0")) - add_definitions("-DELM_1_10") -endif() +set(BIN_LIBS + m rt pthread + ${UV_LDFLAGS} + ${UUID_LDFLAGS} + ${LILV_LDFLAGS} + ${LV2_LDFLAGS} + ${SRATOM_LDFLAGS}) -if((${ELM_VERSION} VERSION_EQUAL "1.13.0") OR (${ELM_VERSION} VERSION_GREATER "1.13.0")) - add_definitions("-DELM_1_13") -endif() +set(SANDBOX_LIBS + rt pthread + ${LILV_LDFLAGS}) add_subdirectory(app) -add_subdirectory(ui) add_subdirectory(bin) -add_subdirectory(plugins) -add_subdirectory(data) add_subdirectory(bundle) - -# CPack -set(CPACK_GENERATOR "TBZ2") - -set(CPACK_PACKAGE_NAME "synthpod") -set(CPACK_PACKAGE_VERSION "${SYNTHPOD_VERSION}") -SET(CPACK_PACKAGE_VERSION_MAJOR ${SYNTHPOD_MAJOR_VERSION}) -SET(CPACK_PACKAGE_VERSION_MINOR ${SYNTHPOD_MINOR_VERSION}) -SET(CPACK_PACKAGE_VERSION_PATCH ${SYNTHPOD_MICRO_VERSION}) -set(CPACK_PACKAGE_CONTACT "Hanspeter Portner <dev@open-music-kontrollers.ch>") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Non-linear plugin container") -set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") -SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") -SET(CPACK_STRIP_FILES ON) - -include(CPack) +add_subdirectory(data) +add_subdirectory(plugins) +add_subdirectory(sandbox_ui.lv2) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index bff40723..63ecc1bb 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,32 +1,10 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_SOURCE_DIR}/ext_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/zero_worker.lv2) -include_directories(${PROJECT_SOURCE_DIR}/osc.lv2) -include_directories(${PROJECT_SOURCE_DIR}/xpress.lv2) -include_directories(${PROJECT_SOURCE_DIR}/varchunk) -include_directories(${PROJECT_SOURCE_DIR}/ardour.lv2) - -add_definitions("-D_GNU_SOURCE=1") # asprintf - -# synthpod -add_library(synthpod.lib SHARED +# synthpod.lib +add_library(synthpod.lib OBJECT synthpod_app.c synthpod_app_state.c synthpod_app_worker.c synthpod_app_ui.c synthpod_app_mod.c synthpod_app_port.c) -target_link_libraries(synthpod.lib - m - pthread - ${UV_LDFLAGS} - ${UUID_LDFLAGS} - ${LILV_LDFLAGS} - ${LV2_LDFLAGS} - ${SRATOM_LDFLAGS}) -set_target_properties(synthpod.lib PROPERTIES - OUTPUT_NAME "synthpod" - #VERSION "${SYNTHPOD_VERSION}" - SOVERSION "${SYNTHPOD_MAJOR_VERSION}") -install(TARGETS synthpod.lib DESTINATION lib) +set_target_properties(synthpod.lib PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC +set_target_properties(synthpod.lib PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto diff --git a/app/synthpod_app.c b/app/synthpod_app.c index d7417082..6d52dc36 100644 --- a/app/synthpod_app.c +++ b/app/synthpod_app.c @@ -121,7 +121,7 @@ _uri_to_id(LV2_URI_Map_Callback_Data handle, const char *_, const char *uri) return map->map(map->handle, uri); } -__realtime static void inline +__realtime static inline void _sp_app_process_single_run(mod_t *mod, uint32_t nsamples) { sp_app_t *app = mod->app; @@ -240,7 +240,7 @@ _sp_app_process_single_run(mod_t *mod, uint32_t nsamples) mod->prof.max = run_time; } -__realtime static void inline +__realtime static inline void _sp_app_process_single_post(mod_t *mod, uint32_t nsamples, bool sparse_update_timeout) { sp_app_t *app = mod->app; @@ -597,7 +597,7 @@ sp_app_run_pre(sp_app_t *app, uint32_t nsamples) _sp_app_mod_eject(app, del_me); } -static void inline +static inline void _sp_app_process_serial(sp_app_t *app, uint32_t nsamples, bool sparse_update_timeout) { // iterate over all modules @@ -610,7 +610,7 @@ _sp_app_process_serial(sp_app_t *app, uint32_t nsamples, bool sparse_update_time } } -static void inline +static inline void _sp_app_process_parallel(sp_app_t *app, uint32_t nsamples, bool sparse_update_timeout) { _dsp_master_process(app, &app->dsp_master, nsamples); diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index f488c777..335a60d7 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -1,29 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_SOURCE_DIR}/sandbox_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/libosc_stream) -include_directories(${PROJECT_SOURCE_DIR}/varchunk) -include_directories(${PROJECT_SOURCE_DIR}/osc.lv2) -include_directories(${PROJECT_SOURCE_DIR}/xpress.lv2) -include_directories(${PROJECT_SOURCE_DIR}/jackey) -include_directories(${PROJECT_SOURCE_DIR}/mapper.lv2) -include_directories(${PROJECT_SOURCE_DIR}/lib) # synthpod_app.h, synthpod_ui.h - -add_definitions("-D_GNU_SOURCE=1") # asprintf - -set(SYNTHPOD_BIN_DIR "bin") -set(SYNTHPOD_ICON_DIR "share/icons/hicolor/256x256/apps") -set(SYNTHPOD_DESKTOP_DIR "share/applications") - -#FIXME use option -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/synthpod_ui.in - ${PROJECT_BINARY_DIR}/bin/synthpod_ui @ONLY) -install(PROGRAMS ${PROJECT_BINARY_DIR}/bin/synthpod_ui DESTINATION bin) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/synthpod_nk.in - ${PROJECT_BINARY_DIR}/bin/synthpod_nk @ONLY) -install(PROGRAMS ${PROJECT_BINARY_DIR}/bin/synthpod_nk DESTINATION bin) - if(BUILD_JACK OR BUILD_ALSA OR BUILD_DUMMY) # icon install(FILES ${PROJECT_SOURCE_DIR}/data/pix/synthpod.png DESTINATION @@ -31,15 +5,10 @@ if(BUILD_JACK OR BUILD_ALSA OR BUILD_DUMMY) add_library(synthpod.bin OBJECT synthpod_bin.c - synthpod_nsm.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_master.c) + synthpod_nsm.c) + set_target_properties(synthpod.bin PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC set_target_properties(synthpod.bin PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto - - set(LIBS_BIN - synthpod.lib - ${UV_LDFLAGS} - rt pthread m) endif() if(BUILD_JACK) @@ -69,10 +38,12 @@ if(BUILD_JACK) # synthpod add_executable(synthpod.jack synthpod_jack.c - $<TARGET_OBJECTS:synthpod.bin>) + $<TARGET_OBJECTS:synthpod.bin> + $<TARGET_OBJECTS:synthpod.lib> + $<TARGET_OBJECTS:sandbox_master.lib>) target_link_libraries(synthpod.jack ${JACK_LIBS} - ${LIBS_BIN}) + ${BIN_LIBS}) set_target_properties(synthpod.jack PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC set_target_properties(synthpod.jack PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto set_target_properties(synthpod.jack PROPERTIES OUTPUT_NAME "synthpod_jack") @@ -114,11 +85,13 @@ if(BUILD_ALSA) add_executable(synthpod.alsa pcmi.cpp synthpod_alsa.c - $<TARGET_OBJECTS:synthpod.bin>) + $<TARGET_OBJECTS:synthpod.bin> + $<TARGET_OBJECTS:synthpod.lib> + $<TARGET_OBJECTS:sandbox_master.lib>) target_link_libraries(synthpod.alsa asound #FIXME ${ZITA_ALSA_PCMI_LIBRARY} - ${LIBS_BIN}) + ${BIN_LIBS}) set_target_properties(synthpod.alsa PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC set_target_properties(synthpod.alsa PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto set_target_properties(synthpod.alsa PROPERTIES OUTPUT_NAME "synthpod_alsa") @@ -146,9 +119,11 @@ if(BUILD_DUMMY) # synthpod add_executable(synthpod.dummy synthpod_dummy.c - $<TARGET_OBJECTS:synthpod.bin>) + $<TARGET_OBJECTS:synthpod.bin> + $<TARGET_OBJECTS:synthpod.lib> + $<TARGET_OBJECTS:sandbox_master.lib>) target_link_libraries(synthpod.dummy - ${LIBS_BIN}) + ${BIN_LIBS}) set_target_properties(synthpod.dummy PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC set_target_properties(synthpod.dummy PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto set_target_properties(synthpod.dummy PROPERTIES OUTPUT_NAME "synthpod_dummy") @@ -184,7 +159,13 @@ if(BUILD_DOT) install(TARGETS synthpod.dot DESTINATION bin) endif() -if( BUILD_SANDBOX_X11 OR BUILD_SANDBOX_EFL +if(BUILD_UI AND BUILD_SANDBOX_X11) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/synthpod_nk.in + ${PROJECT_BINARY_DIR}/bin/synthpod_nk @ONLY) + install(PROGRAMS ${PROJECT_BINARY_DIR}/bin/synthpod_nk DESTINATION bin) +endif() + +if( BUILD_SANDBOX_X11 OR BUILD_SANDBOX_GTK2 OR BUILD_SANDBOX_GTK3 OR BUILD_SANDBOX_QT4 OR BUILD_SANDBOX_QT5 OR BUILD_SANDBOX_SHOW OR BUILD_SANDBOX_KX) @@ -198,10 +179,6 @@ if( BUILD_SANDBOX_X11 OR BUILD_SANDBOX_EFL ${CMAKE_CURRENT_SOURCE_DIR}/synthpod_sandbox.1) add_custom_target(SYNTHPOD_SANDBOX_MAN_GZ ALL DEPENDS ${PROJECT_BINARY_DIR}/synthpod_sandbox.1.gz) install(FILES "${PROJECT_BINARY_DIR}/synthpod_sandbox.1.gz" DESTINATION share/man/man1) - - set(SANDBOX_LIBS - rt pthread - ${LILV_LDFLAGS}) endif() if(BUILD_SANDBOX_X11) @@ -210,7 +187,7 @@ if(BUILD_SANDBOX_X11) add_executable(synthpod.sandbox.x11 synthpod_sandbox_x11.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.x11 ${XCB_LDFLAGS} ${XCB_ICCCM_LDFLAGS} @@ -228,7 +205,7 @@ if(BUILD_SANDBOX_GTK2) add_executable(synthpod.sandbox.gtk2 synthpod_sandbox_gtk.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.gtk2 ${GTK2_LDFLAGS} ${SANDBOX_LIBS}) @@ -244,7 +221,7 @@ if(BUILD_SANDBOX_GTK3) add_executable(synthpod.sandbox.gtk3 synthpod_sandbox_gtk.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.gtk3 ${GTK3_LDFLAGS} ${SANDBOX_LIBS}) @@ -261,7 +238,7 @@ if(BUILD_SANDBOX_QT4) add_executable(synthpod.sandbox.qt4 synthpod_sandbox_qt.cpp - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.qt4 ${QT4CORE_LDFLAGS} ${QT4GUI_LDFLAGS} @@ -282,7 +259,7 @@ if(BUILD_SANDBOX_QT5) add_executable(synthpod.sandbox.qt5 synthpod_sandbox_qt.cpp - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.qt5 ${QT5CORE_LDFLAGS} ${QT5WIDGETS_LDFLAGS} @@ -298,23 +275,10 @@ if(BUILD_SANDBOX_QT5) install(TARGETS synthpod.sandbox.qt5 DESTINATION bin) endif() -if(BUILD_SANDBOX_EFL) - add_executable(synthpod.sandbox.efl - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_efl.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) - target_link_libraries(synthpod.sandbox.efl - ${ELM_LDFLAGS} - ${SANDBOX_LIBS}) - set_target_properties(synthpod.sandbox.efl PROPERTIES OUTPUT_NAME "synthpod_sandbox_efl") - set_target_properties(synthpod.sandbox.efl PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC - set_target_properties(synthpod.sandbox.efl PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto - install(TARGETS synthpod.sandbox.efl DESTINATION bin) -endif() - if(BUILD_SANDBOX_SHOW) add_executable(synthpod.sandbox.show synthpod_sandbox_show.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.show ${SANDBOX_LIBS}) set_target_properties(synthpod.sandbox.show PROPERTIES OUTPUT_NAME "synthpod_sandbox_show") @@ -326,7 +290,7 @@ endif() if(BUILD_SANDBOX_KX) add_executable(synthpod.sandbox.kx synthpod_sandbox_kx.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) + $<TARGET_OBJECTS:sandbox_slave.lib>) target_link_libraries(synthpod.sandbox.kx ${SANDBOX_LIBS}) set_target_properties(synthpod.sandbox.kx PROPERTIES OUTPUT_NAME "synthpod_sandbox_kx") diff --git a/bundle/CMakeLists.txt b/bundle/CMakeLists.txt index abdbe430..30ee8ae9 100644 --- a/bundle/CMakeLists.txt +++ b/bundle/CMakeLists.txt @@ -1,9 +1,9 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -# synthpod +# synthpod_bundle.lv2 add_library(synthpod_bundle.lv2 MODULE synthpod_bundle.c) set_target_properties(synthpod_bundle.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_bundle") +set_target_properties(synthpod_bundle.lv2 PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC +set_target_properties(synthpod_bundle.lv2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto install(TARGETS synthpod_bundle.lv2 DESTINATION ${SYNTHPOD_BUNDLE_DIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/synthpod_bundle.ttl DESTINATION ${SYNTHPOD_BUNDLE_DIR}) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 2b79e39e..5bccb5d8 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,40 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -# theme -find_program(EDJE_CC NAMES edje_cc) -if(EDJE_CC_NOTFOUND) - message(SEND_ERROR "edje_cc not found") -else(EDJE_CC_NOTFOUND) - message(STATUS "edje_cc found: " ${EDJE_CC}) -endif(EDJE_CC_NOTFOUND) - -add_custom_command( - OUTPUT ${PROJECT_BINARY_DIR}/synthpod.edj - COMMAND ${EDJE_CC} ARGS - "-fd" ${CMAKE_CURRENT_SOURCE_DIR}/font - "-id" ${CMAKE_CURRENT_SOURCE_DIR}/pix - "-id" ${CMAKE_CURRENT_SOURCE_DIR}/rounded_ui - "-id" ${CMAKE_CURRENT_SOURCE_DIR}/rounded_ui_filled - "-id" ${CMAKE_CURRENT_SOURCE_DIR}/squared_ui - ${CMAKE_CURRENT_SOURCE_DIR}/synthpod.edc - ${PROJECT_BINARY_DIR}/synthpod.edj - DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/modgrid.edc - ${CMAKE_CURRENT_SOURCE_DIR}/modlist.edc - ${CMAKE_CURRENT_SOURCE_DIR}/patcher.edc - ${CMAKE_CURRENT_SOURCE_DIR}/smart_slider.edc - ${CMAKE_CURRENT_SOURCE_DIR}/smart_meter.edc - ${CMAKE_CURRENT_SOURCE_DIR}/smart_spinner.edc - ${CMAKE_CURRENT_SOURCE_DIR}/smart_toggle.edc - ${CMAKE_CURRENT_SOURCE_DIR}/smart_bitmask.edc - ${CMAKE_CURRENT_SOURCE_DIR}/synthpod.edc - ${CMAKE_CURRENT_SOURCE_DIR}/theme.edc - ${CMAKE_CURRENT_SOURCE_DIR}/omk_logo.edc - ${CMAKE_CURRENT_SOURCE_DIR}/entry.edc - ${CMAKE_CURRENT_SOURCE_DIR}/group.edc) -add_custom_target(THEME ALL DEPENDS ${PROJECT_BINARY_DIR}/synthpod.edj) -install(FILES ${PROJECT_BINARY_DIR}/synthpod.edj DESTINATION ${SYNTHPOD_DATA_DIR}) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/audio.png DESTINATION ${SYNTHPOD_DATA_DIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/control.png DESTINATION ${SYNTHPOD_DATA_DIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pix/cv.png DESTINATION ${SYNTHPOD_DATA_DIR}) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 943d4f27..6ed3f9ca 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,19 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_SOURCE_DIR}/sandbox_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/mapper.lv2) -include_directories(${PROJECT_SOURCE_DIR}/ext_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/zero_worker.lv2) -include_directories(${PROJECT_SOURCE_DIR}/zero_writer.lv2) -include_directories(${PROJECT_SOURCE_DIR}/osc.lv2) -include_directories(${PROJECT_SOURCE_DIR}/xpress.lv2) -include_directories(${PROJECT_SOURCE_DIR}/props.lv2) -include_directories(${PROJECT_SOURCE_DIR}/varchunk) -include_directories(${PROJECT_SOURCE_DIR}/pugl) -include_directories(${PROJECT_SOURCE_DIR}/lib) # synthpod_app.h, synthpod_ui.h - -add_definitions("-D_GNU_SOURCE=1") # asprintf - # synthpod add_library(synthpod.lv2 MODULE synthpod_lv2.c @@ -33,145 +17,101 @@ add_library(synthpod.lv2 MODULE synthpod_control2atom.c synthpod_mixer.c synthpod_panic.c - synthpod_anonymizer.c) -target_link_libraries(synthpod.lv2 synthpod.lib) + synthpod_anonymizer.c + $<TARGET_OBJECTS:synthpod.lib>) +target_link_libraries(synthpod.lv2 ${BIN_LIBS}) set_target_properties(synthpod.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod") +set_target_properties(synthpod.lv2 PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC +set_target_properties(synthpod.lv2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto install(TARGETS synthpod.lv2 DESTINATION ${SYNTHPOD_PLUGIN_DIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/synthpod.ttl DESTINATION ${SYNTHPOD_PLUGIN_DIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/synthpod_ui.ttl DESTINATION ${SYNTHPOD_PLUGIN_DIR}) -# synthpod_ui -add_library(synthpod_ui.lv2 MODULE - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_ui.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_master.c - synthpod_lv2_ui.c) -target_link_libraries(synthpod_ui.lv2 - rt pthread - ${SRATOM_LDFLAGS}) -set_target_properties(synthpod_ui.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_ui") -install(TARGETS synthpod_ui.lv2 DESTINATION ${SYNTHPOD_PLUGIN_DIR}) - -add_executable(sandbox_efl - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_efl.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_slave.c) -target_link_libraries(sandbox_efl - ${ELM_LDFLAGS} - rt pthread - ${LILV_LDFLAGS}) -install(TARGETS sandbox_efl DESTINATION ${SYNTHPOD_PLUGIN_DIR}) - -# synthpod_eo -add_library(synthpod_eo.lv2 MODULE - synthpod_lv2_eo.c - synthpod_common_eo.c) -target_link_libraries(synthpod_eo.lv2 synthpod_ui.lib) -set_target_properties(synthpod_eo.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_eo") -install(TARGETS synthpod_eo.lv2 DESTINATION ${SYNTHPOD_PLUGIN_DIR}) - +if(BUILD_UI) # nk_pugl -if(WIN32) - set(NK_UI_TYPE "WindowsUI") -elseif(APPLE) - set(NK_UI_TYPE "CocoaUI") -else() - set(NK_UI_TYPE "X11UI") -endif() -set(LIBS_NK m) - -find_package(OpenGL) -if(${OPENGL_FOUND}) - set(LIBS_NK ${LIBS_NK} ${OPENGL_LIBRARIES}) -else() # try pkg-config - pkg_search_module(GL REQUIRED gl) - if(${GL_FOUND}) - set(LIBS_NK ${LIBS_NK} ${GL_LDFLAGS}) - else() - message(FATAL_ERROR "OpenGL not found") - endif() -endif() -add_definitions("-DPUGL_HAVE_GL") - -if(WIN32) - find_library(GDI32_LIBRARY NAMES gdi32) - if(GDI32_LIBRARY) - set(LIBS_NK ${LIBS_NK} ${GDI32_LIBRARY}) + if(WIN32) + set(NK_UI_TYPE "WindowsUI") + elseif(APPLE) + set(NK_UI_TYPE "CocoaUI") else() - message(FATAL_ERROR "gdi32 library not found") + set(NK_UI_TYPE "X11UI") endif() - - find_library(USER32_LIBRARY NAMES user32) - if(USER32_LIBRARY) - set(LIBS_NK ${LIBS_NK} ${USER32_LIBRARY}) - else() - message(FATAL_ERROR "user32 library not found") + set(LIBS_NK m) + + find_package(OpenGL) + if(${OPENGL_FOUND}) + set(LIBS_NK ${LIBS_NK} ${OPENGL_LIBRARIES}) + else() # try pkg-config + pkg_search_module(GL REQUIRED gl) + if(${GL_FOUND}) + set(LIBS_NK ${LIBS_NK} ${GL_LDFLAGS}) + else() + message(FATAL_ERROR "OpenGL not found") + endif() endif() - - set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}/pugl/pugl/pugl_win.cpp) - -elseif(APPLE) - find_library(COCOA_LIBRARY NAMES Cocoa) - if(COCOA_LIBRARY) - set(LIBS_NK ${LIBS_NK} ${COCOA_LIBRARY}) - else() - message(FATAL_ERROR "Cocoa framework not found") + add_definitions("-DPUGL_HAVE_GL") + + if(WIN32) + find_library(GDI32_LIBRARY NAMES gdi32) + if(GDI32_LIBRARY) + set(LIBS_NK ${LIBS_NK} ${GDI32_LIBRARY}) + else() + message(FATAL_ERROR "gdi32 library not found") + endif() + + find_library(USER32_LIBRARY NAMES user32) + if(USER32_LIBRARY) + set(LIBS_NK ${LIBS_NK} ${USER32_LIBRARY}) + else() + message(FATAL_ERROR "user32 library not found") + endif() + + set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}/pugl/pugl/pugl_win.cpp) + + elseif(APPLE) + find_library(COCOA_LIBRARY NAMES Cocoa) + if(COCOA_LIBRARY) + set(LIBS_NK ${LIBS_NK} ${COCOA_LIBRARY}) + else() + message(FATAL_ERROR "Cocoa framework not found") + endif() + + set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}pugl/pugl/pugl_osx.m) + + else() # GNU/Linux + pkg_search_module(X11 REQUIRED x11>=1.6) + include_directories(${X11_INCLUDE_DIRS}) + set(LIBS_NK ${LIBS_NK} ${X11_LDFLAGS}) + + pkg_search_module(XEXT REQUIRED xext>=1.3) + include_directories(${XEXT_INCLUDE_DIRS}) + set(LIBS_NK ${LIBS_NK} ${XEXT_LDFLAGS}) + + set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}/pugl/pugl/pugl_x11.c) endif() - set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}pugl/pugl/pugl_osx.m) - -else() # GNU/Linux - pkg_search_module(X11 REQUIRED x11>=1.6) - include_directories(${X11_INCLUDE_DIRS}) - set(LIBS_NK ${LIBS_NK} ${X11_LDFLAGS}) - - pkg_search_module(XEXT REQUIRED xext>=1.3) - include_directories(${XEXT_INCLUDE_DIRS}) - set(LIBS_NK ${LIBS_NK} ${XEXT_LDFLAGS}) - - set(TAR_NK ${TAR_NK} ${PROJECT_SOURCE_DIR}/pugl/pugl/pugl_x11.c) -endif() +# synthpod_nk + add_library(synthpod_nk.lv2 MODULE + synthpod_lv2_nk.c + synthpod_common_nk.c + synthpod_keyboard_nk.c + ${TAR_NK} + $<TARGET_OBJECTS:sandbox_master.lib>) + target_link_libraries(synthpod_nk.lv2 + ${LIBS_NK} + ${LILV_LDFLAGS} + rt pthread) + set_target_properties(synthpod_nk.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_nk") + set_target_properties(synthpod_nk.lv2 PROPERTIES POSITION_INDEPENDENT_CODE true) # -fPIC + set_target_properties(synthpod_nk.lv2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION true) # -flto + install(TARGETS synthpod_nk.lv2 DESTINATION ${SYNTHPOD_PLUGIN_DIR}) -if(BUILD_SANDBOX_X11) - add_definitions("-DSANDBOX_X11") -endif() -if(BUILD_SANDBOX_GTK2) - add_definitions("-DSANDBOX_GTK2") -endif() -if(BUILD_SANDBOX_GTK3) - add_definitions("-DSANDBOX_GTK3") -endif() -if(BUILD_SANDBOX_QT4) - add_definitions("-DSANDBOX_QT4") -endif() -if(BUILD_SANDBOX_QT5) - add_definitions("-DSANDBOX_QT5") -endif() -if(BUILD_SANDBOX_EFL) - add_definitions("-DSANDBOX_EFL") -endif() -if(BUILD_SANDBOX_SHOW) - add_definitions("-DSANDBOX_SHOW") -endif() -if(BUILD_SANDBOX_KX) - add_definitions("-DSANDBOX_KX") +# font + install(FILES ${PROJECT_SOURCE_DIR}/nuklear/extra_font/Cousine-Regular.ttf DESTINATION ${SYNTHPOD_PLUGIN_DIR}) +else() + set(UI_WRAP "#") endif() -# synthpod_nk -add_library(synthpod_nk.lv2 MODULE - synthpod_lv2_nk.c - synthpod_common_nk.c - synthpod_keyboard_nk.c - ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_master.c - ${TAR_NK}) -target_link_libraries(synthpod_nk.lv2 - ${LIBS_NK} - ${LILV_LDFLAGS} - rt pthread) -set_target_properties(synthpod_nk.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_nk") -install(TARGETS synthpod_nk.lv2 DESTINATION ${SYNTHPOD_PLUGIN_DIR}) - # manifest configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manifest.ttl.in ${PROJECT_BINARY_DIR}/plugins/manifest.ttl) install(FILES ${PROJECT_BINARY_DIR}/plugins/manifest.ttl DESTINATION ${SYNTHPOD_PLUGIN_DIR}) - -# font -install(FILES ${PROJECT_SOURCE_DIR}/nuklear/extra_font/Cousine-Regular.ttf DESTINATION ${SYNTHPOD_PLUGIN_DIR}) diff --git a/plugins/manifest.ttl.in b/plugins/manifest.ttl.in index 09946160..565af073 100644 --- a/plugins/manifest.ttl.in +++ b/plugins/manifest.ttl.in @@ -22,9 +22,6 @@ @prefix synthpod: <http://open-music-kontrollers.ch/lv2/synthpod#> . # to please sord_validate -ui:EoUI - a rdfs:Class, owl:Class ; - rdfs:subClassOf ui:UI . kx:Widget a rdfs:Class, owl:Class ; rdfs:subClassOf ui:UI . @@ -37,35 +34,15 @@ synthpod:stereo lv2:minorVersion @SYNTHPOD_MINOR_VERSION@ ; lv2:microVersion @SYNTHPOD_MICRO_VERSION@ ; lv2:binary <synthpod@CMAKE_SHARED_MODULE_SUFFIX@> ; - ui:ui synthpod:common_1_ui ; - ui:ui synthpod:common_2_kx ; - ui:ui synthpod:common_3_eo ; - ui:ui synthpod:common_4_nk ; - ui:ui synthpod:root_3_eo ; #FIXME - ui:ui synthpod:root_4_nk ; #FIXME + @UI_WRAP@ui:ui synthpod:common_4_nk ; + @UI_WRAP@ui:ui synthpod:root_4_nk ; #FIXME rdfs:seeAlso <synthpod.ttl> . -synthpod:common_1_ui - a ui:UI ; - ui:binary <synthpod_ui@CMAKE_SHARED_MODULE_SUFFIX@> ; - rdfs:seeAlso <synthpod_ui.ttl> . -synthpod:common_2_kx - a kx:Widget ; - ui:binary <synthpod_ui@CMAKE_SHARED_MODULE_SUFFIX@> ; - rdfs:seeAlso <synthpod_ui.ttl> . -synthpod:common_3_eo - a ui:EoUI ; - ui:binary <synthpod_eo@CMAKE_SHARED_MODULE_SUFFIX@> ; - rdfs:seeAlso <synthpod_ui.ttl> . synthpod:common_4_nk a ui:@NK_UI_TYPE@ ; ui:binary <synthpod_nk@CMAKE_SHARED_MODULE_SUFFIX@> ; rdfs:seeAlso <synthpod_ui.ttl> . -synthpod:root_3_eo - a ui:EoUI ; - ui:binary <synthpod_eo@CMAKE_SHARED_MODULE_SUFFIX@> ; - rdfs:seeAlso <synthpod_ui.ttl> . synthpod:root_4_nk a ui:@NK_UI_TYPE@ ; ui:binary <synthpod_nk@CMAKE_SHARED_MODULE_SUFFIX@> ; @@ -77,7 +54,7 @@ synthpod:keyboard lv2:minorVersion @SYNTHPOD_MINOR_VERSION@ ; lv2:microVersion @SYNTHPOD_MICRO_VERSION@ ; lv2:binary <synthpod@CMAKE_SHARED_MODULE_SUFFIX@> ; - ui:ui synthpod:keyboard_4_nk ; + @UI_WRAP@ui:ui synthpod:keyboard_4_nk ; rdfs:seeAlso <synthpod.ttl> . synthpod:keyboard_4_nk diff --git a/plugins/synthpod_ui.ttl b/plugins/synthpod_ui.ttl index c8c0d2ce..79a224d3 100644 --- a/plugins/synthpod_ui.ttl +++ b/plugins/synthpod_ui.ttl @@ -25,35 +25,6 @@ @prefix zwrite: <http://open-music-kontrollers.ch/lv2/zero-writer#> . # Common UIs -synthpod:common_1_ui - a ui:UI ; - ui:portNotification [ - ui:plugin synthpod:stereo ; - lv2:symbol "notify" ; - ui:protocol atom:eventTransfer ; - ] ; - lv2:optionalFeature log:log, ui:portSubscribe, opts:options ; - lv2:requiredFeature ui:idleInterface, urid:map, urid:unmap ; - lv2:extensionData ui:idleInterface, ui:showInterface . -synthpod:common_2_kx - a kx:Widget ; - ui:portNotification [ - ui:plugin synthpod:stereo ; - lv2:symbol "notify" ; - ui:protocol atom:eventTransfer ; - ] ; - lv2:optionalFeature log:log, ui:portSubscribe, opts:options ; - lv2:requiredFeature kx:Host, urid:map, urid:unmap . -synthpod:common_3_eo - a ui:EoUI ; - ui:portNotification [ - ui:plugin synthpod:stereo ; - lv2:symbol "notify" ; - ui:protocol atom:eventTransfer ; - ] ; - lv2:extensionData ui:resize ; - lv2:optionalFeature zwrite:schedule, ui:resize, log:log, ui:portSubscribe ; - lv2:requiredFeature ui:portMap, urid:map . synthpod:common_4_nk ui:portNotification [ ui:plugin synthpod:stereo ; @@ -64,16 +35,7 @@ synthpod:common_4_nk lv2:requiredFeature ui:portMap, urid:map, urid:unmap, ui:idleInterface ; lv2:extensionData ui:idleInterface . -synthpod:root_3_eo - a ui:EoUI ; - ui:portNotification [ - ui:plugin synthpod:stereo ; - lv2:symbol "notify" ; - ui:protocol atom:eventTransfer ; - ] ; - lv2:extensionData ui:resize ; - lv2:optionalFeature zwrite:schedule, ui:resize, log:log, ui:portSubscribe ; - lv2:requiredFeature ui:portMap, urid:map . +# Root UIs synthpod:root_4_nk ui:portNotification [ ui:plugin synthpod:stereo ; diff --git a/sandbox_ui.lv2/sandbox_efl.c b/sandbox_ui.lv2/sandbox_efl.c deleted file mode 100644 index 0c7d5980..00000000 --- a/sandbox_ui.lv2/sandbox_efl.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. - */ - -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <sandbox_slave.h> - -#include <lv2/lv2plug.in/ns/extensions/ui/ui.h> - -#include <Elementary.h> - -typedef struct _app_t app_t; - -struct _app_t { - sandbox_slave_t *sb; - - Evas_Object *win; - Evas_Object *bg; - Evas_Object *widget; - Ecore_Animator *anim; -}; - -static Eina_Bool -_anim(void *data) -{ - sandbox_slave_t *sb = data; - - if(sandbox_slave_recv(sb)) - ecore_main_loop_quit(); - - return ECORE_CALLBACK_RENEW; -} - -static void -_del_request(void *data, Evas_Object *obj, void *event_info) -{ - app_t *app = data; - - elm_exit(); - app->bg = NULL; - app->win = NULL; -} - -static inline int -_init(sandbox_slave_t *sb, void *data) -{ - app_t *app= data; - - int w = 640; - int h = 360; - - const char *title = sandbox_slave_title_get(sb); - app->win = elm_win_add(NULL, title, ELM_WIN_BASIC); - if(!app->win) - { - fprintf(stderr, "elm_win_add failed\n"); - goto fail; - } - elm_win_title_set(app->win, title); - elm_win_autodel_set(app->win, EINA_TRUE); - evas_object_smart_callback_add(app->win, "delete,request", _del_request, app); - - app->bg = elm_bg_add(app->win); - if(!app->bg) - { - fprintf(stderr, "elm_bg_add failed\n"); - goto fail; - } - elm_bg_color_set(app->bg, 64, 64, 64); - evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(app->bg, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(app->bg); - elm_win_resize_object_add(app->win, app->bg); - - const LV2_Feature parent_feature = { - .URI = LV2_UI__parent, - .data = app->win - }; - - if( !sandbox_slave_instantiate(sb, &parent_feature, &app->widget) - || !app->widget) - { - fprintf(stderr, "sandbox_slave_instantiate failed\n"); - goto fail; - } - evas_object_size_hint_weight_set(app->widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(app->widget, EVAS_HINT_FILL, EVAS_HINT_FILL); - - // get widget size hint - int W, H; - evas_object_size_hint_min_get(app->widget, &W, &H); - if(W != 0) - w = W; - if(H != 0) - h = H; - evas_object_show(app->widget); - elm_win_resize_object_add(app->win, app->widget); - - evas_object_resize(app->win, w, h); - evas_object_show(app->win); - - app->anim = ecore_animator_add(_anim, sb); - if(!app->anim) - { - fprintf(stderr, "ecore_animator_add failed\n"); - goto fail; - } - - return 0; - -fail: - return -1; -} - -static inline void -_run(sandbox_slave_t *sb, float update_rate, void *data) -{ - app_t *app = data; - - ecore_animator_frametime_set(1.f / update_rate); - elm_run(); -} - -static inline void -_deinit(void *data) -{ - app_t *app = data; - - if(app->anim) - ecore_animator_del(app->anim); - - if(app->bg) - { - elm_win_resize_object_del(app->win, app->bg); - evas_object_hide(app->bg); - evas_object_del(app->bg); - } - - if(app->win) - { - evas_object_hide(app->win); - evas_object_del(app->win); - } -} - -static const sandbox_slave_driver_t driver = { - .init_cb = _init, - .run_cb = _run, - .deinit_cb = _deinit, - .resize_cb = NULL -}; - -static int -elm_main(int argc, char **argv) -{ - static app_t app; - -#ifdef ELM_1_10 - elm_config_accel_preference_set("gl"); -#endif - - app.sb = sandbox_slave_new(argc, argv, &driver, &app); - if(app.sb) - { - sandbox_slave_run(app.sb); - sandbox_slave_free(app.sb); - return 0; - } - - return -1; -} - -ELM_MAIN(); diff --git a/sandbox_ui.lv2/sandbox_ui.c b/sandbox_ui.lv2/sandbox_ui.c deleted file mode 100644 index cc49ac27..00000000 --- a/sandbox_ui.lv2/sandbox_ui.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch) - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the Artistic License 2.0 as published by - * The Perl Foundation. - * - * This source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Artistic License 2.0 for more details. - * - * You should have received a copy of the Artistic License 2.0 - * along the source as a COPYING file. If not, obtain it from - * http://www.perlfoundation.org/artistic_license_2_0. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <unistd.h> -#include <sys/wait.h> -#include <errno.h> -#include <signal.h> -#include <string.h> - -#include <lv2/lv2plug.in/ns/ext/options/options.h> -#include <lv2/lv2plug.in/ns/ext/atom/atom.h> -#include <lv2/lv2plug.in/ns/ext/parameters/parameters.h> - -#include <sandbox_ui.h> -#include <sandbox_master.h> -#include <lv2_external_ui.h> // kxstudio external-ui extension - -#define SOCKET_PATH_LEN 32 - -typedef struct _plughandle_t plughandle_t; - -struct _plughandle_t { - int done; - - LV2UI_Write_Function write_function; - LV2UI_Controller controller; - LV2UI_Port_Subscribe *subscribe; - - sandbox_master_driver_t driver; - sandbox_master_t *sb; - - char *plugin_uri; - char *bundle_path; - char *executable; - char *ui_uri; - char *window_title; - char *sample_rate; - char socket_path [SOCKET_PATH_LEN]; - - LV2_URID ui_window_title; - LV2_URID params_sample_rate; - LV2_URID atom_string; - LV2_URID atom_float; - - pid_t pid; - - struct { - LV2_External_UI_Widget widget; - const LV2_External_UI_Host *host; - } kx; -}; - -static void -_recv(LV2UI_Controller controller, uint32_t port, - uint32_t size, uint32_t protocol, const void *buf) -{ - plughandle_t *handle = controller; - - handle->write_function(handle->controller, port, size, protocol, buf); -} - -static void -_subscribe(LV2UI_Controller controller, uint32_t port, - uint32_t protocol, bool state) -{ - plughandle_t *handle = controller; - - if(handle->subscribe) - { - if(state) - handle->subscribe->subscribe(handle->subscribe->handle, - port, protocol, NULL); - else - handle->subscribe->unsubscribe(handle->subscribe->handle, - port, protocol, NULL); - } -} - -// Show Interface -static inline int -_show_cb(LV2UI_Handle instance) -{ - plughandle_t *handle = instance; - - if(!handle->done) - return 0; // already showing - - strncpy(handle->socket_path, "shm:///sandbox_ui_XXXXXX", SOCKET_PATH_LEN); - int fd = mkstemp(&handle->socket_path[6]); - if(!fd) - return -1; - close(fd); - - handle->sb = sandbox_master_new(&handle->driver, handle); - if(!handle->sb) - return -1; - - handle->pid = fork(); - if(handle->pid == 0) // child - { - char *const argv [] = { - handle->executable, - "-p", handle->plugin_uri, - "-b", handle->bundle_path, - "-u", handle->ui_uri, - "-s", handle->socket_path, - "-w", handle->window_title, - "-r", handle->sample_rate, - NULL - }; - execv(handle->executable, argv); // p = search PATH for executable - - printf("fork child failed\n"); - exit(-1); - } - else if(handle->pid < 0) - { - printf("fork failed\n"); - return -1; - } - - handle->done = 0; - - return 0; -} - -static inline int -_hide_cb(LV2UI_Handle instance) -{ - plughandle_t *handle = instance; - - if(handle->pid > 0) // has child - { - kill(handle->pid, SIGINT); - - int status; - waitpid(handle->pid, &status, 0); - - handle->pid = -1; // invalidate - } - - if(handle->sb) - { - sandbox_master_free(handle->sb); - handle->sb = NULL; - } - - /* FIXME - remove(&handle->socket_path[6]); - */ - - handle->done = 1; - - return 0; -} - -static const LV2UI_Show_Interface show_ext = { - .show = _show_cb, - .hide = _hide_cb -}; - -// Idle interface -static inline int -_idle_cb(LV2UI_Handle instance) -{ - plughandle_t *handle = instance; - - if(handle->pid > 0) - { - int status; - int res; - if((res = waitpid(handle->pid, &status, WNOHANG)) < 0) - { - if(errno == ECHILD) - { - handle->pid = -1; // invalidate - handle->done = 1; - } - } - else if( (res > 0) && WIFEXITED(status) ) - { - handle->pid = -1; // invalidate - handle->done = 1; - } - } - - if(!handle->done && handle->sb) - { - sandbox_master_recv(handle->sb); - } - - return handle->done; -} - -static const LV2UI_Idle_Interface idle_ext = { - .idle = _idle_cb -}; - -// External-UI Interface -static inline void -_kx_run(LV2_External_UI_Widget *widget) -{ - plughandle_t *handle = (void *)widget - offsetof(plughandle_t, kx.widget); - - if(_idle_cb(handle)) - { - if(handle->kx.host && handle->kx.host->ui_closed) - handle->kx.host->ui_closed(handle->controller); - _hide_cb(handle); - } -} - -static inline void -_kx_hide(LV2_External_UI_Widget *widget) -{ - plughandle_t *handle = (void *)widget - offsetof(plughandle_t, kx.widget); - - _hide_cb(handle); -} - -static inline void -_kx_show(LV2_External_UI_Widget *widget) -{ - plughandle_t *handle = (void *)widget - offsetof(plughandle_t, kx.widget); - - _show_cb(handle); -} - -static inline void -_free_strdups(plughandle_t *handle) -{ - if(handle->plugin_uri) - free(handle->plugin_uri); - if(handle->bundle_path) - free(handle->bundle_path); - if(handle->executable) - free(handle->executable); - if(handle->ui_uri) - free(handle->ui_uri); - if(handle->window_title) - free(handle->window_title); - if(handle->sample_rate) - free(handle->sample_rate); -}; - -LV2UI_Handle -sandbox_ui_instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri, - const char *bundle_path, LV2UI_Write_Function write_function, - LV2UI_Controller controller, LV2UI_Widget *widget, - const LV2_Feature *const *features) -{ - plughandle_t *handle = calloc(1, sizeof(plughandle_t)); - if(!handle) - return NULL; - - handle->write_function = write_function; - handle->controller = controller; - - LV2_Options_Option *opts = NULL; // optional - for(unsigned i=0; features[i]; i++) - { - if(!strcmp(features[i]->URI, LV2_URID__map)) - handle->driver.map = features[i]->data; - else if(!strcmp(features[i]->URI, LV2_URID__unmap)) - handle->driver.unmap = features[i]->data; - else if(!strcmp(features[i]->URI, LV2_UI__portSubscribe)) - handle->subscribe = features[i]->data; - else if(!strcmp(features[i]->URI, LV2_EXTERNAL_UI__Host)) - handle->kx.host = features[i]->data; - else if(!strcmp(features[i]->URI, LV2_OPTIONS__options)) - opts = features[i]->data; - } - - if(!handle->driver.map || !handle->driver.unmap) - { - free(handle); - return NULL; - } - - handle->ui_window_title = handle->driver.map->map(handle->driver.map->handle, - LV2_UI__windowTitle); - handle->params_sample_rate= handle->driver.map->map(handle->driver.map->handle, - LV2_PARAMETERS__sampleRate); - handle->atom_string = handle->driver.map->map(handle->driver.map->handle, - LV2_ATOM__String); - handle->atom_float = handle->driver.map->map(handle->driver.map->handle, - LV2_ATOM__Float); - - handle->plugin_uri = strdup(plugin_uri); - handle->bundle_path = strdup(bundle_path); - if(asprintf(&handle->executable, "%ssandbox_efl", bundle_path) == -1) - handle->executable = NULL; // failed - handle->ui_uri = strdup(descriptor->URI); - sprintf(&handle->ui_uri[strlen(handle->ui_uri) - 4], "%s", "3_eo"); //TODO more elegant way? - - if(opts) - { - for(LV2_Options_Option *opt = opts; - (opt->key != 0) && (opt->value != NULL); - opt++) - { - if( (opt->key == handle->ui_window_title) && (opt->type == handle->atom_string) ) - { - handle->window_title = strdup(opt->value); - } - else if( (opt->key == handle->params_sample_rate) && (opt->type == handle->atom_float) ) - { - if(asprintf(&handle->sample_rate, "%f", *(const float *)opt->value) == -1) - handle->sample_rate = NULL; - } - } - } - if(!handle->window_title && handle->kx.host && handle->kx.host->plugin_human_id) - handle->window_title = strdup(handle->kx.host->plugin_human_id); - if(!handle->window_title) - handle->window_title = strdup(descriptor->URI); - if(!handle->sample_rate) - handle->sample_rate = strdup("44100"); - - if(!handle->plugin_uri || !handle->bundle_path || !handle->executable || !handle->ui_uri || !handle->window_title || !handle->sample_rate) - { - _free_strdups(handle); - free(handle); - return NULL; - } - - handle->driver.socket_path = handle->socket_path; - handle->driver.recv_cb = _recv; - handle->driver.subscribe_cb = _subscribe; - - handle->pid = -1; // invalidate - - handle->kx.widget.run = _kx_run; - handle->kx.widget.show = _kx_show; - handle->kx.widget.hide = _kx_hide; - - if(strstr(descriptor->URI, "_kx")) - *(LV2_External_UI_Widget **)widget = &handle->kx.widget; - else - *widget = NULL; - - handle->done = 1; - - return handle; -} - -void -sandbox_ui_cleanup(LV2UI_Handle instance) -{ - plughandle_t *handle = instance; - - _free_strdups(handle); - free(handle); -} - -void -sandbox_ui_port_event(LV2UI_Handle instance, uint32_t index, uint32_t size, - uint32_t protocol, const void *buf) -{ - plughandle_t *handle = instance; - - if(handle->sb) - sandbox_master_send(handle->sb, index, size, protocol, buf); -} - -// extension data callback for show interface UI -const void * -sandbox_ui_extension_data(const char *uri) -{ - if(!strcmp(uri, LV2_UI__idleInterface)) - return &idle_ext; - else if(!strcmp(uri, LV2_UI__showInterface)) - return &show_ext; - - return NULL; -} diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 42a80ec0..a6d4055e 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,14 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_SOURCE_DIR}/ext_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/zero_worker.lv2) -include_directories(${PROJECT_SOURCE_DIR}/sandbox_ui.lv2) -include_directories(${PROJECT_SOURCE_DIR}/zero_writer.lv2) -include_directories(${PROJECT_SOURCE_DIR}/xpress.lv2) -include_directories(${PROJECT_SOURCE_DIR}/varchunk) - -add_definitions("-D_GNU_SOURCE=1") # asprintf - # synthpod_ui if(BUILD_SANDBOX_LIB) set(SANDBOX_MASTER_SOURCE ${PROJECT_SOURCE_DIR}/sandbox_ui.lv2/sandbox_master.c) |