Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5519368
commit edfb531
Showing
27 changed files
with
1,603 additions
and
788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "Channel.h" | ||
#include "Error.h" | ||
#include "Str.h" | ||
|
||
const Channel Channels::fromString(const std::string &strIn) { | ||
const std::string str = String::toUpperCase(strIn); | ||
if (str.compare("L") == 0) { | ||
return Channel::L; | ||
} | ||
else if (str.compare("R") == 0) { | ||
return Channel::R; | ||
} | ||
else if (str.compare("C") == 0) { | ||
return Channel::C; | ||
} | ||
else if (str.compare("SW") == 0) { | ||
return Channel::SW; | ||
} | ||
else if (str.compare("SL") == 0) { | ||
return Channel::SL; | ||
} | ||
else if (str.compare("SR") == 0) { | ||
return Channel::SR; | ||
} | ||
else if (str.compare("SBL") == 0) { | ||
return Channel::SBL; | ||
} | ||
else if (str.compare("SBR") == 0) { | ||
return Channel::SBR; | ||
} | ||
throw Error("Unknown channel '%s'", strIn.c_str()); | ||
} | ||
|
||
const std::string Channels::toString(const Channel channel) { | ||
switch (channel) { | ||
case Channel::L: | ||
return "L"; | ||
case Channel::R: | ||
return "R"; | ||
case Channel::C: | ||
return "C"; | ||
case Channel::SW: | ||
return "SW"; | ||
case Channel::SL: | ||
return "SL"; | ||
case Channel::SR: | ||
return "SR"; | ||
case Channel::SBL: | ||
return "SBL"; | ||
case Channel::SBR: | ||
return "SBR"; | ||
default: | ||
throw Error("Unknown channel type %d", channel); | ||
}; | ||
} | ||
|
||
const std::string Channels::toString(const size_t channelIndex) { | ||
return toString((Channel)channelIndex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
enum class Channel { | ||
L, R, C, SW, SBL, SBR, SL, SR | ||
}; | ||
|
||
namespace Channels { | ||
|
||
const Channel fromString(const std::string &str); | ||
const std::string toString(const Channel channel); | ||
const std::string toString(const size_t channelIndex); | ||
|
||
}; |
Oops, something went wrong.