diff options
author | David Robillard <d@drobilla.net> | 2006-08-12 08:20:24 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-12 08:20:24 +0000 |
commit | 30ab1fd61569f9d7fb7410d483fa68cbf9865c37 (patch) | |
tree | 60cf9b5228a2728cda6608d517528066253d1a17 /libs/ardour/send.cc | |
parent | cbdf686e391bc2e7b93f37a5d3fa9197cb178078 (diff) |
Towards MIDI:
- Converted vector<Sample*> to BufferList and numerous counts from int to ChanCount (and related changes)
- Added fancy type-generic iterators to BufferList, PortIterator (see IO::collect_input for a good example of the idea - the same code will work to read all input (of various types in a single IO, eg instruments) without modification no matter how many types we add)
- Fixed comparison operator bugs with ChanCount (screwed up metering among other things)
- Moved peak metering into it's own object, and moved most of the pan related code out of IO to panner (still a touch more to be done here for MIDI playback)
Not directly MIDI related fixes for problems in trunk:
- Fixed varispeed gain/pan automation to work properly (was reading the wrong range of automation data, probably causing nasty clicks?)
- Fixed crash on varispeed looping (possibly only a 64-bit problem). It still doesn't work, but at least it doesn't die
Quite a few things broken, and the new classes are pretty filthy still, but I think the direction is a lot better than all my previous plans...
git-svn-id: svn://localhost/ardour2/branches/midi@795 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/send.cc')
-rw-r--r-- | libs/ardour/send.cc | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 691173c26f..c9c91c07cd 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -26,7 +26,8 @@ #include <ardour/session.h> #include <ardour/port.h> #include <ardour/audio_port.h> - +#include <ardour/buffer_set.h> +#include <ardour/meter.h> #include "i18n.h" using namespace ARDOUR; @@ -36,7 +37,6 @@ Send::Send (Session& s, Placement p) : Redirect (s, s.next_send_name(), p) { _metering = false; - expected_inputs = 0; save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ } @@ -45,7 +45,6 @@ Send::Send (Session& s, const XMLNode& node) : Redirect (s, "send", PreFader) { _metering = false; - expected_inputs = 0; if (set_state (node)) { throw failed_constructor(); @@ -59,7 +58,6 @@ Send::Send (const Send& other) : Redirect (other._session, other._session.next_send_name(), other.placement()) { _metering = false; - expected_inputs = 0; save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ } @@ -105,37 +103,26 @@ Send::set_state(const XMLNode& node) } void -Send::run (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +Send::run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset) { if (active()) { // we have to copy the input, because IO::deliver_output may alter the buffers // in-place, which a send must never do. - vector<Sample*>& sendbufs = _session.get_send_buffers(); + BufferSet& sendbufs = _session.get_send_buffers(bufs.count()); - for (size_t i=0; i < nbufs; ++i) { - memcpy (sendbufs[i], bufs[i], sizeof (Sample) * nframes); - } - - - IO::deliver_output (sendbufs, nbufs, nframes, offset); + sendbufs.read_from(bufs, nframes); + assert(sendbufs.count() == bufs.count()); + assert(sendbufs.count() == _outputs.count()); - if (_metering) { - uint32_t n; - uint32_t no = n_outputs().get(DataType::AUDIO); + IO::deliver_output (sendbufs, nframes, offset); + if (_metering) { if (_gain == 0) { - - for (n = 0; n < no; ++n) { - _peak_power[n] = 0; - } - + _meter->reset(); } else { - - for (n = 0; n < no; ++n) { - _peak_power[n] = Session::compute_peak (audio_output(n)->get_audio_buffer().data(nframes, offset), nframes, _peak_power[n]); - } + _meter->run(output_buffers(), nframes, offset); } } @@ -143,12 +130,7 @@ Send::run (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_ silence (nframes, offset); if (_metering) { - uint32_t n; - uint32_t no = n_outputs().get(DataType::AUDIO); - - for (n = 0; n < no; ++n) { - _peak_power[n] = 0; - } + _meter->reset(); } } } @@ -160,15 +142,15 @@ Send::set_metering (bool yn) if (!_metering) { /* XXX possible thread hazard here */ - reset_peak_meters (); + peak_meter().reset(); } } void -Send::expect_inputs (uint32_t expected) +Send::expect_inputs (const ChanCount& expected) { - if (expected != expected_inputs) { - expected_inputs = expected; + if (expected != _expected_inputs) { + _expected_inputs = expected; reset_panner (); } } |