The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.5KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated by the Jucer!
  4. It contains the basic startup code for a Juce application.
  5. ==============================================================================
  6. */
  7. #ifndef __PLUGINPROCESSOR_H_526ED7A9__
  8. #define __PLUGINPROCESSOR_H_526ED7A9__
  9. #include "../JuceLibraryCode/JuceHeader.h"
  10. //==============================================================================
  11. /**
  12. As the name suggest, this class does the actual audio processing.
  13. */
  14. class JuceDemoPluginAudioProcessor : public AudioProcessor
  15. {
  16. public:
  17. //==============================================================================
  18. JuceDemoPluginAudioProcessor();
  19. ~JuceDemoPluginAudioProcessor();
  20. //==============================================================================
  21. void prepareToPlay (double sampleRate, int samplesPerBlock) override;
  22. void releaseResources() override;
  23. void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;
  24. void reset() override;
  25. //==============================================================================
  26. bool hasEditor() const override { return true; }
  27. AudioProcessorEditor* createEditor() override;
  28. //==============================================================================
  29. const String getName() const override { return JucePlugin_Name; }
  30. int getNumParameters() override;
  31. float getParameter (int index) override;
  32. float getParameterDefaultValue (int index) override;
  33. void setParameter (int index, float newValue) override;
  34. const String getParameterName (int index) override;
  35. const String getParameterText (int index) override;
  36. const String getInputChannelName (int channelIndex) const override;
  37. const String getOutputChannelName (int channelIndex) const override;
  38. bool isInputChannelStereoPair (int index) const override;
  39. bool isOutputChannelStereoPair (int index) const override;
  40. bool acceptsMidi() const override;
  41. bool producesMidi() const override;
  42. bool silenceInProducesSilenceOut() const override;
  43. double getTailLengthSeconds() const override;
  44. //==============================================================================
  45. int getNumPrograms() override { return 1; }
  46. int getCurrentProgram() override { return 0; }
  47. void setCurrentProgram (int /*index*/) override {}
  48. const String getProgramName (int /*index*/) override { return "Default"; }
  49. void changeProgramName (int /*index*/, const String& /*newName*/) override {}
  50. //==============================================================================
  51. void getStateInformation (MemoryBlock& destData) override;
  52. void setStateInformation (const void* data, int sizeInBytes) override;
  53. //==============================================================================
  54. // These properties are public so that our editor component can access them
  55. // A bit of a hacky way to do it, but it's only a demo! Obviously in your own
  56. // code you'll do this much more neatly..
  57. // this is kept up to date with the midi messages that arrive, and the UI component
  58. // registers with it so it can represent the incoming messages
  59. MidiKeyboardState keyboardState;
  60. // this keeps a copy of the last set of time info that was acquired during an audio
  61. // callback - the UI component will read this and display it.
  62. AudioPlayHead::CurrentPositionInfo lastPosInfo;
  63. // these are used to persist the UI's size - the values are stored along with the
  64. // filter's other parameters, and the UI component will update them when it gets
  65. // resized.
  66. int lastUIWidth, lastUIHeight;
  67. //==============================================================================
  68. enum Parameters
  69. {
  70. gainParam = 0,
  71. delayParam,
  72. totalNumParams
  73. };
  74. float gain, delay;
  75. private:
  76. //==============================================================================
  77. AudioSampleBuffer delayBuffer;
  78. int delayPosition;
  79. // the synth!
  80. Synthesiser synth;
  81. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceDemoPluginAudioProcessor)
  82. };
  83. #endif // __PLUGINPROCESSOR_H_526ED7A9__