2013-01-16 13:22:15 -05:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
#include <pbd/failed_constructor.h>
|
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "control_protocol/control_protocol.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
#include "generic_midi_control_protocol.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
ControlProtocol* ARDOURSURFACE_LOCAL
|
2009-07-21 11:55:17 -04:00
|
|
|
new_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
GenericMidiControlProtocol* gmcp;
|
|
|
|
|
|
|
|
try {
|
|
|
|
gmcp = new GenericMidiControlProtocol (*s);
|
|
|
|
} catch (failed_constructor& err) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gmcp->set_active (true)) {
|
|
|
|
delete gmcp;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gmcp;
|
|
|
|
}
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
void ARDOURSURFACE_LOCAL
|
2009-07-21 11:55:17 -04:00
|
|
|
delete_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
delete cp;
|
|
|
|
}
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
bool ARDOURSURFACE_LOCAL
|
2009-07-21 11:55:17 -04:00
|
|
|
probe_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
return GenericMidiControlProtocol::probe ();
|
|
|
|
}
|
|
|
|
|
2013-09-05 04:49:10 -04:00
|
|
|
// Field names commented out by JE - 06-01-2010
|
2008-06-02 17:41:35 -04:00
|
|
|
static ControlProtocolDescriptor generic_midi_descriptor = {
|
2013-09-05 04:49:10 -04:00
|
|
|
/*name : */ "Generic MIDI",
|
|
|
|
/*id : */ "uri://ardour.org/surfaces/generic_midi:0",
|
|
|
|
/*ptr : */ 0,
|
|
|
|
/*module : */ 0,
|
|
|
|
/*mandatory : */ 0,
|
|
|
|
/*supports_feedback : */ true,
|
|
|
|
/*probe : */ probe_generic_midi_protocol,
|
|
|
|
/*initialize : */ new_generic_midi_protocol,
|
|
|
|
/*destroy : */ delete_generic_midi_protocol
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &generic_midi_descriptor; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|