Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[AE] Add "operator-=" to AEChannelInfo

  • Loading branch information...
commit 7a78119d18a0a8c6475f5cf62d14529190b655d9 1 parent d626565
@Karlson2k authored
View
17 xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp
@@ -196,6 +196,23 @@ void CAEChannelInfo::operator+=(const enum AEChannel rhs)
m_channels[m_channelCount++] = rhs;
}
+void CAEChannelInfo::operator-=(const enum AEChannel rhs)
+{
+ ASSERT(rhs > AE_CH_NULL && rhs < AE_CH_MAX);
+
+ int i = 0;
+ while(i < m_channelCount && m_channels[i] != rhs)
+ i++;
+ if (i >= m_channelCount)
+ return; // Channel not found
+
+ for(; i < m_channelCount-1; i++)
+ m_channels[i] = m_channels[i+1];
+
+ m_channels[i] = AE_CH_NULL;
+ m_channelCount--;
+}
+
const enum AEChannel CAEChannelInfo::operator[](unsigned int i) const
{
ASSERT(i < m_channelCount);
View
1  xbmc/cores/AudioEngine/Utils/AEChannelInfo.h
@@ -81,6 +81,7 @@ class CAEChannelInfo {
bool operator==(const CAEChannelInfo& rhs);
bool operator!=(const CAEChannelInfo& rhs);
void operator+=(const enum AEChannel rhs);
+ void operator-=(const enum AEChannel rhs);
const enum AEChannel operator[](unsigned int i) const;
operator std::string();

1 comment on commit 7a78119

@gnif

Nice, this should be a separate PR as I would merge it in a second.

Please sign in to comment.
Something went wrong with that request. Please try again.