Hi Everyone,
I’m playing multiple fixed wavFiles through my plugin according to the AverageRMSofAllChannels. Everything plays fine but i keep having that Error message coming up when i click at the “cross case” to close my plugin (none when i stop the build ):
if (numObjects.value > 0.1)
{
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << getLeakedObjectClassName());
/** If you hit this, then you've leaked one or more objects of the type specified by
the 'OwnerClass' template parameter - the name should have been printed by the line above.
If you're leaking, it's probably because you're using old-fashioned, non-RAII techniques for
your object management. Tut, tut. Always, always use std::unique_ptrs, OwnedArrays,
ReferenceCountedObjects, etc, and avoid the 'delete' operator at all costs!
*/
jassertfalse;
}
in my constructor:
auto reader = formatManager.createReaderFor(std::make_unique<juce::MemoryInputStream>(BinaryData::Test1_wav, BinaryData::Test1_wavSize, false));
if (reader != nullptr)
{
std::unique_ptr<juce::AudioFormatReaderSource> newSource(new juce::AudioFormatReaderSource(reader, true));
newSource->setLooping(true);
transportSource.setSource(newSource.release());
mixer.addInputSource(&transportSource, false);
}
auto reader2 = formatManager.createReaderFor(std::make_unique<juce::MemoryInputStream>(BinaryData::Test2_wav, BinaryData::Test2_wavSize, false));
if (reader2 != nullptr)
{
std::unique_ptr<juce::AudioFormatReaderSource> newSource2(new juce::AudioFormatReaderSource(reader2, true));
newSource2->setLooping(true);
transportSource2.setSource(newSource2.release());
mixer.addInputSource(&transportSource2, false);
}
and into the processBlock
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear(i, 0, buffer.getNumSamples());
if (getAverageRMSofAllChannels(buffer) > 0.1 )
{
if (onDragIsStart == false)
{
play();
}
}
else
{
stop();
}
mixer.getNextAudioBlock(juce::AudioSourceChannelInfo(buffer));
I’m struggling figuring out what i do wrong would anybody get a clue ? thanks a lot!