Skip to content

Commit

Permalink
Added new basic routing format
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Mar 11, 2019
1 parent 5519368 commit edfb531
Show file tree
Hide file tree
Showing 27 changed files with 1,603 additions and 788 deletions.
9 changes: 5 additions & 4 deletions CaptureLoop.cpp
Expand Up @@ -99,7 +99,7 @@ void CaptureLoop::run() {

void CaptureLoop::_captureLoop() {
//Used to temporarily store sample(for all out channels) while they are being processed.
double renderBlockBuffer[16];
double renderBlockBuffer[8];
const size_t nChannelsIn = _pInputs->size();
const size_t nChannelsOut = _pOutputs->size();
//The size of all sample frames for all channels with the same sample index/timestamp
Expand Down Expand Up @@ -147,7 +147,7 @@ void CaptureLoop::_captureLoop() {

#ifdef PERFORMANCE_LOG
if (flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY) {
LOG_WARN("%s: AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY: %d\n", Date::getLocalDateTimeString().c_str(), samplesAvailable);
LOG_WARN("%s: AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY: %d", Date::getLocalDateTimeString().c_str(), samplesAvailable);
}
#endif

Expand Down Expand Up @@ -234,7 +234,7 @@ void CaptureLoop::_checkClippingChannels() {
for (Output * const pOutput : *_pOutputs) {
const double clipping = pOutput->resetClipping();
if (clipping != 0.0) {
LOG_WARN("WARNING: Output(%s) - Clipping detected: +%0.2f dBFS\n", pOutput->getName().c_str(), Convert::levelToDb(clipping));
LOG_WARN("WARNING: Output(%s) - Clipping detected: +%0.2f dBFS", Channels::toString(pOutput->getChannel()).c_str(), Convert::levelToDb(clipping));
}
}
}
Expand All @@ -255,7 +255,8 @@ void CaptureLoop::_updateConditionalRouting() {
//For debug purposes only.
void CaptureLoop::_printUsedChannels() {
for (size_t i = 0; i < _pInputs->size(); ++i) {
LOG_INFO("%s %d", (*_pInputs)[i]->getName().c_str(), _pUsedChannels[i]);
const Channel channel = (*_pInputs)[i]->getChannel();
LOG_INFO("%s %d", Channels::toString(channel).c_str(), _pUsedChannels[i]);
}
LOG_NL();
}
59 changes: 59 additions & 0 deletions Channel.cpp
@@ -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);
}
14 changes: 14 additions & 0 deletions Channel.h
@@ -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);

};

0 comments on commit edfb531

Please sign in to comment.