2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2006-2007 John Anderson
|
|
|
|
* Copyright (C) 2008-2015 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009 David Robillard <d@drobilla.net>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2008-06-02 17:41:35 -04:00
|
|
|
|
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",
|
|
|
|
/*module : */ 0,
|
|
|
|
/*probe : */ probe_mackie_protocol,
|
|
|
|
/*initialize : */ new_mackie_protocol,
|
2015-12-28 10:14:17 -05:00
|
|
|
/*destroy : */ delete_mackie_protocol,
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2014-01-25 13:57:28 -05:00
|
|
|
extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &mackie_descriptor; }
|