2018-07-31 08:46:20 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2018 Ben Loftis <ben@harrisonconsoles.com>
|
2018-07-31 08:46:20 -04:00
|
|
|
*
|
2019-08-03 08:34:29 -04:00
|
|
|
* 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.
|
2018-07-31 08:46:20 -04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2019-08-03 08:34:29 -04:00
|
|
|
* 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.
|
2018-07-31 08:46:20 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <pbd/failed_constructor.h>
|
|
|
|
|
|
|
|
#include "control_protocol/control_protocol.h"
|
|
|
|
#include "faderport8.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace ArdourSurface::FP_NAMESPACE;
|
|
|
|
|
|
|
|
static ControlProtocol*
|
2023-04-30 21:32:00 -04:00
|
|
|
new_faderport2_midi_protocol (Session* s)
|
2018-07-31 08:46:20 -04:00
|
|
|
{
|
|
|
|
FaderPort8* fp;
|
|
|
|
|
|
|
|
try {
|
2023-04-30 21:32:00 -04:00
|
|
|
fp = new FaderPort8 (*s);
|
2018-07-31 08:46:20 -04:00
|
|
|
} catch (failed_constructor& err) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fp->set_active (true)) {
|
|
|
|
delete fp;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return fp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-04-30 21:32:00 -04:00
|
|
|
delete_faderport2_midi_protocol (ControlProtocol* cp)
|
2018-07-31 08:46:20 -04:00
|
|
|
{
|
|
|
|
delete cp;
|
|
|
|
}
|
|
|
|
|
2023-05-02 20:07:53 -04:00
|
|
|
static bool
|
|
|
|
probe_faderport2_midi_protocol ()
|
|
|
|
{
|
|
|
|
std::string i, o;
|
|
|
|
return FaderPort8::probe (i, o);
|
|
|
|
}
|
|
|
|
|
2018-07-31 08:46:20 -04:00
|
|
|
static ControlProtocolDescriptor faderport2_midi_descriptor = {
|
2023-04-30 21:32:00 -04:00
|
|
|
/* name */ "PreSonus FaderPort2",
|
|
|
|
/* id */ "uri://ardour.org/surfaces/faderport2:0",
|
|
|
|
/* module */ 0,
|
|
|
|
/* available */ 0,
|
2023-05-02 20:07:53 -04:00
|
|
|
/* probe_port */ probe_faderport2_midi_protocol,
|
2023-04-30 21:32:00 -04:00
|
|
|
/* match usb */ 0,
|
|
|
|
/* initialize */ new_faderport2_midi_protocol,
|
|
|
|
/* destroy */ delete_faderport2_midi_protocol,
|
2018-07-31 08:46:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" ARDOURSURFACE_API
|
2023-04-30 21:32:00 -04:00
|
|
|
ControlProtocolDescriptor* protocol_descriptor ()
|
|
|
|
{
|
2018-07-31 08:46:20 -04:00
|
|
|
return &faderport2_midi_descriptor;
|
|
|
|
}
|