mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-18 19:36:00 +01:00
add channel count difference operator.
This commit is contained in:
parent
4071e77314
commit
fe1985c3e3
1 changed files with 25 additions and 0 deletions
|
|
@ -147,6 +147,19 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/** underflow safe subtraction */
|
||||
ChanCount operator-(const ChanCount& other) const {
|
||||
ChanCount ret;
|
||||
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||
if (get(*t) < other.get(*t)) {
|
||||
ret.set(*t, 0);
|
||||
} else {
|
||||
ret.set(*t, get(*t) - other.get(*t));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ChanCount operator*(const unsigned int factor) const {
|
||||
ChanCount ret;
|
||||
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||
|
|
@ -155,6 +168,18 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/** underflow safe subtraction */
|
||||
ChanCount& operator-=(const ChanCount& other) {
|
||||
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||
if (_counts[*t] < other._counts[*t]) {
|
||||
_counts[*t] = 0;
|
||||
} else {
|
||||
_counts[*t] -= other._counts[*t];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
ChanCount& operator+=(const ChanCount& other) {
|
||||
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||
_counts[*t] += other._counts[*t];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue