Update classkeys to match new total LuaSignal count (windows only)
[ardour.git] / libs / surfaces / cc121 / cc121_interface.cc
1 /*
2     Copyright (C) 2012 Paul Davis
3     Copyright (C) 2016 W.P. van Paassen
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #include <pbd/failed_constructor.h>
22
23 #include "control_protocol/control_protocol.h"
24 #include "cc121.h"
25
26 using namespace ARDOUR;
27 using namespace ArdourSurface;
28
29 static ControlProtocol*
30 new_cc121_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s)
31 {
32         CC121* fp;
33
34         try {
35                 fp =  new CC121 (*s);
36         } catch (failed_constructor& err) {
37                 return 0;
38         }
39
40         if (fp->set_active (true)) {
41                 delete fp;
42                 return 0;
43         }
44
45         return fp;
46 }
47
48 static void
49 delete_cc121_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
50 {
51         delete cp;
52 }
53
54 static bool
55 probe_cc121_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
56 {
57         return CC121::probe ();
58 }
59
60 static void*
61 cc121_request_buffer_factory (uint32_t num_requests)
62 {
63         return CC121::request_factory (num_requests);
64 }
65
66 static ControlProtocolDescriptor cc121_midi_descriptor = {
67         /*name :              */   "Steinberg CC121",
68         /*id :                */   "uri://ardour.org/surfaces/cc121:0",
69         /*ptr :               */   0,
70         /*module :            */   0,
71         /*mandatory :         */   0,
72         /*supports_feedback : */   true,
73         /*probe :             */   probe_cc121_midi_protocol,
74         /*initialize :        */   new_cc121_midi_protocol,
75         /*destroy :           */   delete_cc121_midi_protocol,
76         /*request_buffer_factory */ cc121_request_buffer_factory
77 };
78
79 extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &cc121_midi_descriptor; }
80