first stabs at actual SG support

git-svn-id: svn://localhost/ardour2/branches/3.0-SG@12312 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-16 18:33:20 +00:00
parent 6312242820
commit 08c87b22b4
7 changed files with 138 additions and 9 deletions

View file

@ -712,6 +712,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
bool _feedback_exists;
void resize_text_widgets ();
#ifdef USE_SOUNDGRID
void soundgrid_init ();
#endif
};
#endif /* __ardour_gui_h__ */

View file

@ -603,6 +603,10 @@ ARDOUR_UI::editor_realized ()
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
Config->map_parameters (pc);
#ifdef USE_SOUNDGRID
soundgrid_init ();
#endif
reset_dpi ();
}

View file

@ -0,0 +1,52 @@
/*
Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "ardour/soundgrid.h"
#include "ardour_ui.h"
#include "public_editor.h"
#ifdef __APPLE__
#define Marker MarkerStupidApple
#include <gdk/gdkquartz.h>
#undef Marker
#ifdef check
#undef check
#endif
#ifdef NO
#undef NO
#endif
#ifdef YES
#undef YES
#endif
#endif
#ifdef USE_SOUNDGRID
void
ARDOUR_UI::soundgrid_init ()
{
#ifdef __APPLE__
NSView* nsview = gdk_quartz_window_get_nsview (editor->get_window()->gobj());
ARDOUR::SoundGrid::instance().initialize (nsview);
#endif
}
#endif

View file

@ -39,6 +39,7 @@ gtk2_ardour_sources = [
'ardour_ui_dialogs.cc',
'ardour_ui_ed.cc',
'ardour_ui_mixer.cc',
'ardour_ui_sg.mm',
'ardour_ui_options.cc',
'ardour_window.cc',
'audio_clock.cc',

View file

@ -24,6 +24,9 @@
#include <string>
#include <boost/utility.hpp>
#include <WavesPublicAPI/WTErr.h>
#include <WavesPublicAPI/WavesMixerAPI/1.0/WavesMixerAPI.h>
#include "ardour/ardour.h"
namespace ARDOUR {
@ -33,6 +36,9 @@ class SoundGrid : public boost::noncopyable
public:
~SoundGrid ();
int initialize (void* window_handle);
int teardown ();
static SoundGrid& instance();
static bool available ();
static std::vector<std::string> lan_port_names();
@ -64,11 +70,15 @@ class SoundGrid : public boost::noncopyable
private:
SoundGrid ();
static SoundGrid* _instance;
void* dl_handle;
void* _sg; // handle managed by SoundGrid library
void display_update ();
static void _display_update ();
static WTErr _sg_callback (const WSControlID* pControlID);
static WTErr sg_callback (const WSControlID* pControlID);
};
} // namespace ARDOUR

View file

@ -18,28 +18,35 @@
*/
#include <dlfcn.h>
#include <iostream>
#include <WavesPublicAPI/WCMixerCore_API.h>
#include "ardour/soundgrid.h"
#ifdef __APPLE__
const char* sndgrid_dll_name = "sndgrid.dylib";
const char* sndgrid_dll_name = "mixerapplicationcore.dylib";
#else
const char* sndgrid_dll_name = "sndgrid.so";
const char* sndgrid_dll_name = "mixerapplicationcore.so";
#endif
using namespace ARDOUR;
using std::vector;
using std::string;
using std::cerr;
using std::endl;
SoundGrid* SoundGrid::_instance = 0;
SoundGrid::SoundGrid ()
: dl_handle (0)
{
cerr << "Loading " << sndgrid_dll_name << endl;
if ((dl_handle = dlopen (sndgrid_dll_name, RTLD_NOW)) == 0) {
cerr << "...failed\n";
return;
}
cerr << "...worked\n";
}
SoundGrid::~SoundGrid()
@ -49,6 +56,28 @@ SoundGrid::~SoundGrid()
}
}
int
SoundGrid::initialize (void* window_handle)
{
WTErr ret;
ret = InitializeMixerCoreDLL (window_handle, sg_callback, &_sg);
cerr << "Initialized SG core, ret = " << ret << endl;
return 0;
}
int
SoundGrid::teardown ()
{
WTErr retval = eNoErr;
if (_sg) {
retval = UnInitializeMixerCoreDLL (_sg);
_sg = 0;
}
return retval == eNoErr ? 0 : -1;
}
SoundGrid&
SoundGrid::instance ()
{
@ -142,3 +171,21 @@ SoundGrid::current_network_buffer_size ()
{
return 256;
}
/* callback */
WTErr
SoundGrid::_sg_callback (const WSControlID* cid)
{
return SoundGrid::instance().sg_callback (cid);
}
WTErr
SoundGrid::sg_callback (const WSControlID* cid)
{
cerr << "SG Callback, cluster " << cid->clusterID.clusterType << " (index "
<< cid->clusterID.clusterTypeIndex
<< ") control " << cid->clusterControlID.controlType
<< " (index " << cid->clusterControlID.controlTypeIndex << ')'
<< endl;
return eNoErr;
}

18
wscript
View file

@ -542,10 +542,20 @@ def configure(conf):
print ('No Carbon support available for this build\n')
if Options.options.soundgrid:
conf.env.append_value ('CXXFLAGS_SOUNDGRID', [ '-D__MACOS__', '-DUSE_SOUNDGRID', '-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid' ])
conf.env.append_value ('CFLAGS_SOUNDGRID', [ '-D__MACOS__', '-DUSE_SOUNDGRID', '-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid' ])
sglib = ''.join ([ '-L', os.path.expanduser ('/Volumes/Work/paul/ardour/3.0-SG/soundgrid') ])
conf.env.append_value ('LINKFLAGS_SOUNDGRID', [ sglib, '-lmixerapplicationcore' ])
conf.env.append_value ('CXXFLAGS_SOUNDGRID',
[ '-D__MACOS__',
'-DUSE_SOUNDGRID',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid/WavesPublicAPI/WavesMixerAPI/1.0',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid/WavesPublicAPI/1.0',
])
conf.env.append_value ('CFLAGS_SOUNDGRID',
[ '-D__MACOS__',
'-DUSE_SOUNDGRID',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid/WavesPublicAPI/WavesMixerAPI/1.0',
'-I/Volumes/Work/paul/ardour/3.0-SG/soundgrid/WavesPublicAPI/1.0',
])
conf.check_cxx (header_name='WavesPublicAPI/WavesMixerAPI/1.0/WavesMixerAPI.h',
mandatory=True, use='SOUNDGRID')
conf.define('HAVE_SOUNDGRID', 1)