Skip to content

Commit

Permalink
Using std::unique_ptr instead of deprecated juce::ScopedPointer
Browse files Browse the repository at this point in the history
  • Loading branch information
getdunne committed Oct 17, 2019
1 parent d6887e7 commit c982fda
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Source/ChangeNotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _CHANGENOTIFIER_H
#define _CHANGENOTIFIER_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include <set>

Expand Down
2 changes: 1 addition & 1 deletion Source/Convolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Convolver::Convolver() :
_backgroundProcessingFinished(1),
_backgroundProcessingFinishedEvent(true)
{
_thread = new ConvolverBackgroundThread(*this);
_thread.reset(new ConvolverBackgroundThread(*this));
_backgroundProcessingFinishedEvent.signal();
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Convolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// http://www.juce.com/forum/topic/reference-point-ambiguous
#include "FFTConvolver/TwoStageFFTConvolver.h"

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"



Expand All @@ -40,7 +40,7 @@ class Convolver : public fftconvolver::TwoStageFFTConvolver
private:
friend class ConvolverBackgroundThread;

juce::ScopedPointer<juce::Thread> _thread;
std::unique_ptr<juce::Thread> _thread;
std::atomic<uint32> _backgroundProcessingFinished;
juce::WaitableEvent _backgroundProcessingFinishedEvent;
};
Expand Down
2 changes: 1 addition & 1 deletion Source/DecibelScaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define _DECIBELSCALING_H


#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"


