Skip to content

Commit

Permalink
Cleaner way to define custom stand-alone app
Browse files Browse the repository at this point in the history
JUCE now supports the JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP declaration, which can be put in the .jucer file.
  • Loading branch information
getdunne committed Oct 17, 2019
1 parent c982fda commit 99aa8c8
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions Source/DevelopmentApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// ==================================================================================

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


// This is a dirty trick for switching easily between
// plug-in builds and development application builds
#ifndef JucePlugin_Name
#include "JuceHeader.h"


#include "Processor.h"
Expand Down Expand Up @@ -159,17 +154,17 @@ class DevelopmentApplicationWindow : public DocumentWindow
if (reader)
{
// Audio file
_audioFileSource = new AudioFormatReaderSource(reader, true);
_audioFileSource.reset(new AudioFormatReaderSource(reader, true));

// Audio processor
_audioProcessor = createPluginFilter();
_audioProcessor.reset(createPluginFilter());
if (_audioProcessor)
{
// UI
_editor = dynamic_cast<KlangFalterEditor*>(_audioProcessor->createEditor());
_editor.reset(dynamic_cast<KlangFalterEditor*>(_audioProcessor->createEditor()));
if (_editor)
{
setContentNonOwned(_editor, true);
setContentNonOwned(_editor.get(), true);
}

_deviceManager.initialise(2, 2, nullptr, true);
Expand All @@ -187,7 +182,7 @@ class DevelopmentApplicationWindow : public DocumentWindow
}
}
}
_audioSourceProcessorPlayer.init(_audioFileSource, _audioProcessor);
_audioSourceProcessorPlayer.init(_audioFileSource.get(), _audioProcessor.get());
_deviceManager.addAudioCallback(&_audioSourceProcessorPlayer);

// Try to reload last session
Expand Down Expand Up @@ -231,10 +226,10 @@ class DevelopmentApplicationWindow : public DocumentWindow
}

private:
juce::ScopedPointer<KlangFalterEditor> _editor;
std::unique_ptr<KlangFalterEditor> _editor;
AudioDeviceManager _deviceManager;
juce::ScopedPointer<AudioFormatReaderSource> _audioFileSource;
juce::ScopedPointer<AudioProcessor> _audioProcessor;
std::unique_ptr<AudioFormatReaderSource> _audioFileSource;
std::unique_ptr<AudioProcessor> _audioProcessor;
AudioSourceProcessorPlayer _audioSourceProcessorPlayer;

};
Expand Down Expand Up @@ -301,5 +296,3 @@ class DevelopmentApplication : public JUCEApplication

// This macro generates the main() routine that starts the app.
START_JUCE_APPLICATION(DevelopmentApplication)

#endif // JucePlugin_Name

0 comments on commit 99aa8c8

Please sign in to comment.