Lines 53-59
MidiTracer::MidiTracer ()
Link Here
|
53 |
, autoscroll (true) |
53 |
, autoscroll (true) |
54 |
, show_hex (true) |
54 |
, show_hex (true) |
55 |
, show_delta_time (false) |
55 |
, show_delta_time (false) |
56 |
, _update_queued (0) |
|
|
57 |
, fifo (1024) |
56 |
, fifo (1024) |
58 |
, buffer_pool ("miditracer", buffer_size, 1024) // 1024 256 byte buffers |
57 |
, buffer_pool ("miditracer", buffer_size, 1024) // 1024 256 byte buffers |
59 |
, autoscroll_button (_("Auto-Scroll")) |
58 |
, autoscroll_button (_("Auto-Scroll")) |
Lines 61-66
MidiTracer::MidiTracer ()
Link Here
|
61 |
, collect_button (_("Enabled")) |
60 |
, collect_button (_("Enabled")) |
62 |
, delta_time_button (_("Delta times")) |
61 |
, delta_time_button (_("Delta times")) |
63 |
{ |
62 |
{ |
|
|
63 |
g_atomic_int_set (&_update_queued, 0); |
64 |
|
64 |
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect |
65 |
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect |
65 |
(_manager_connection, invalidator (*this), boost::bind (&MidiTracer::ports_changed, this), gui_context()); |
66 |
(_manager_connection, invalidator (*this), boost::bind (&MidiTracer::ports_changed, this), gui_context()); |
66 |
|
67 |
|
Lines 407-415
MidiTracer::tracer (Parser&, byte* msg,
Link Here
|
407 |
|
408 |
|
408 |
fifo.write (&buf, 1); |
409 |
fifo.write (&buf, 1); |
409 |
|
410 |
|
410 |
if (g_atomic_int_get (const_cast<gint*> (&_update_queued)) == 0) { |
411 |
if (g_atomic_int_compare_and_exchange (&_update_queued, 0, 1)) { |
411 |
gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this)); |
412 |
gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this)); |
412 |
g_atomic_int_inc (const_cast<gint*> (&_update_queued)); |
|
|
413 |
} |
413 |
} |
414 |
} |
414 |
} |
415 |
|
415 |
|
Lines 417-423
void
Link Here
|
417 |
MidiTracer::update () |
417 |
MidiTracer::update () |
418 |
{ |
418 |
{ |
419 |
bool updated = false; |
419 |
bool updated = false; |
420 |
g_atomic_int_dec_and_test (const_cast<gint*> (&_update_queued)); |
420 |
g_atomic_int_set (&_update_queued, 0); |
421 |
|
421 |
|
422 |
RefPtr<TextBuffer> buf (text.get_buffer()); |
422 |
RefPtr<TextBuffer> buf (text.get_buffer()); |
423 |
|
423 |
|