diff --git a/libs/soundgrid/Info.plist.in b/libs/soundgrid/Info.plist.in new file mode 100644 index 0000000000..b02cb82844 --- /dev/null +++ b/libs/soundgrid/Info.plist.in @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SurfaceDriver_App + CFBundleIdentifier + com.linuxaudiosystems.SurfaceDriver-App + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/libs/soundgrid/driver.cc b/libs/soundgrid/driver.cc index d99350d26f..7859533c6d 100644 --- a/libs/soundgrid/driver.cc +++ b/libs/soundgrid/driver.cc @@ -3,6 +3,14 @@ #include #include +#include + +#include "ardour/soundgrid.h" +#include "ardour/debug.h" + +using ARDOUR::SoundGrid; +using namespace PBD; + /* struct WSCoreCallbackTable { @@ -11,79 +19,100 @@ struct WSCoreCallbackTable }; */ + /* This API is really a C API, but we want to be able to use C++ objects within it, so ... */ +extern "C" { + +static const char* surface_type = "ArdourSurface"; + uint32_t WMSD_QueryInterfaceVersion() { - return 0; + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + return WMSD_INTERFACE_VERSION; } WSDSurfaceHandle -WMSD_CreateSurfaceFromPreset(const WSDCoreHandle hostHandle, - const WSCoreCallbackTable* pCallbackTable, const WSMixerConfig* pMixerConfig, - const void* pPresetChunk, WSDSize presetSize) +WMSD_CreateSurfaceFromPreset (const WSDCoreHandle hostHandle, + const WSCoreCallbackTable* pCallbackTable, const WSMixerConfig* pMixerConfig, + const void*, WSDSize) { - return eNoErr; + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + SoundGrid::driver_register (hostHandle, pCallbackTable, pMixerConfig); + return (WSDSurfaceHandle) &SoundGrid::instance(); } WMSDErr -WMSD_GetAvailableSurfaceInfo(struct WMSD_SURFACEINFO *p) +WMSD_GetAvailableSurfaceInfo (struct WMSD_SURFACEINFO *p) { - snprintf (p->surfaceDriverName, sizeof (p->surfaceDriverName), "Ardour"); - snprintf (p->surfaceDriverCategory, sizeof (p->surfaceDriverCategory), "Ardour"); - snprintf (p->surfaceType, sizeof (p->surfaceType), "Ardour"); + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + strncpy (p->surfaceDriverName, "ArdourSurfaceDriver", WMSD_MAX_SURFACEDRIVERNAME_LENGTH); + strncpy (p->surfaceDriverCategory, "Ardour", WMSD_MAX_SURFACEDRIVERCATEGORY_LENGTH); + strncpy (p->surfaceType, surface_type, WMSD_MAX_SURFACETYPE_LENGTH); return eNoErr; } WSDSurfaceHandle -WMSD_CreateSurfaceForType(const char* pSurfaceType, - const WSDCoreHandle hostHandle, const WSCoreCallbackTable* pCallbackTable, - const WSMixerConfig* pMixerConfig) +WMSD_CreateSurfaceForType (const char* /* pSurfaceType */, + const WSDCoreHandle hostHandle, const WSCoreCallbackTable* pCallbackTable, + const WSMixerConfig* pMixerConfig) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + SoundGrid::driver_register (hostHandle, pCallbackTable, pMixerConfig); + return (WSDSurfaceHandle) &SoundGrid::instance(); +} + +WMSDErr +WMSD_ShowConfigWindow (const WSDSurfaceHandle /* surfaceHandle */) +{ + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); return eNoErr; } WMSDErr -WMSD_ShowConfigWindow(const WSDSurfaceHandle surfaceHandle) +WMSD_IdentifySurface (const WSDSurfaceHandle /*surfaceHandle*/, const bool /*turnOnLed*/) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); return eNoErr; } WMSDErr -WMSD_IdentifySurface(const WSDSurfaceHandle surfaceHandle, const bool turnOnLed) +WMSD_GetPreset (const WSDSurfaceHandle /*surfaceHandle*/, void* /*pPresetChunk*/, WSDSize *pPresetSize) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + *pPresetSize = 0; return eNoErr; } WMSDErr -WMSD_GetPreset(const WSDSurfaceHandle surfaceHandle, void *pPresetChunk, - WSDSize *pPresetSize) +WMSD_SetPreset (const WSDSurfaceHandle /*surfaceHandle*/, void* /*pPresetChunk*/, WSDSize /*presetSize*/) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); return eNoErr; } WMSDErr -WMSD_SetPreset(const WSDSurfaceHandle surfaceHandle, void *pPresetChunk, - WSDSize presetSize) +WMSD_SurfaceDisplayUpdate (const WSDSurfaceHandle /*surfaceHandle*/, + const struct WSControlID* /*pControlID*/) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); return eNoErr; } WMSDErr -WMSD_SurfaceDisplayUpdate(const WSDSurfaceHandle surfaceHandle, - const struct WSControlID *pControlID) +WMSD_DestroySurface (const WSDSurfaceHandle /*surfaceHandle*/) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + SoundGrid::driver_register (0, 0, 0); return eNoErr; } WMSDErr -WMSD_DestroySurface(const WSDSurfaceHandle surfaceHandle) +WMSD_GetTypeForSurface (const WSDSurfaceHandle /*surfaceHandle*/, char *out_surfaceType) { + DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("SurfaceDriver:%1\n", __FUNCTION__)); + strncpy (out_surfaceType, surface_type, WMSD_MAX_SURFACETYPE_LENGTH); return eNoErr; } -WMSDErr -WMSD_GetTypeForSurface(const WSDSurfaceHandle surfaceHandle, char *out_surfaceType) -{ - return eNoErr; -} +} /* extern "C" */ diff --git a/libs/soundgrid/wscript b/libs/soundgrid/wscript index 6a49c5719e..bbaff8b109 100644 --- a/libs/soundgrid/wscript +++ b/libs/soundgrid/wscript @@ -4,57 +4,47 @@ from waflib import TaskGen import os import sys -# Version of this package (even if built as a child) -MAJOR = '1' -MINOR = '0' -MICRO = '0' -LIBSGARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) - -# Library version (UNIX style major, minor, micro) -# major increment <=> incompatible changes -# minor increment <=> compatible changes (additions) -# micro increment <=> no interface changes -LIBSGARDOUR_LIB_VERSION = '1.0.0' - # Variables for 'waf dist' APPNAME = 'libsgardour' -VERSION = LIBSGARDOUR_VERSION +VERSION = '1.0.0' I18N_PACKAGE = 'libsgardour' # Mandatory variables top = '.' out = 'build' -path_prefix = 'libs/sgardour/' - def options(opt): autowaf.set_options(opt) def configure(conf): conf.load('compiler_cxx') autowaf.configure(conf) - autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML') - conf.write_config_header('libsgardour-config.h', remove=False) - - # Boost headers - autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp') - autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp') +def bundlify(bld): + # ensure the bundle directory folder is in place + p = bld.path.find_dir ('.') + # copy the object into it + # copy the Info.plist file def build(bld): - # Library if bld.is_defined ('HAVE_SOUNDGRID'): - driver = bld(features = 'cxx cxxshlib') - driver.source = [ 'driver.cc' ] - driver.export_includes = ['.'] - driver.includes = ['.'] - driver.name = 'libsgardour' - driver.target = 'sgardour' - driver.uselib = [ 'SOUNDGRID', 'GLIBMM', 'SIGCPP', 'XML', 'UUID', 'SNDFILE', 'GIOMM' ] - driver.use = [ 'libardour' ] - driver.vnum = LIBSGARDOUR_LIB_VERSION - driver.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') - driver.defines = ['PACKAGE="' + I18N_PACKAGE + '"'] + object = bld.program ( + source = [ 'driver.cc' ], + target = 'SurfaceDriver_App', + includes = ['.'], + linkflags = '-bundle', + use = [ 'libardour' ], + install_path = os.path.join(bld.env['LIBDIR'], 'ardour3'), + defines = ['PACKAGE="' + I18N_PACKAGE + '"'] + ) + bld (rule='mkdir -p ${TGT}', + target=bld.path.get_bld().make_node ('SurfaceDriver_App.bundle/Contents/MacOS')) + bld (rule='cp ${SRC} ${TGT}', + target=bld.path.get_bld().make_node ('SurfaceDriver_App.bundle/Contents/Info.plist'), + source=bld.path.make_node ('Info.plist.in')) + bld (rule='cp ${SRC} ${TGT}', + target=bld.path.get_bld().make_node('SurfaceDriver_App.bundle/Contents/MacOS/SurfaceDriver_App'), + source=bld.path.get_bld().make_node ('SurfaceDriver_App')) def shutdown(): autowaf.shutdown()