diff --git a/Wiki/Configuration reference.txt b/Wiki/Configuration reference.txt
index 5f094f8..87b8554 100644
--- a/Wiki/Configuration reference.txt
+++ b/Wiki/Configuration reference.txt
@@ -126,7 +126,7 @@ Copy: <Target channel>=<Source channel>+...
Copy: <Target channel>=<Constant value>+...
**Description:**
-Replaces the audio on the target channel by the sum of the given source channels with optional factors. To add instead of replace the audio on the target channel, the target channel itself can also be a source channel. The factor can also be specified in dB by appending dB. Multiple channel assignments can be specified on a single line by separating them with spaces, therefore a single assignment must not contain spaces. Instead of channel and factor, a constant value can be specified. To avoid ambiguity with numerical channel indices, the constant value must contain a decimal point.
+Replaces the audio on the target channel by the sum of the given source channels with optional factors. To add instead of replace the audio on the target channel, the target channel itself can also be a source channel. The factor can also be specified in dB by appending dB. Multiple channel assignments can be specified on a single line by separating them with spaces, therefore a single assignment must not contain spaces. Instead of channel and factor, a constant value can be specified. To avoid ambiguity with numerical channel indices, the constant value must contain a decimal point. For more information about channel identifiers, see the [Channel](#channel-since-version-08) command.
**Example:**
@@ -142,6 +142,10 @@ Replaces the audio on the target channel by the sum of the given source channels
# Attention: Sets the audio on channel L to the audio on the second channel
# (not to constant value 2, because no decimal point is present)
Copy: L=2
+ # Real world example: Replaces the audio on the subwoofer channel with
+ # the audio on the left channel while muting all other channels of a 5.1 speaker system
+ # (useful for measuring the subwoofer response in REW)
+ Copy: SUB=L L=0.0 R=0.0 C=0.0 RL=0.0 RR=0.0
# Control commands
diff --git a/filters/IfFilterFactory.cpp b/filters/IfFilterFactory.cpp
index b1e74af..f167456 100644
--- a/filters/IfFilterFactory.cpp
+++ b/filters/IfFilterFactory.cpp
@@ -46,6 +46,7 @@ std::vector IfFilterFactory::startOfFile(const std::wstring& configPat
{
trueCountStack.push(trueCount);
trueCount = 0;
+ executeElse = false;
if(falseCount != 0)
{
LogF(L"File was included inside If that evaluated to false!");
@@ -74,9 +75,14 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin
TraceF(L"If(%s) evaluated to %s (%s)", expression.c_str(), result.ToString().c_str(), isTrue ? L"true" : L"false");
if(isTrue)
+ {
trueCount++;
+ }
else
+ {
falseCount++;
+ executeElse = true;
+ }
}
catch(ParserError e)
{
@@ -91,7 +97,19 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin
}
else if(command == L"ElseIf")
{
- if(falseCount == 1)
+ if(falseCount == 0)
+ {
+ if(trueCount == 0)
+ {
+ LogF(L"ElseIf without If!");
+ }
+ else
+ {
+ falseCount++;
+ trueCount--;
+ }
+ }
+ else if(falseCount == 1 && executeElse)
{
try
{
@@ -107,6 +125,7 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin
{
falseCount--;
trueCount++;
+ executeElse = false;
}
}
catch(ParserError e)
@@ -114,21 +133,26 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin
LogF(L"Error while evaluating ElseIf(%s): %s", expression.c_str(), e.GetMsg().c_str());
}
}
- else if(falseCount == 0 && trueCount == 0)
- {
- LogF(L"ElseIf without If!");
- }
}
else if(command == L"Else")
{
- if(falseCount == 1)
+ if(falseCount == 0)
+ {
+ if(trueCount == 0)
+ {
+ LogF(L"Else without If!");
+ }
+ else
+ {
+ falseCount++;
+ trueCount--;
+ }
+ }
+ else if(falseCount == 1 && executeElse)
{
falseCount--;
trueCount++;
- }
- else if(falseCount == 0 && trueCount == 0)
- {
- LogF(L"Else without If!");
+ executeElse = false;
}
}
else if(command == L"EndIf")
@@ -144,6 +168,9 @@ vector IfFilterFactory::createFilter(const wstring& configPath, wstrin
{
falseCount--;
}
+
+ if(falseCount == 0)
+ executeElse = false;
}
if(falseCount > 0)
diff --git a/filters/IfFilterFactory.h b/filters/IfFilterFactory.h
index 40b6ee3..f37deeb 100644
--- a/filters/IfFilterFactory.h
+++ b/filters/IfFilterFactory.h
@@ -39,6 +39,7 @@ private:
unsigned trueCount;
unsigned falseCount;
+ bool executeElse;
std::stack trueCountStack;
bool toBoolean(const mup::Value& value);