Ardour  9.0-pre0-582-g084a23a80d
midi_tracer.h
Go to the documentation of this file.
1 /*
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>
6  *
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.
11  *
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.
16  *
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.
20  */
21 
22 #pragma once
23 
24 #include <atomic>
25 
26 #include <gtkmm/textview.h>
27 #include <gtkmm/scrolledwindow.h>
28 #include <gtkmm/togglebutton.h>
29 #include <gtkmm/adjustment.h>
30 #include <gtkmm/spinbutton.h>
31 #include <gtkmm/label.h>
32 #include <gtkmm/liststore.h>
33 #include <gtkmm/comboboxtext.h>
34 #include <gtkmm/box.h>
35 
36 #include "pbd/signals.h"
37 #include "pbd/ringbuffer.h"
38 #include "pbd/pool.h"
39 
40 #include "midi++/types.h"
41 #include "ardour_window.h"
42 
43 namespace MIDI {
44  class Parser;
45 }
46 
47 namespace ARDOUR {
48  class MidiPort;
49 }
50 
51 class MidiTracer : public ArdourWindow
52 {
53 public:
56 
57 protected:
58  void on_show ();
59  void on_hide ();
60 
61 private:
69 
70  bool autoscroll;
71  bool show_hex;
73 
78  std::atomic<int> _update_queued;
79 
82  static const size_t buffer_size = 256;
83 
85  void update ();
86 
92 
94  {
95  public:
97  {
98  add (pretty_name);
99  add (port_name);
100  }
103  };
104 
106  Glib::RefPtr<Gtk::ListStore> _midi_port_list;
107 
108  void base_toggle ();
110  void collect_toggle ();
111  void delta_toggle ();
112 
113  void port_changed ();
114  void ports_changed ();
115  void disconnect ();
118  std::shared_ptr<MIDI::Parser> _midi_parser;
119 
120  std::shared_ptr<ARDOUR::MidiPort> tracer_port;
121  std::shared_ptr<ARDOUR::MidiPort> traced_port;
122 
123  static unsigned int window_count;
124 };
125 
void add(TreeModelColumnBase &column)
Gtk::TreeModelColumn< std::string > pretty_name
Definition: midi_tracer.h:101
Gtk::TreeModelColumn< std::string > port_name
Definition: midi_tracer.h:102
void ports_changed()
static const size_t buffer_size
Definition: midi_tracer.h:82
bool show_hex
Definition: midi_tracer.h:71
Gtk::CheckButton autoscroll_button
Definition: midi_tracer.h:87
void on_show()
This is a default handler for the signal signal_show().
PBD::ScopedConnection _parser_connection
Definition: midi_tracer.h:116
void base_toggle()
Gtk::CheckButton delta_time_button
Definition: midi_tracer.h:90
Gtk::TextView text
Definition: midi_tracer.h:62
MIDI::samplecnt_t _last_receipt
Definition: midi_tracer.h:68
std::shared_ptr< MIDI::Parser > _midi_parser
Definition: midi_tracer.h:118
Gtk::Adjustment line_count_adjustment
Definition: midi_tracer.h:64
Glib::RefPtr< Gtk::ListStore > _midi_port_list
Definition: midi_tracer.h:106
Gtk::ComboBox _midi_port_combo
Definition: midi_tracer.h:91
void on_hide()
This is a default handler for the signal signal_hide().
PBD::RingBuffer< char * > fifo
Definition: midi_tracer.h:80
std::shared_ptr< ARDOUR::MidiPort > tracer_port
Definition: midi_tracer.h:120
Gtk::ScrolledWindow scroller
Definition: midi_tracer.h:63
void autoscroll_toggle()
void collect_toggle()
Gtk::CheckButton base_button
Definition: midi_tracer.h:88
void tracer(MIDI::Parser &, MIDI::byte *, size_t, MIDI::samplecnt_t)
std::atomic< int > _update_queued
Definition: midi_tracer.h:78
PBD::ScopedConnection _manager_connection
Definition: midi_tracer.h:117
bool autoscroll
Definition: midi_tracer.h:70
void port_changed()
bool show_delta_time
Definition: midi_tracer.h:72
MidiPortCols _midi_port_cols
Definition: midi_tracer.h:105
static unsigned int window_count
Definition: midi_tracer.h:123
Gtk::CheckButton collect_button
Definition: midi_tracer.h:89
void delta_toggle()
std::shared_ptr< ARDOUR::MidiPort > traced_port
Definition: midi_tracer.h:121
Gtk::HBox line_count_box
Definition: midi_tracer.h:67
void disconnect()
Gtk::SpinButton line_count_spinner
Definition: midi_tracer.h:65
Gtk::Label line_count_label
Definition: midi_tracer.h:66
PBD::Pool buffer_pool
Definition: midi_tracer.h:81
void update()
Definition: pool.h:40
int64_t samplecnt_t