2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
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, or (at your option)
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 Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _ardour_surfaces_maschine2hardware_h_
20 #define _ardour_surfaces_maschine2hardware_h_
23 #include <cairomm/refptr.h>
24 #include <cairomm/surface.h>
25 #include "pbd/signals.h"
27 namespace ArdourSurface {
31 /** Abstraction for various variants:
34 * - NI Maschine Studio
45 virtual ~M2Device () {}
47 virtual void clear (bool splash = false) {
51 _splashcnt = _splashtime;
57 virtual void read (hid_device*, M2Contols*) = 0;
58 virtual void write (hid_device*, M2Contols*) = 0;
59 virtual Cairo::RefPtr<Cairo::ImageSurface> surface () = 0;
61 PBD::Signal0<bool> vblank;
65 _blink_counter = (_blink_counter + 1) % 12;
66 _blink_shade = fabsf (1.f - _blink_counter / 6.f);
70 static const uint32_t _splashtime = 25 * 3;
71 unsigned int _blink_counter;
76 #endif /* _ardour_surfaces_maschine2_h_*/