2 Copyright (C) 2012 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.
20 #ifndef __ardour_gtk_midi_tracer_h__
21 #define __ardour_gtk_midi_tracer_h__
23 #include <gtkmm/textview.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/togglebutton.h>
26 #include <gtkmm/adjustment.h>
27 #include <gtkmm/spinbutton.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/comboboxtext.h>
30 #include <gtkmm/box.h>
32 #include "pbd/signals.h"
33 #include "pbd/ringbuffer.h"
35 #include "midi++/types.h"
36 #include "ardour_window.h"
46 class MidiTracer : public ArdourWindow
54 Gtk::ScrolledWindow scroller;
55 Gtk::Adjustment line_count_adjustment;
56 Gtk::SpinButton line_count_spinner;
57 Gtk::Label line_count_label;
58 Gtk::HBox line_count_box;
59 struct timeval _last_receipt;
65 /** Incremented when an update is requested, decremented when one is handled; hence
66 * equal to 0 when an update is not queued. May temporarily be negative if a
67 * update is handled before it was noted that it had just been queued.
69 volatile gint _update_queued;
71 RingBuffer<char *> fifo;
73 static const size_t buffer_size = 256;
75 void tracer (MIDI::Parser&, MIDI::byte*, size_t);
78 Gtk::CheckButton autoscroll_button;
79 Gtk::CheckButton base_button;
80 Gtk::CheckButton collect_button;
81 Gtk::CheckButton delta_time_button;
82 Gtk::ComboBoxText _port_combo;
85 void autoscroll_toggle ();
86 void collect_toggle ();
90 void ports_changed ();
92 PBD::ScopedConnection _parser_connection;
93 PBD::ScopedConnection _manager_connection;
95 boost::shared_ptr<ARDOUR::MidiPort> traced_port;
98 #endif /* __ardour_gtk_midi_tracer_h__ */