Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Ebu128LoudnessMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Ebu128LoudnessMeter::Ebu128LoudnessMeter()
currentBlockIsSilent (false)
{
DBG ("The longest possible measurement until a buffer overflow = "
+ String (INT_MAX / 10. / 3600. / 365.) + " years");
+ juce::String (INT_MAX / 10. / 3600. / 365.) + " years");

// If this class is used without caution and processBlock
// is called before prepareToPlay, divisions by zero
Expand Down Expand Up @@ -142,13 +142,13 @@ void Ebu128LoudnessMeter::prepareToPlay (double sampleRate,
if (expectedRequestRate > sampleRate/2)
{
expectedRequestRate = 10;
DEB ("Not possible to make expectedRequestRate a multiple of 10 and "
DBG ("Not possible to make expectedRequestRate a multiple of 10 and "
"a divisor of the samplerate.");
break;
}
}

DEB ("expectedRequestRate = " + String(expectedRequestRate));
DBG ("expectedRequestRate = " + juce::String(expectedRequestRate));

// Figure out how many bins are needed.
const int timeOfAccumulationForShortTerm = 3; // seconds.
Expand All @@ -158,9 +158,9 @@ void Ebu128LoudnessMeter::prepareToPlay (double sampleRate,
numberOfSamplesInAllBins = numberOfBins * numberOfSamplesPerBin;

numberOfBinsToCover100ms = int (0.1 * expectedRequestRate);
DEB ("numberOfBinsToCover100ms = " + String (numberOfBinsToCover100ms));
DBG ("numberOfBinsToCover100ms = " + juce::String (numberOfBinsToCover100ms));
numberOfBinsToCover400ms = int (0.4 * expectedRequestRate);
DEB ("numberOfBinsToCover400ms = " + String (numberOfBinsToCover400ms));
DBG ("numberOfBinsToCover400ms = " + juce::String (numberOfBinsToCover400ms));
numberOfSamplesIn400ms = numberOfBinsToCover400ms * numberOfSamplesPerBin;

currentBin = 0;
Expand Down Expand Up @@ -212,7 +212,7 @@ void Ebu128LoudnessMeter::processBlock (const juce::AudioSampleBuffer& buffer)
if (magnitude < silenceThreshold)
{
currentBlockIsSilent = true;
DEB ("Silence detected.")
DBG ("Silence detected.");
}
else
currentBlockIsSilent = false;
Expand Down Expand Up @@ -252,10 +252,10 @@ void Ebu128LoudnessMeter::processBlock (const juce::AudioSampleBuffer& buffer)
// ---------------------------------------
// To prevent EXC_BAD_ACCESS when the number of channels in the buffer
// suddenly changes without calling prepareToPlay() in advance.
const int numberOfChannels = jmin (bufferForMeasurement.getNumChannels(),
const int numberOfChannels = juce::jmin (bufferForMeasurement.getNumChannels(),
int (bin.size()),
int (averageOfTheLast400ms.size()),
jmin (int (averageOfTheLast3s.size()),
juce::jmin (int (averageOfTheLast3s.size()),
int (channelWeighting.size())));
jassert (bufferForMeasurement.getNumChannels() == int (bin.size()));
jassert (bufferForMeasurement.getNumChannels() == int (averageOfTheLast400ms.size()));
Expand Down Expand Up @@ -360,7 +360,7 @@ void Ebu128LoudnessMeter::processBlock (const juce::AudioSampleBuffer& buffer)

if (weightedSum > 0.0)
// This refers to equation (2) in ITU-R BS.1770-2
shortTermLoudness = jmax (float (-0.691 + 10.* std::log10(weightedSum)), minimalReturnValue);
shortTermLoudness = juce::jmax (float (-0.691 + 10.* std::log10(weightedSum)), minimalReturnValue);
else
// Since returning a value of -nan most probably would lead to
// a malfunction, return the minimal return value.
Expand Down Expand Up @@ -407,7 +407,7 @@ void Ebu128LoudnessMeter::processBlock (const juce::AudioSampleBuffer& buffer)

if (weightedSum > 0.0)
// This refers to equation (2) in ITU-R BS.1770-2
momentaryLoudness = jmax (float (-0.691 + 10. * std::log10(weightedSum)), minimalReturnValue);
momentaryLoudness = juce::jmax (float (-0.691 + 10. * std::log10(weightedSum)), minimalReturnValue);
else
// Since returning a value of -nan most probably would lead to
// a malfunction, return a minimal return value.
Expand Down Expand Up @@ -698,7 +698,7 @@ vector<float>& Ebu128LoudnessMeter::getMomentaryLoudnessForIndividualChannels()
if (averageOfTheLast400ms[k] > 0.0f)
{
// This refers to equation (2) in ITU-R BS.1770-2
kthChannelMomentaryLoudness = jmax (float (-0.691 + 10. * std::log10(averageOfTheLast400ms[k])), minimalReturnValue);
kthChannelMomentaryLoudness = juce::jmax (float (-0.691 + 10. * std::log10(averageOfTheLast400ms[k])), minimalReturnValue);
}

momentaryLoudnessForIndividualChannels[k] = kthChannelMomentaryLoudness;
Expand Down
4 changes: 2 additions & 2 deletions Ebu128LoudnessMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Ebu128LoudnessMeter //: public AudioProcessor
int estimatedSamplesPerBlock,
int expectedRequestRate);

void processBlock (const AudioSampleBuffer& buffer);
void processBlock (const juce::AudioSampleBuffer& buffer);

float getShortTermLoudness() const;
float getMaximumShortTermLoudness() const;
Expand Down Expand Up @@ -119,7 +119,7 @@ class Ebu128LoudnessMeter //: public AudioProcessor

It also stores the number of input channels implicitely, set in prepareToPlay.
*/
AudioSampleBuffer bufferForMeasurement;
juce::AudioSampleBuffer bufferForMeasurement;

SecondOrderIIRFilter preFilter;
SecondOrderIIRFilter revisedLowFrequencyBCurveFilter;
Expand Down
8 changes: 4 additions & 4 deletions docs/developmentNotes/130104_var_and_Value_playground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int main (int argc, char* argv[])
cout << "Various var's " << endl;
cout << "------------------" << endl;

var aVar;
juce::var aVar;
aVar.append (1.2); // This also converts the value inside the var
// to an Array<var>.
aVar.append (2.2);
Expand Down Expand Up @@ -55,9 +55,9 @@ int main (int argc, char* argv[])
cout << "------------------" << endl;


const Array<var> tempArrayOfVars;
var tempVar (tempArrayOfVars);
Value valery (tempVar); // valery now contains a copy of v.
const juce::Array<juce::var> tempArrayOfVars;
juce::var tempVar (tempArrayOfVars);
juce::Value valery (tempVar); // valery now contains a copy of v.

valery.getValue().append(0.0);
// This does NOT WORK, since getValue returns a
Expand Down
4 changes: 2 additions & 2 deletions filters/SecondOrderIIRFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ void SecondOrderIIRFilter::releaseResources()
{
}

void SecondOrderIIRFilter::processBlock (AudioSampleBuffer& buffer)
void SecondOrderIIRFilter::processBlock (juce::AudioSampleBuffer& buffer)
{
const int numOfChannels = jmin (numberOfChannels, buffer.getNumChannels());
const int numOfChannels = juce::jmin (numberOfChannels, buffer.getNumChannels());

for (int channel = 0; channel < numOfChannels; ++channel)
{
Expand Down
6 changes: 3 additions & 3 deletions filters/SecondOrderIIRFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SecondOrderIIRFilter
virtual void releaseResources();

// Renders the next block.
void processBlock (AudioSampleBuffer& buffer);
void processBlock (juce::AudioSampleBuffer& buffer);

void reset();

Expand All @@ -111,11 +111,11 @@ class SecondOrderIIRFilter

/** Stores the previous value of the variable factorForB2 for every audio channel.
*/
HeapBlock<double> z1;
juce::HeapBlock<double> z1;

/** Stores the previous value of z1 for every audio channel.
*/
HeapBlock<double> z2;
juce::HeapBlock<double> z2;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SecondOrderIIRFilter);
};
Expand Down