struct DecibelScaling
Expand Down
2 changes: 1 addition & 1 deletion Source/IRAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _IRAGENT_H
#define _IRAGENT_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "ChangeNotifier.h"
#include "CookbookEq.h"
Expand Down
4 changes: 2 additions & 2 deletions Source/IRCalculation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ void IRCalculation::run()
_processor.setParameter(Parameters::AutoGainDecibels, DecibelScaling::Gain2Db(autoGain));
for (size_t i=0; i<agents.size(); ++i)
{
juce::ScopedPointer<Convolver> convolver(new Convolver());
std::unique_ptr<Convolver> convolver(new Convolver());
if (buffers[i] != nullptr && buffers[i]->getSize() > 0)
{
convolver = new Convolver();
convolver.reset(new Convolver());
const bool successInit = convolver->init(headBlockSize, tailBlockSize, buffers[i]->data(), buffers[i]->getSize());
if (!successInit || threadShouldExit())
{
Expand Down
2 changes: 1 addition & 1 deletion Source/IRCalculation.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _IRMANAGER_H
#define _IRMANAGER_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "Processor.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/LevelMeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _LEVELMEASUREMENT_H
#define _LEVELMEASUREMENT_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include <cstddef>

Expand Down
2 changes: 1 addition & 1 deletion Source/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _PARAMETERS_H
#define _PARAMETERS_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "ParameterSet.h"

Expand Down
2 changes: 1 addition & 1 deletion Source/Persistence.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define _PERSISTENCE_H


#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"
#include "Processor.h"


Expand Down
4 changes: 2 additions & 2 deletions Source/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ AudioProcessorEditor* Processor::createEditor()
void Processor::getStateInformation (MemoryBlock& destData)
{
const juce::File irDirectory = _settings.getImpulseResponseDirectory();
juce::ScopedPointer<juce::XmlElement> element(SaveState(irDirectory, *this));
std::unique_ptr<juce::XmlElement> element(SaveState(irDirectory, *this));
if (element)
{
copyXmlToBinary(*element, destData);
Expand Down Expand Up @@ -841,7 +841,7 @@ void Processor::updateConvolvers()
_irCalculation->stopThread(-1);
_irCalculation = nullptr;
}
_irCalculation = new IRCalculation(*this);
_irCalculation.reset(new IRCalculation(*this));
}


Expand Down
4 changes: 2 additions & 2 deletions Source/Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _PROCESSOR_H
#define _PROCESSOR_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "ChangeNotifier.h"
#include "IRAgent.h"
Expand Down Expand Up @@ -184,7 +184,7 @@ class Processor : public AudioProcessor, public ChangeNotifier
std::atomic<float> _beatsPerMinute;

mutable juce::CriticalSection _irCalculationMutex;
juce::ScopedPointer<juce::Thread> _irCalculation;
std::unique_ptr<juce::Thread> _irCalculation;

//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Processor);
Expand Down
2 changes: 1 addition & 1 deletion Source/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _SETTINGS_H
#define _SETTINGS_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"


class Settings
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/CustomLookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _CUSTOMLOOKANDFEEL_H
#define _CUSTOMLOOKANDFEEL_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

class CustomLookAndFeel : public juce::LookAndFeel_V3
{
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/DecibelScale.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define _DECIBELSCALE_H


#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "CustomLookAndFeel.h"
#include "../DecibelScaling.h"
Expand Down
18 changes: 9 additions & 9 deletions Source/UI/IRBrowserComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ void IRBrowserComponent::init(Processor* processor)

if (!_timeSliceThread)
{
_timeSliceThread = new juce::TimeSliceThread("IRBrowserThread");
_timeSliceThread.reset(new juce::TimeSliceThread("IRBrowserThread"));
_timeSliceThread->startThread();
}

juce::AudioFormatManager formatManager;
formatManager.registerBasicFormats();
_fileFilter = new juce::WildcardFileFilter(formatManager.getWildcardForAllFormats(),
_fileFilter.reset(new juce::WildcardFileFilter(formatManager.getWildcardForAllFormats(),
"*",
"Audio Files");
"Audio Files"));

_directoryContent = new juce::DirectoryContentsList(_fileFilter, *_timeSliceThread);
_directoryContent.reset(new juce::DirectoryContentsList(_fileFilter.get(), *_timeSliceThread));
_directoryContent->setDirectory(settings ? settings->getImpulseResponseDirectory() : juce::File(), true, true);

_fileTreeComponent = new juce::FileTreeComponent(*_directoryContent);
_fileTreeComponent.reset(new juce::FileTreeComponent(*_directoryContent));
_fileTreeComponent->addListener(this);
addAndMakeVisible(_fileTreeComponent);
addAndMakeVisible(_fileTreeComponent.get());

_infoLabel = new juce::Label();
addAndMakeVisible(_infoLabel);
_infoLabel.reset(new juce::Label());
addAndMakeVisible(_infoLabel.get());

updateLayout();
}
Expand Down Expand Up @@ -287,7 +287,7 @@ bool IRBrowserComponent::readAudioFileInfo(const juce::File& file, size_t& chann
{
juce::AudioFormatManager formatManager;
formatManager.registerBasicFormats();
juce::ScopedPointer<juce::AudioFormatReader> reader(formatManager.createReaderFor(file));
std::unique_ptr<juce::AudioFormatReader> reader(formatManager.createReaderFor(file));
if (reader)
{
channelCount = static_cast<size_t>(reader->numChannels);
Expand Down
12 changes: 6 additions & 6 deletions Source/UI/IRBrowserComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define _IRBROWSERCOMPONENT_H


#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "../Processor.h"
#include "../Settings.h"
Expand Down Expand Up @@ -59,11 +59,11 @@ class IRBrowserComponent : public juce::Component,
const size_t sampleCount,
const double sampleRate) const;

juce::ScopedPointer<juce::TimeSliceThread> _timeSliceThread;
juce::ScopedPointer<juce::FileFilter> _fileFilter;
juce::ScopedPointer<juce::DirectoryContentsList> _directoryContent;
juce::ScopedPointer<juce::FileTreeComponent> _fileTreeComponent;
juce::ScopedPointer<juce::Label> _infoLabel;
std::unique_ptr<juce::TimeSliceThread> _timeSliceThread;
std::unique_ptr<juce::FileFilter> _fileFilter;
std::unique_ptr<juce::DirectoryContentsList> _directoryContent;
std::unique_ptr<juce::FileTreeComponent> _fileTreeComponent;
std::unique_ptr<juce::Label> _infoLabel;
Processor* _processor;

IRBrowserComponent(const IRBrowserComponent&);
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/IRComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define __JUCER_HEADER_IRCOMPONENT_IRCOMPONENT_7F964DEC__

//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "WaveformComponent.h"
#include "../IRAgent.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/KlangFalterEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define __JUCER_HEADER_KLANGFALTEREDITOR_KLANGFALTEREDITOR_F5E4498E__

//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "CustomLookAndFeel.h"
#include "DecibelScale.h"
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/LevelMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _LEVELMETER_H
#define _LEVELMETER_H

#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "CustomLookAndFeel.h"
#include "../LevelMeasurement.h"
Expand Down
12 changes: 7 additions & 5 deletions Source/UI/SettingsDialogComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ SettingsDialogComponent::SettingsDialogComponent (Processor& processor)

//[UserPreSize]
const juce::File irDirectory = _processor.getSettings().getImpulseResponseDirectory();
_irDirectoryBrowserComponent = new juce::FileBrowserComponent(juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectDirectories | juce::FileBrowserComponent::filenameBoxIsReadOnly,
irDirectory,
nullptr,
nullptr);
_irDirectoryBrowserComponent.reset(new juce::FileBrowserComponent(juce::FileBrowserComponent::openMode |
juce::FileBrowserComponent::canSelectDirectories |
juce::FileBrowserComponent::filenameBoxIsReadOnly,
irDirectory,
nullptr,
nullptr));
_irDirectoryBrowserComponent->setFilenameBoxLabel(juce::String("Folder:"));
_irDirectoryBrowserComponent->setFileName(irDirectory.getFullPathName());
_irDirectoryGroupComponent->addAndMakeVisible(_irDirectoryBrowserComponent);
_irDirectoryGroupComponent->addAndMakeVisible(_irDirectoryBrowserComponent.get());
//[/UserPreSize]

setSize(504, 580);
Expand Down
4 changes: 2 additions & 2 deletions Source/UI/SettingsDialogComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define __JUCER_HEADER_SETTINGSDIALOGCOMPONENT_SETTINGSDIALOGCOMPONENT_9545D2EA__

//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "../Processor.h"
//[/Headers]
Expand Down Expand Up @@ -65,7 +65,7 @@ class SettingsDialogComponent : public Component,
private:
//[UserVariables] -- You can add your own custom variables in this section.
Processor& _processor;
juce::ScopedPointer<juce::FileBrowserComponent> _irDirectoryBrowserComponent;
std::unique_ptr<juce::FileBrowserComponent> _irDirectoryBrowserComponent;
//[/UserVariables]

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/WaveformComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define _WAVEFORMCOMPONENT_H


#include "../JuceLibraryCode/JuceHeader.h"
#include "JuceHeader.h"

#include "CustomLookAndFeel.h"
#include "../Envelope.h"
Expand Down

0 comments on commit c982fda

Please sign in to comment.