2 Copyright (C) 2016 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include "pbd/failed_constructor.h"
23 using namespace ARDOUR;
27 using namespace ArdourSurface;
31 #include "pbd/abstract_ui.cc" // instantiate template
33 Push2::Push2 (Session& s)
34 : ControlProtocol (s, string (X_("Ableton Push2")))
35 , AbstractUI<Push2Request> (name())
38 if ((handle = libusb_open_device_with_vid_pid (NULL, ABLETON, PUSH2)) == 0) {
39 throw failed_constructor ();
42 libusb_claim_interface (handle, 0x00);
48 libusb_release_interface (handle, 0x00);
49 libusb_close (handle);
56 libusb_device_handle *h;
59 if ((h = libusb_open_device_with_vid_pid (NULL, ABLETON, PUSH2)) == 0) {
68 Push2::request_factory (uint32_t num_requests)
70 /* AbstractUI<T>::request_buffer_factory() is a template method only
71 instantiated in this source module. To provide something visible for
72 use in the interface/descriptor, we have this static method that is
75 return request_buffer_factory (num_requests);
79 Push2::do_request (Push2Request * req)
81 // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("doing request type %1\n", req->type));
82 if (req->type == CallSlot) {
84 call_slot (MISSING_INVALIDATOR, req->the_slot);
86 } else if (req->type == Quit) {