음악, 삶, 개발

VST3 Main.cpp 본문

개발 공부/Juce 공부방

VST3 Main.cpp

Lee_____ 2020. 9. 10. 22:05

VST3 를 컴파일할수있는 가장 기본적인 코드.

이 코드를 기본으로 깔고, 기능을 만들어가면됨.

 

#include <JuceHeader.h>

class MainProcessor : public juce::AudioProcessor {

    public:

        MainProcessor() 
            
            : AudioProcessor(BusesProperties().withOutput("Output", juce::AudioChannelSet::stereo(), true))
        
        {
            
            

        }
        ~MainProcessor() override {

        }
        bool hasEditor() const override {

            return true;

        }
        juce::AudioProcessorEditor* createEditor() override;
        const juce::String getName() const override {

            return JucePlugin_Name;

        }
        double getTailLengthSeconds() const override {

            return 0.0;

        }
        bool acceptsMidi() const override {

            return true;

        }
        bool producesMidi() const override {

            return true;

        }
        int getNumPrograms() override {
            
            // NB: some hosts don't cope very well if you tell them there are 0 programs,
            // so this should be at least 1, even if you're not really implementing programs.
            return 1;

        }
        int getCurrentProgram() override {
            
            return 0;

        }
        void setCurrentProgram(int index) override {

            

        }
        const juce::String getProgramName(int index) override {

            return juce::String();

        }
        void changeProgramName(int index, const juce::String& newName) override {


        }
        void getStateInformation(juce::MemoryBlock& destData) override {

            // You should use this method to store your parameters in the memory block.
            // You could do that either as raw data, or use the XML or ValueTree classes
            // as intermediaries to make it easy to save and load complex data.

        }
        void setStateInformation(const void* data, int sizeInBytes) override {
            
            // You should use this method to restore your parameters from this memory block,
            // whose contents will have been created by the getStateInformation() call.

        }
        void prepareToPlay(double sampleRate, int maximumExpectedSamplesPerBlock) override {


        }
        void releaseResources() override {


        }
        void processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages) override {


        }

    private:

        JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainProcessor)

};

class MainEditor : public juce::AudioProcessorEditor {

    public :

        MainEditor(MainProcessor& p) 
            
            : AudioProcessorEditor(&p), mainProcessor(p)
        
        {
            
            setSize(400, 300);
        
        }
        ~MainEditor() override {}
        void paint(juce::Graphics& g) override {

            g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
            g.setColour(juce::Colours::white);
            g.setFont(15.0f);
            g.drawFittedText("Hello World! SEX?", getLocalBounds(), juce::Justification::centred, 1);

        }
        void resized() override {

            
        }

    private :

        MainProcessor& mainProcessor;
    
};

juce::AudioProcessorEditor* MainProcessor::createEditor() {

    return new MainEditor(*this);

}

juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() {

    return new MainProcessor();

}

어나가는것임.