2008-06-02 17:41:35 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006,2007 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.
|
|
|
|
*/
|
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
#include <stdexcept>
|
2009-10-30 11:30:22 -04:00
|
|
|
|
|
|
|
#include "pbd/error.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
#include "ardour/rc_configuration.h"
|
|
|
|
|
|
|
|
#include "control_protocol/control_protocol.h"
|
|
|
|
#include "mackie_control_protocol.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace std;
|
2015-04-15 20:37:20 -04:00
|
|
|
using namespace ArdourSurface;
|
|
|
|
using namespace Mackie;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
static ControlProtocol*
|
2009-07-28 07:49:14 -04:00
|
|
|
new_mackie_protocol (ControlProtocolDescriptor*, Session* s)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2010-07-06 20:40:58 -04:00
|
|
|
MackieControlProtocol* mcp = 0;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-07-06 20:40:58 -04:00
|
|
|
try {
|
|
|
|
mcp = new MackieControlProtocol (*s);
|
2012-04-25 17:21:36 -04:00
|
|
|
/* do not set active here - wait for set_state() */
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2010-07-06 20:40:58 -04:00
|
|
|
catch (exception & e) {
|
|
|
|
error << "Error instantiating MackieControlProtocol: " << e.what() << endmsg;
|
|
|
|
delete mcp;
|
|
|
|
mcp = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-07-06 20:40:58 -04:00
|
|
|
return mcp;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
static void
|
2009-07-28 07:49:14 -04:00
|
|
|
delete_mackie_protocol (ControlProtocolDescriptor*, ControlProtocol* cp)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
try
|
|
|
|
{
|
|
|
|
delete cp;
|
|
|
|
}
|
|
|
|
catch ( exception & e )
|
|
|
|
{
|
|
|
|
cout << "Exception caught trying to destroy MackieControlProtocol: " << e.what() << endl;
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
/**
|
|
|
|
This is called on startup to check whether the lib should be loaded.
|
|
|
|
|
|
|
|
So anything that can be changed in the UI should not be used here to
|
|
|
|
prevent loading of the lib.
|
|
|
|
*/
|
2013-09-03 08:33:51 -04:00
|
|
|
static bool
|
2009-07-28 07:49:14 -04:00
|
|
|
probe_mackie_protocol (ControlProtocolDescriptor*)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
return MackieControlProtocol::probe();
|
|
|
|
}
|
|
|
|
|
2013-09-05 05:02:11 -04:00
|
|
|
// Field names commented out by JE - 06-01-2010
|
2008-06-02 17:41:35 -04:00
|
|
|
static ControlProtocolDescriptor mackie_descriptor = {
|
2013-09-05 05:02:11 -04:00
|
|
|
/*name : */ "Mackie",
|
|
|
|
/*id : */ "uri://ardour.org/surfaces/mackie:0",
|
|
|
|
/*ptr : */ 0,
|
|
|
|
/*module : */ 0,
|
|
|
|
/*mandatory : */ 0,
|
2008-12-12 17:55:03 -05:00
|
|
|
// actually, the surface does support feedback, but all this
|
|
|
|
// flag does is show a submenu on the UI, which is useless for the mackie
|
|
|
|
// because feedback is always on. In any case, who'd want to use the
|
|
|
|
// mcu without the motorised sliders doing their thing?
|
2013-09-05 05:02:11 -04:00
|
|
|
/*supports_feedback : */ false,
|
|
|
|
/*probe : */ probe_mackie_protocol,
|
|
|
|
/*initialize : */ new_mackie_protocol,
|
|
|
|
/*destroy : */ delete_mackie_protocol
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2014-01-25 13:57:28 -05:00
|
|
|
extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &mackie_descriptor; }
|