From f2aa62385872367b5402f13a0e02527c54589cd4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 26 Nov 2007 01:29:11 +0000 Subject: [PATCH] Use normal Processor run_in_place interface on Meter. git-svn-id: svn://localhost/ardour2/trunk@2714 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/meter.h | 2 +- libs/ardour/base_midi_port.cc | 4 +++- libs/ardour/io.cc | 2 +- libs/ardour/jack_midi_port.cc | 9 ++++++--- libs/ardour/meter.cc | 2 +- libs/ardour/midi_port.cc | 23 +++++++++++++++++++---- libs/ardour/midi_track.cc | 4 ++-- libs/ardour/route.cc | 2 +- libs/ardour/send.cc | 2 +- 9 files changed, 35 insertions(+), 15 deletions(-) diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index c78cdebfb0..e19c0a51ca 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -43,7 +43,7 @@ public: bool configure_io (ChanCount in, ChanCount out); /** Compute peaks */ - void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); float peak_power (uint32_t n) { if (n < _visible_peak_power.size()) { diff --git a/libs/ardour/base_midi_port.cc b/libs/ardour/base_midi_port.cc index e1014610b3..49d748dd20 100644 --- a/libs/ardour/base_midi_port.cc +++ b/libs/ardour/base_midi_port.cc @@ -31,7 +31,7 @@ BaseMidiPort::BaseMidiPort (const std::string& name, Flags flags) , _own_buffer (false) { _type = DataType::MIDI; - reset(); + _mixdown = default_mixdown; } BaseMidiPort::~BaseMidiPort() @@ -47,6 +47,7 @@ BaseMidiPort::default_mixdown (const set& ports, MidiBuffer* dest, nframe set::const_iterator p = ports.begin(); if (first_overwrite) { + cout << "first overwrite" << endl; dest->read_from ((dynamic_cast(*p))->get_midi_buffer(), cnt, offset); p++; } @@ -54,6 +55,7 @@ BaseMidiPort::default_mixdown (const set& ports, MidiBuffer* dest, nframe // XXX DAVE: this is just a guess for (; p != ports.end(); ++p) { + cout << "merge" << endl; dest->merge (*dest, (dynamic_cast(*p))->get_midi_buffer()); } } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index fdb2e0f5cd..89c342e9cf 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -331,7 +331,7 @@ IO::just_meter_input (nframes_t start_frame, nframes_t end_frame, collect_input (bufs, nframes, offset); - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); } diff --git a/libs/ardour/jack_midi_port.cc b/libs/ardour/jack_midi_port.cc index e943a6a190..7dbb8655f6 100644 --- a/libs/ardour/jack_midi_port.cc +++ b/libs/ardour/jack_midi_port.cc @@ -27,13 +27,16 @@ JackMidiPort::JackMidiPort (const std::string& name, Flags flgs, MidiBuffer* buf { if (buf) { + cout << name << " BUFFER" << endl; + _buffer = buf; _own_buffer = false; } else { - /* data space will be provided by JACK */ + cout << name << " NO BUFFER" << endl; + /* data space will be provided by JACK */ _buffer = new MidiBuffer (0); _own_buffer = true; } @@ -68,8 +71,8 @@ JackMidiPort::cycle_start (nframes_t nframes, nframes_t offset_ignored_but_proba assert(_buffer->size() == event_count); - //if (_buffer->size() > 0) - // cerr << "MIDIPort got " << event_count << " events." << endl; + if (_buffer->size() > 0) + cerr << "MIDIPort got " << event_count << " events." << endl; } void diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 6ea5a30920..d108374ba0 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -33,7 +33,7 @@ namespace ARDOUR { * be set to 0. */ void -PeakMeter::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) +PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { size_t meterable = std::min((size_t)bufs.count().n_total(), _peak_power.size()); diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index 8fb66255d8..7590c42e0b 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -26,7 +26,7 @@ using namespace ARDOUR; using namespace std; -MidiPort::MidiPort (const std::string& name, Flags flags, bool publish, nframes_t bufsize) +MidiPort::MidiPort (const std::string& name, Flags flags, bool external, nframes_t bufsize) : Port (name, flags) , BaseMidiPort (name, flags) , PortFacade (name, flags) @@ -35,7 +35,9 @@ MidiPort::MidiPort (const std::string& name, Flags flags, bool publish, nframes_ _buffer = new MidiBuffer (bufsize); - if (!publish) { + cout << "MIDI port " << name << " external: " << external << endl; + + if (!external) { _ext_port = 0; } else { _ext_port = new JackMidiPort (name, flags, _buffer); @@ -68,19 +70,28 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset) /* caller must hold process lock */ if (_ext_port) { + // cout << "external\n"; _ext_port->cycle_start (nframes, offset); } - + if (_flags & IsInput) { - + if (_ext_port) { + + // cout << "external in\n"; + _buffer->read_from (dynamic_cast(_ext_port)->get_midi_buffer(), nframes, offset); + + // cout << "read " << _buffer->size() << " events." << endl; + if (!_connections.empty()) { (*_mixdown) (_connections, _buffer, nframes, offset, false); } } else { + // cout << "internal in\n"; + if (_connections.empty()) { _buffer->silence (nframes, offset); } else { @@ -89,7 +100,11 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset) } } else { + + // cout << "out\n"; _buffer->silence (nframes, offset); } + + // cout << endl; } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index d81f1f2cef..7307ff220d 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -543,7 +543,7 @@ MidiTrack::process_output_buffers (BufferSet& bufs, * Route::process_output_buffers handle everything */ if (meter && (_meter_point == MeterInput || _meter_point == MeterPreFader)) { - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); } // Run all processors @@ -557,7 +557,7 @@ MidiTrack::process_output_buffers (BufferSet& bufs, } if (meter && (_meter_point == MeterPostFader)) { - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); } // Main output stage diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index be7dfb8469..8193d4ed77 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -341,7 +341,7 @@ Route::process_output_buffers (BufferSet& bufs, -------------------------------------------------------------------------------------------------- */ if (meter && (_meter_point == MeterInput)) { - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); } if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) { diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 52184dece1..736a443c72 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -131,7 +131,7 @@ Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, if (_io->_gain == 0) { _io->_meter->reset(); } else { - _io->_meter->run(_io->output_buffers(), start_frame, end_frame, nframes, offset); + _io->_meter->run_in_place(_io->output_buffers(), start_frame, end_frame, nframes, offset); } } -- 2.30.2