Wire through debug level changes; tidy
This commit is contained in:
@@ -300,7 +300,6 @@ public:
|
||||
setDefaultDebugLevel(int level)
|
||||
{
|
||||
Log::setDefaultDebugLevel(level);
|
||||
R2Stretcher::setDefaultDebugLevel(level); //!!!
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ R2Stretcher::m_defaultIncrement = 256;
|
||||
const size_t
|
||||
R2Stretcher::m_defaultFftSize = 2048;
|
||||
|
||||
int
|
||||
R2Stretcher::m_defaultDebugLevel = 0;
|
||||
|
||||
static bool _initialised = false;
|
||||
|
||||
R2Stretcher::R2Stretcher(size_t sampleRate,
|
||||
@@ -82,7 +79,6 @@ R2Stretcher::R2Stretcher(size_t sampleRate,
|
||||
m_realtime(false),
|
||||
m_options(options),
|
||||
m_log(log),
|
||||
m_debugLevel(m_defaultDebugLevel),
|
||||
m_mode(JustCreated),
|
||||
m_awindow(0),
|
||||
m_afilter(0),
|
||||
@@ -110,7 +106,10 @@ R2Stretcher::R2Stretcher(size_t sampleRate,
|
||||
_initialised = true;
|
||||
}
|
||||
|
||||
m_log.log(1, "R2Stretcher::R2Stretcher: rate, options", m_sampleRate, options);
|
||||
m_log.log(1, "R2Stretcher::R2Stretcher: rate, options",
|
||||
m_sampleRate, options);
|
||||
m_log.log(1, "R2Stretcher::R2Stretcher: initial time ratio and pitch scale",
|
||||
m_timeRatio, m_pitchScale);
|
||||
|
||||
// Window size will vary according to the audio sample rate, but
|
||||
// we don't let it drop below the 48k default
|
||||
@@ -641,7 +640,7 @@ R2Stretcher::configure()
|
||||
|
||||
if (!m_realtime && fftSizeChanged) {
|
||||
delete m_studyFFT;
|
||||
m_studyFFT = new FFT(m_fftSize, m_debugLevel);
|
||||
m_studyFFT = new FFT(m_fftSize, m_log.getDebugLevel());
|
||||
m_studyFFT->initFloat();
|
||||
}
|
||||
|
||||
@@ -666,7 +665,8 @@ R2Stretcher::configure()
|
||||
}
|
||||
|
||||
params.maxBufferSize = 4096 * 16;
|
||||
params.debugLevel = (m_debugLevel > 0 ? m_debugLevel-1 : 0);
|
||||
int myLevel = m_log.getDebugLevel();
|
||||
params.debugLevel = (myLevel > 0 ? myLevel-1 : 0);
|
||||
|
||||
m_channelData[c]->resampler = new Resampler(params, 1);
|
||||
|
||||
@@ -695,7 +695,7 @@ R2Stretcher::configure()
|
||||
!(m_options & RubberBandStretcher::OptionTransientsSmooth),
|
||||
m_log);
|
||||
|
||||
m_stretchCalculator->setDebugLevel(m_debugLevel);
|
||||
m_stretchCalculator->setDebugLevel(m_log.getDebugLevel());
|
||||
m_inputDuration = 0;
|
||||
|
||||
// Prepare the inbufs with half a chunk of emptiness. The centre
|
||||
@@ -801,7 +801,8 @@ R2Stretcher::reconfigure()
|
||||
params.dynamism = Resampler::RatioOftenChanging;
|
||||
params.ratioChange = Resampler::SmoothRatioChange;
|
||||
params.maxBufferSize = m_sWindowSize;
|
||||
params.debugLevel = (m_debugLevel > 0 ? m_debugLevel-1 : 0);
|
||||
int myLevel = m_log.getDebugLevel();
|
||||
params.debugLevel = (myLevel > 0 ? myLevel-1 : 0);
|
||||
|
||||
m_channelData[c]->resampler = new Resampler(params, 1);
|
||||
|
||||
@@ -1152,8 +1153,10 @@ R2Stretcher::calculateStretch()
|
||||
void
|
||||
R2Stretcher::setDebugLevel(int level)
|
||||
{
|
||||
m_debugLevel = level;
|
||||
if (m_stretchCalculator) m_stretchCalculator->setDebugLevel(level);
|
||||
m_log.setDebugLevel(level);
|
||||
if (m_stretchCalculator) {
|
||||
m_stretchCalculator->setDebugLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
|
||||
@@ -100,7 +100,6 @@ public:
|
||||
void calculateStretch();
|
||||
|
||||
void setDebugLevel(int level);
|
||||
static void setDefaultDebugLevel(int level) { m_defaultDebugLevel = level; }
|
||||
|
||||
protected:
|
||||
size_t m_sampleRate;
|
||||
@@ -177,7 +176,6 @@ protected:
|
||||
bool m_realtime;
|
||||
RubberBandStretcher::Options m_options;
|
||||
Log m_log;
|
||||
int m_debugLevel; //!!! to go once Log switch complete
|
||||
|
||||
enum ProcessMode {
|
||||
JustCreated,
|
||||
@@ -255,7 +253,6 @@ protected:
|
||||
void writeOutput(RingBuffer<float> &to, float *from,
|
||||
size_t qty, size_t &outCount, size_t theoreticalOut);
|
||||
|
||||
static int m_defaultDebugLevel; //!!! to go
|
||||
static const size_t m_defaultIncrement;
|
||||
static const size_t m_defaultFftSize;
|
||||
};
|
||||
|
||||
@@ -441,7 +441,7 @@ R2Stretcher::processChunkForChannel(size_t c,
|
||||
modifyChunk(c, phaseIncrement, phaseReset);
|
||||
synthesiseChunk(c, shiftIncrement); // reads from cd.mag, cd.phase
|
||||
|
||||
if (m_debugLevel > 2) {
|
||||
if (m_log.getDebugLevel() > 2) {
|
||||
if (phaseReset) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
cd.accumulator[i] = 1.2f - (i % 3) * 1.2f;
|
||||
|
||||
@@ -119,10 +119,12 @@ public:
|
||||
{
|
||||
double rate = m_parameters.sampleRate;
|
||||
|
||||
m_log.log(1, "Guide: rate", rate);
|
||||
|
||||
int bandFftSize = roundUp(int(ceil(rate/16.0)));
|
||||
m_configuration.fftBandLimits[0] =
|
||||
BandLimits(bandFftSize, rate, 0.0, m_maxLower);
|
||||
|
||||
|
||||
// This is the classification and fallback FFT: we need it to
|
||||
// go up to Nyquist so we can seamlessly switch to it for
|
||||
// longer stretches
|
||||
@@ -133,6 +135,9 @@ public:
|
||||
bandFftSize = roundUp(int(ceil(rate/64.0)));
|
||||
m_configuration.fftBandLimits[2] =
|
||||
BandLimits(bandFftSize, rate, m_minHigher, rate/2.0);
|
||||
|
||||
m_log.log(1, "Guide: classification FFT size",
|
||||
m_configuration.classificationFftSize);
|
||||
}
|
||||
|
||||
const Configuration &getConfiguration() const {
|
||||
@@ -331,6 +336,10 @@ public:
|
||||
*/
|
||||
}
|
||||
|
||||
void setDebugLevel(int level) {
|
||||
m_log.setDebugLevel(level);
|
||||
}
|
||||
|
||||
protected:
|
||||
Parameters m_parameters;
|
||||
Log m_log;
|
||||
|
||||
@@ -111,17 +111,17 @@ public:
|
||||
int highest = configuration.fftBandLimits[myFftBand].b1max;
|
||||
|
||||
if (m_log.getDebugLevel() > 0 && !m_reported) {
|
||||
std::ostringstream ostr;
|
||||
ostr << "PhaseAdvance: fftSize = " << m_parameters.fftSize
|
||||
<< ": bins = " << bs << ", channels = " << channels
|
||||
<< ", inhop = "<< inhop << ", outhop = " << outhop
|
||||
<< ", ratio = " << ratio << std::endl;
|
||||
ostr << "PhaseAdvance: lowest possible bin = " << lowest
|
||||
<< " (" << configuration.fftBandLimits[myFftBand].f0min
|
||||
<< "Hz), highest = " << highest
|
||||
<< " (" << configuration.fftBandLimits[myFftBand].f1max
|
||||
<< "Hz)" << std::endl;
|
||||
m_log.log(1, ostr.str().c_str());
|
||||
m_log.log(1, "PhaseAdvance: for fftSize and bins",
|
||||
m_parameters.fftSize, bs);
|
||||
m_log.log(1, "PhaseAdvance: channels", channels);
|
||||
m_log.log(1, "PhaseAdvance: widest bin range for this size",
|
||||
lowest, highest);
|
||||
m_log.log(1, "PhaseAdvance: widest freq range for this size",
|
||||
configuration.fftBandLimits[myFftBand].f0min,
|
||||
configuration.fftBandLimits[myFftBand].f1max);
|
||||
m_log.log(1, "PhaseAdvance: initial inhop and outhop",
|
||||
inhop, outhop);
|
||||
m_log.log(1, "PhaseAdvance: initial ratio", ratio);
|
||||
m_reported = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,11 @@ R3Stretcher::R3Stretcher(Parameters parameters,
|
||||
m_totalOutputDuration(0),
|
||||
m_mode(ProcessMode::JustCreated)
|
||||
{
|
||||
m_log.log(1, "R3Stretcher::R3Stretcher: rate, options",
|
||||
m_parameters.sampleRate, m_parameters.options);
|
||||
m_log.log(1, "R3Stretcher::R3Stretcher: initial time ratio and pitch scale",
|
||||
m_timeRatio, m_pitchScale);
|
||||
|
||||
double maxClassifierFrequency = 16000.0;
|
||||
if (maxClassifierFrequency > m_parameters.sampleRate/2) {
|
||||
maxClassifierFrequency = m_parameters.sampleRate/2;
|
||||
|
||||
@@ -88,7 +88,12 @@ public:
|
||||
size_t getChannelCount() const;
|
||||
|
||||
void setDebugLevel(int level) {
|
||||
m_log.setDebugLevel(level); //!!! +others
|
||||
m_log.setDebugLevel(level);
|
||||
for (auto &sd : m_scaleData) {
|
||||
sd.second->guided.setDebugLevel(level);
|
||||
}
|
||||
m_guide.setDebugLevel(level);
|
||||
m_calculator->setDebugLevel(level);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user