From 85e7ccd8be1b0a69a95b109657eb662e959ffed4 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 29 Sep 2014 16:30:48 +0100 Subject: [PATCH] Updated some dusty code in the introjucer templates for a new plugin project. --- .../Introjucer/JuceLibraryCode/BinaryData.cpp | 113 ++++++++++-------- .../Introjucer/JuceLibraryCode/BinaryData.h | 8 +- .../jucer_AudioPluginEditorTemplate.cpp | 20 ++-- .../jucer_AudioPluginEditorTemplate.h | 15 ++- .../jucer_AudioPluginFilterTemplate.cpp | 12 +- .../jucer_AudioPluginFilterTemplate.h | 58 ++++----- 6 files changed, 126 insertions(+), 100 deletions(-) diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp index 645aaa6856..eede4cd26e 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp @@ -172,7 +172,7 @@ static const unsigned char temp_binary_data_4[] = "\r\n" " This file was auto-generated by the Introjucer!\r\n" "\r\n" -" It contains the basic startup code for a Juce application.\r\n" +" It contains the basic framework code for a JUCE plugin editor.\r\n" "\r\n" " ==============================================================================\r\n" "*/\r\n" @@ -181,10 +181,11 @@ static const unsigned char temp_binary_data_4[] = "\r\n" "\r\n" "//==============================================================================\r\n" -"EDITORCLASSNAME::EDITORCLASSNAME (FILTERCLASSNAME* ownerFilter)\r\n" -" : AudioProcessorEditor (ownerFilter)\r\n" +"EDITORCLASSNAME::EDITORCLASSNAME (FILTERCLASSNAME& p)\r\n" +" : AudioProcessorEditor (&p), processor (p)\r\n" "{\r\n" -" // This is where our plugin's editor size is set.\r\n" +" // Make sure that before the constructor has finished, you've set the\r\n" +" // editor's size to whatever you need it to be.\r\n" " setSize (400, 300);\r\n" "}\r\n" "\r\n" @@ -196,11 +197,16 @@ static const unsigned char temp_binary_data_4[] = "void EDITORCLASSNAME::paint (Graphics& g)\r\n" "{\r\n" " g.fillAll (Colours::white);\r\n" +"\r\n" " g.setColour (Colours::black);\r\n" " g.setFont (15.0f);\r\n" -" g.drawFittedText (\"Hello World!\",\r\n" -" 0, 0, getWidth(), getHeight(),\r\n" -" Justification::centred, 1);\r\n" +" g.drawFittedText (\"Hello World!\", getLocalBounds(), Justification::centred, 1);\r\n" +"}\r\n" +"\r\n" +"void EDITORCLASSNAME::resized()\r\n" +"{\r\n" +" // This is generally where you'll want to lay out the positions of any\r\n" +" // subcomponents in your editor..\r\n" "}\r\n"; const char* jucer_AudioPluginEditorTemplate_cpp = (const char*) temp_binary_data_4; @@ -212,7 +218,7 @@ static const unsigned char temp_binary_data_5[] = "\r\n" " This file was auto-generated by the Introjucer!\r\n" "\r\n" -" It contains the basic startup code for a Juce application.\r\n" +" It contains the basic framework code for a JUCE plugin editor.\r\n" "\r\n" " ==============================================================================\r\n" "*/\r\n" @@ -229,12 +235,19 @@ static const unsigned char temp_binary_data_5[] = "class EDITORCLASSNAME : public AudioProcessorEditor\r\n" "{\r\n" "public:\r\n" -" EDITORCLASSNAME (FILTERCLASSNAME* ownerFilter);\r\n" +" EDITORCLASSNAME (FILTERCLASSNAME&);\r\n" " ~EDITORCLASSNAME();\r\n" "\r\n" " //==============================================================================\r\n" -" // This is just a standard Juce paint method...\r\n" -" void paint (Graphics& g);\r\n" +" void paint (Graphics&) override;\r\n" +" void resized() override;\r\n" +"\r\n" +"private:\r\n" +" // This reference is provided as a quick way for your editor to\r\n" +" // access the processor object that created it.\r\n" +" FILTERCLASSNAME& processor;\r\n" +"\r\n" +" JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EDITORCLASSNAME)\r\n" "};\r\n" "\r\n" "\r\n" @@ -247,9 +260,9 @@ static const unsigned char temp_binary_data_6[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" -" This file was auto-generated!\r\n" +" This file was auto-generated by the Introjucer!\r\n" "\r\n" -" It contains the basic startup code for a Juce application.\r\n" +" It contains the basic framework code for a JUCE plugin processor.\r\n" "\r\n" " ==============================================================================\r\n" "*/\r\n" @@ -288,12 +301,12 @@ static const unsigned char temp_binary_data_6[] = "\r\n" "const String FILTERCLASSNAME::getParameterName (int index)\r\n" "{\r\n" -" return String::empty;\r\n" +" return String();\r\n" "}\r\n" "\r\n" "const String FILTERCLASSNAME::getParameterText (int index)\r\n" "{\r\n" -" return String::empty;\r\n" +" return String();\r\n" "}\r\n" "\r\n" "const String FILTERCLASSNAME::getInputChannelName (int channelIndex) const\r\n" @@ -361,7 +374,7 @@ static const unsigned char temp_binary_data_6[] = "\r\n" "const String FILTERCLASSNAME::getProgramName (int index)\r\n" "{\r\n" -" return String::empty;\r\n" +" return String();\r\n" "}\r\n" "\r\n" "void FILTERCLASSNAME::changeProgramName (int index, const String& newName)\r\n" @@ -410,7 +423,7 @@ static const unsigned char temp_binary_data_6[] = "\r\n" "AudioProcessorEditor* FILTERCLASSNAME::createEditor()\r\n" "{\r\n" -" return new EDITORCLASSNAME (this);\r\n" +" return new EDITORCLASSNAME (*this);\r\n" "}\r\n" "\r\n" "//==============================================================================\r\n" @@ -441,9 +454,9 @@ static const unsigned char temp_binary_data_7[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" -" This file was auto-generated!\r\n" +" This file was auto-generated by the Introjucer!\r\n" "\r\n" -" It contains the basic startup code for a Juce application.\r\n" +" It contains the basic framework code for a JUCE plugin processor.\r\n" "\r\n" " ==============================================================================\r\n" "*/\r\n" @@ -465,52 +478,52 @@ static const unsigned char temp_binary_data_7[] = " ~FILTERCLASSNAME();\r\n" "\r\n" " //==============================================================================\r\n" -" void prepareToPlay (double sampleRate, int samplesPerBlock);\r\n" -" void releaseResources();\r\n" +" void prepareToPlay (double sampleRate, int samplesPerBlock) override;\r\n" +" void releaseResources() override;\r\n" "\r\n" -" void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages);\r\n" +" void processBlock (AudioSampleBuffer&, MidiBuffer&) override;\r\n" "\r\n" " //==============================================================================\r\n" -" AudioProcessorEditor* createEditor();\r\n" -" bool hasEditor() const;\r\n" +" AudioProcessorEditor* createEditor() override;\r\n" +" bool hasEditor() const override;\r\n" "\r\n" " //==============================================================================\r\n" -" const String getName() const;\r\n" +" const String getName() const override;\r\n" "\r\n" -" int getNumParameters();\r\n" +" int getNumParameters() override;\r\n" +" float getParameter (int index) override;\r\n" +" void setParameter (int index, float newValue) override;\r\n" "\r\n" -" float getParameter (int index);\r\n" -" void setParameter (int index, float newValue);\r\n" +" const String getParameterName (int index) override;\r\n" +" const String getParameterText (int index) override;\r\n" "\r\n" -" const String getParameterName (int index);\r\n" -" const String getParameterText (int index);\r\n" +" const String getInputChannelName (int channelIndex) const override;\r\n" +" const String getOutputChannelName (int channelIndex) const override;\r\n" +" bool isInputChannelStereoPair (int index) const override;\r\n" +" bool isOutputChannelStereoPair (int index) const override;\r\n" "\r\n" -" const String getInputChannelName (int channelIndex) const;\r\n" -" const String getOutputChannelName (int channelIndex) const;\r\n" -" bool isInputChannelStereoPair (int index) const;\r\n" -" bool isOutputChannelStereoPair (int index) const;\r\n" -"\r\n" -" bool acceptsMidi() const;\r\n" -" bool producesMidi() const;\r\n" -" bool silenceInProducesSilenceOut() const;\r\n" -" double getTailLengthSeconds() const;\r\n" +" bool acceptsMidi() const override;\r\n" +" bool producesMidi() const override;\r\n" +" bool silenceInProducesSilenceOut() const override;\r\n" +" double getTailLengthSeconds() const override;\r\n" "\r\n" " //==============================================================================\r\n" -" int getNumPrograms();\r\n" -" int getCurrentProgram();\r\n" -" void setCurrentProgram (int index);\r\n" -" const String getProgramName (int index);\r\n" -" void changeProgramName (int index, const String& newName);\r\n" +" int getNumPrograms() override;\r\n" +" int getCurrentProgram() override;\r\n" +" void setCurrentProgram (int index) override;\r\n" +" const String getProgramName (int index) override;\r\n" +" void changeProgramName (int index, const String& newName) override;\r\n" "\r\n" " //==============================================================================\r\n" -" void getStateInformation (MemoryBlock& destData);\r\n" -" void setStateInformation (const void* data, int sizeInBytes);\r\n" +" void getStateInformation (MemoryBlock& destData) override;\r\n" +" void setStateInformation (const void* data, int sizeInBytes) override;\r\n" "\r\n" "private:\r\n" " //==============================================================================\r\n" " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FILTERCLASSNAME)\r\n" "};\r\n" "\r\n" +"\r\n" "#endif // HEADERGUARD\r\n"; const char* jucer_AudioPluginFilterTemplate_h = (const char*) temp_binary_data_7; @@ -1234,10 +1247,10 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw case 0x4a0cfd09: numBytes = 151; return background_tile_png; case 0x763d39dc: numBytes = 1050; return colourscheme_dark_xml; case 0xe8b08520: numBytes = 1050; return colourscheme_light_xml; - case 0x27c5a93a: numBytes = 1008; return jucer_AudioPluginEditorTemplate_cpp; - case 0x4d0721bf: numBytes = 799; return jucer_AudioPluginEditorTemplate_h; - case 0x51b49ac5: numBytes = 5028; return jucer_AudioPluginFilterTemplate_cpp; - case 0x488afa0a: numBytes = 2488; return jucer_AudioPluginFilterTemplate_h; + case 0x27c5a93a: numBytes = 1180; return jucer_AudioPluginEditorTemplate_cpp; + case 0x4d0721bf: numBytes = 1012; return jucer_AudioPluginEditorTemplate_h; + case 0x51b49ac5: numBytes = 5039; return jucer_AudioPluginFilterTemplate_cpp; + case 0x488afa0a: numBytes = 2727; return jucer_AudioPluginFilterTemplate_h; case 0xabad7041: numBytes = 2083; return jucer_ComponentTemplate_cpp; case 0xfc72fe86: numBytes = 2156; return jucer_ComponentTemplate_h; case 0x0b66646c: numBytes = 886; return jucer_ContentCompTemplate_cpp; diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.h b/extras/Introjucer/JuceLibraryCode/BinaryData.h index 2a2034eb42..d8b0ee86f1 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.h +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.h @@ -22,16 +22,16 @@ namespace BinaryData const int colourscheme_light_xmlSize = 1050; extern const char* jucer_AudioPluginEditorTemplate_cpp; - const int jucer_AudioPluginEditorTemplate_cppSize = 1008; + const int jucer_AudioPluginEditorTemplate_cppSize = 1180; extern const char* jucer_AudioPluginEditorTemplate_h; - const int jucer_AudioPluginEditorTemplate_hSize = 799; + const int jucer_AudioPluginEditorTemplate_hSize = 1012; extern const char* jucer_AudioPluginFilterTemplate_cpp; - const int jucer_AudioPluginFilterTemplate_cppSize = 5028; + const int jucer_AudioPluginFilterTemplate_cppSize = 5039; extern const char* jucer_AudioPluginFilterTemplate_h; - const int jucer_AudioPluginFilterTemplate_hSize = 2488; + const int jucer_AudioPluginFilterTemplate_hSize = 2727; extern const char* jucer_ComponentTemplate_cpp; const int jucer_ComponentTemplate_cppSize = 2083; diff --git a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.cpp b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.cpp index ae75de1247..fdc4dfa4c5 100644 --- a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.cpp +++ b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.cpp @@ -3,7 +3,7 @@ This file was auto-generated by the Introjucer! - It contains the basic startup code for a Juce application. + It contains the basic framework code for a JUCE plugin editor. ============================================================================== */ @@ -12,10 +12,11 @@ EDITORCPPHEADERS //============================================================================== -EDITORCLASSNAME::EDITORCLASSNAME (FILTERCLASSNAME* ownerFilter) - : AudioProcessorEditor (ownerFilter) +EDITORCLASSNAME::EDITORCLASSNAME (FILTERCLASSNAME& p) + : AudioProcessorEditor (&p), processor (p) { - // This is where our plugin's editor size is set. + // Make sure that before the constructor has finished, you've set the + // editor's size to whatever you need it to be. setSize (400, 300); } @@ -27,9 +28,14 @@ EDITORCLASSNAME::~EDITORCLASSNAME() void EDITORCLASSNAME::paint (Graphics& g) { g.fillAll (Colours::white); + g.setColour (Colours::black); g.setFont (15.0f); - g.drawFittedText ("Hello World!", - 0, 0, getWidth(), getHeight(), - Justification::centred, 1); + g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1); +} + +void EDITORCLASSNAME::resized() +{ + // This is generally where you'll want to lay out the positions of any + // subcomponents in your editor.. } diff --git a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.h b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.h index 2553c4554c..ba60b16d2f 100644 --- a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.h +++ b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginEditorTemplate.h @@ -3,7 +3,7 @@ This file was auto-generated by the Introjucer! - It contains the basic startup code for a Juce application. + It contains the basic framework code for a JUCE plugin editor. ============================================================================== */ @@ -20,12 +20,19 @@ EDITORHEADERS class EDITORCLASSNAME : public AudioProcessorEditor { public: - EDITORCLASSNAME (FILTERCLASSNAME* ownerFilter); + EDITORCLASSNAME (FILTERCLASSNAME&); ~EDITORCLASSNAME(); //============================================================================== - // This is just a standard Juce paint method... - void paint (Graphics& g); + void paint (Graphics&) override; + void resized() override; + +private: + // This reference is provided as a quick way for your editor to + // access the processor object that created it. + FILTERCLASSNAME& processor; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EDITORCLASSNAME) }; diff --git a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp index 261353b47a..f30aafe18a 100644 --- a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp +++ b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.cpp @@ -1,9 +1,9 @@ /* ============================================================================== - This file was auto-generated! + This file was auto-generated by the Introjucer! - It contains the basic startup code for a Juce application. + It contains the basic framework code for a JUCE plugin processor. ============================================================================== */ @@ -42,12 +42,12 @@ void FILTERCLASSNAME::setParameter (int index, float newValue) const String FILTERCLASSNAME::getParameterName (int index) { - return String::empty; + return String(); } const String FILTERCLASSNAME::getParameterText (int index) { - return String::empty; + return String(); } const String FILTERCLASSNAME::getInputChannelName (int channelIndex) const @@ -115,7 +115,7 @@ void FILTERCLASSNAME::setCurrentProgram (int index) const String FILTERCLASSNAME::getProgramName (int index) { - return String::empty; + return String(); } void FILTERCLASSNAME::changeProgramName (int index, const String& newName) @@ -164,7 +164,7 @@ bool FILTERCLASSNAME::hasEditor() const AudioProcessorEditor* FILTERCLASSNAME::createEditor() { - return new EDITORCLASSNAME (this); + return new EDITORCLASSNAME (*this); } //============================================================================== diff --git a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h index 875f1375f5..b5821d728d 100644 --- a/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h +++ b/extras/Introjucer/Source/BinaryData/jucer_AudioPluginFilterTemplate.h @@ -1,9 +1,9 @@ /* ============================================================================== - This file was auto-generated! + This file was auto-generated by the Introjucer! - It contains the basic startup code for a Juce application. + It contains the basic framework code for a JUCE plugin processor. ============================================================================== */ @@ -25,50 +25,50 @@ public: ~FILTERCLASSNAME(); //============================================================================== - void prepareToPlay (double sampleRate, int samplesPerBlock); - void releaseResources(); + void prepareToPlay (double sampleRate, int samplesPerBlock) override; + void releaseResources() override; - void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); + void processBlock (AudioSampleBuffer&, MidiBuffer&) override; //============================================================================== - AudioProcessorEditor* createEditor(); - bool hasEditor() const; + AudioProcessorEditor* createEditor() override; + bool hasEditor() const override; //============================================================================== - const String getName() const; + const String getName() const override; - int getNumParameters(); + int getNumParameters() override; + float getParameter (int index) override; + void setParameter (int index, float newValue) override; - float getParameter (int index); - void setParameter (int index, float newValue); + const String getParameterName (int index) override; + const String getParameterText (int index) override; - const String getParameterName (int index); - const String getParameterText (int index); + const String getInputChannelName (int channelIndex) const override; + const String getOutputChannelName (int channelIndex) const override; + bool isInputChannelStereoPair (int index) const override; + bool isOutputChannelStereoPair (int index) const override; - const String getInputChannelName (int channelIndex) const; - const String getOutputChannelName (int channelIndex) const; - bool isInputChannelStereoPair (int index) const; - bool isOutputChannelStereoPair (int index) const; - - bool acceptsMidi() const; - bool producesMidi() const; - bool silenceInProducesSilenceOut() const; - double getTailLengthSeconds() const; + bool acceptsMidi() const override; + bool producesMidi() const override; + bool silenceInProducesSilenceOut() const override; + double getTailLengthSeconds() const override; //============================================================================== - int getNumPrograms(); - int getCurrentProgram(); - void setCurrentProgram (int index); - const String getProgramName (int index); - void changeProgramName (int index, const String& newName); + int getNumPrograms() override; + int getCurrentProgram() override; + void setCurrentProgram (int index) override; + const String getProgramName (int index) override; + void changeProgramName (int index, const String& newName) override; //============================================================================== - void getStateInformation (MemoryBlock& destData); - void setStateInformation (const void* data, int sizeInBytes); + void getStateInformation (MemoryBlock& destData) override; + void setStateInformation (const void* data, int sizeInBytes) override; private: //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FILTERCLASSNAME) }; + #endif // HEADERGUARD