From 30ab1fd61569f9d7fb7410d483fa68cbf9865c37 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Aug 2006 08:20:24 +0000 Subject: Towards MIDI: - Converted vector 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 --- libs/ardour/port_set.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'libs/ardour/port_set.cc') diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc index 31f06cb139..3d6ab8c537 100644 --- a/libs/ardour/port_set.cc +++ b/libs/ardour/port_set.cc @@ -42,9 +42,9 @@ PortSet::add_port(Port* port) v.push_back(port); sort(v.begin(), v.end(), sort_ports_by_name); - _chan_count.set(port->type(), _chan_count.get(port->type()) + 1); + _count.set(port->type(), _count.get(port->type()) + 1); - assert(_chan_count.get(port->type()) == _ports[port->type().to_index()].size()); + assert(_count.get(port->type()) == _ports[port->type().to_index()].size()); } @@ -89,23 +89,27 @@ PortSet::port(size_t n) const } Port* -PortSet::nth_port_of_type(DataType type, size_t n) const +PortSet::port(DataType type, size_t n) const { - const PortVec& v = _ports[type.to_index()]; - assert(n < v.size()); - return v[n]; + if (type == DataType::NIL) { + return port(n); + } else { + const PortVec& v = _ports[type.to_index()]; + assert(n < v.size()); + return v[n]; + } } AudioPort* PortSet::nth_audio_port(size_t n) const { - return dynamic_cast(nth_port_of_type(DataType::AUDIO, n)); + return dynamic_cast(port(DataType::AUDIO, n)); } MidiPort* PortSet::nth_midi_port(size_t n) const { - return dynamic_cast(nth_port_of_type(DataType::MIDI, n)); + return dynamic_cast(port(DataType::MIDI, n)); } } // namepace ARDOUR -- cgit v1.2.3