diff options
author | David Robillard <d@drobilla.net> | 2006-08-11 07:15:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-11 07:15:30 +0000 |
commit | cbdf686e391bc2e7b93f37a5d3fa9197cb178078 (patch) | |
tree | 455b52d56b02b90444cd1c39f3ddcb703ca30e10 /libs/ardour/ardour/chan_count.h | |
parent | 30c08ba655330232767554c48bda1975bfb5628c (diff) |
- Replaced integer port counts (and input/output maximum/minimum) with ChanCount, which can count multiple types and does the reasonable thing for all comparison operators
- Removed the fader/meters from MIDI mixer strips, at least until they do something
- Made the Add Route dialog refuse to create MIDI busses, Spifftacular warning dialog and all
Changes a bit more widespread than I was hoping, but worked out really well - lots of code will continue to work fine even when multi-typed (eg instrument) IOs come around, just ignoring the types it doesn't care about. Most all changes related to counts are little search/replace deals, logic doesn't need to change. Hopefully SVN can handle (automatic) merging with the other SoC projects if the buffer change goes as well.
Next step: do for buffers what the last two commits did for ports.
git-svn-id: svn://localhost/ardour2/branches/midi@787 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/chan_count.h')
-rw-r--r-- | libs/ardour/ardour/chan_count.h | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h index 2ef49793d1..67ad5406e3 100644 --- a/libs/ardour/ardour/chan_count.h +++ b/libs/ardour/ardour/chan_count.h @@ -34,7 +34,7 @@ public: ChanCount(DataType type, size_t channels) { reset(); - set_count(type, channels); + set(type, channels); } void reset() @@ -44,10 +44,10 @@ public: } } - void set_count(DataType type, size_t count) { _counts[type.to_index()] = count; } - size_t get_count(DataType type) const { return _counts[type.to_index()]; } + void set(DataType type, size_t count) { _counts[type.to_index()] = count; } + size_t get(DataType type) const { return _counts[type.to_index()]; } - size_t get_total_count() const + size_t get_total() const { size_t ret = 0; for (size_t i=0; i < DataType::num_types; ++i) @@ -70,7 +70,51 @@ public: return ! (*this == other); } + bool operator<(const ChanCount& other) const + { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + if (_counts[(*t).to_index()] >= other._counts[(*t).to_index()]) { + return false; + } + } + return true; + } + + bool operator<=(const ChanCount& other) const + { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + if (_counts[(*t).to_index()] > other._counts[(*t).to_index()]) { + return false; + } + } + return true; + } + + bool operator>(const ChanCount& other) const + { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + if (_counts[(*t).to_index()] <= other._counts[(*t).to_index()]) { + return false; + } + } + return true; + } + + bool operator>=(const ChanCount& other) const + { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + if (_counts[(*t).to_index()] < other._counts[(*t).to_index()]) { + return false; + } + } + return true; + } + + static const ChanCount INFINITE; + static const ChanCount ZERO; + private: + size_t _counts[DataType::num_types]; }; |