2 * Copyright (C) 2010-2018 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
4 * Copyright (C) 2011 David Robillard <d@drobilla.net>
5 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef __ardour_gtk_midi_tracer_h__
23 #define __ardour_gtk_midi_tracer_h__
25 #include <gtkmm/textview.h>
26 #include <gtkmm/scrolledwindow.h>
27 #include <gtkmm/togglebutton.h>
28 #include <gtkmm/adjustment.h>
29 #include <gtkmm/spinbutton.h>
30 #include <gtkmm/label.h>
31 #include <gtkmm/comboboxtext.h>
32 #include <gtkmm/box.h>
34 #include "pbd/signals.h"
35 #include "pbd/ringbuffer.h"
37 #include "midi++/types.h"
38 #include "ardour_window.h"
48 class MidiTracer : public ArdourWindow
56 Gtk::ScrolledWindow scroller;
57 Gtk::Adjustment line_count_adjustment;
58 Gtk::SpinButton line_count_spinner;
59 Gtk::Label line_count_label;
60 Gtk::HBox line_count_box;
61 MIDI::samplecnt_t _last_receipt;
67 /** Incremented when an update is requested, decremented when one is handled; hence
68 * equal to 0 when an update is not queued. May temporarily be negative if a
69 * update is handled before it was noted that it had just been queued.
71 volatile gint _update_queued;
73 PBD::RingBuffer<char *> fifo;
75 static const size_t buffer_size = 256;
77 void tracer (MIDI::Parser&, MIDI::byte*, size_t, MIDI::samplecnt_t);
80 Gtk::CheckButton autoscroll_button;
81 Gtk::CheckButton base_button;
82 Gtk::CheckButton collect_button;
83 Gtk::CheckButton delta_time_button;
84 Gtk::ComboBoxText _port_combo;
87 void autoscroll_toggle ();
88 void collect_toggle ();
92 void ports_changed ();
94 PBD::ScopedConnection _parser_connection;
95 PBD::ScopedConnection _manager_connection;
96 MIDI::Parser my_parser;
98 boost::shared_ptr<ARDOUR::MidiPort> traced_port;
101 #endif /* __ardour_gtk_midi_tracer_h__ */