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.

80 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. It contains the basic framework code for a JUCE plugin processor.
  5. ==============================================================================
  6. */
  7. #pragma once
  8. #include "../JuceLibraryCode/JuceHeader.h"
  9. #include "PS_Source/PaulStretchControl.h"
  10. //==============================================================================
  11. /**
  12. */
  13. class PaulstretchpluginAudioProcessor : public AudioProcessor
  14. {
  15. public:
  16. //==============================================================================
  17. PaulstretchpluginAudioProcessor();
  18. ~PaulstretchpluginAudioProcessor();
  19. //==============================================================================
  20. void prepareToPlay (double sampleRate, int samplesPerBlock) override;
  21. void releaseResources() override;
  22. #ifndef JucePlugin_PreferredChannelConfigurations
  23. bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
  24. #endif
  25. void processBlock (AudioSampleBuffer&, MidiBuffer&) override;
  26. //==============================================================================
  27. AudioProcessorEditor* createEditor() override;
  28. bool hasEditor() const override;
  29. //==============================================================================
  30. const String getName() const override;
  31. bool acceptsMidi() const override;
  32. bool producesMidi() const override;
  33. bool isMidiEffect () const override;
  34. double getTailLengthSeconds() const override;
  35. //==============================================================================
  36. int getNumPrograms() override;
  37. int getCurrentProgram() override;
  38. void setCurrentProgram (int index) override;
  39. const String getProgramName (int index) override;
  40. void changeProgramName (int index, const String& newName) override;
  41. //==============================================================================
  42. void getStateInformation (MemoryBlock& destData) override;
  43. void setStateInformation (const void* data, int sizeInBytes) override;
  44. AudioParameterFloat* getFloatParameter(int index)
  45. {
  46. return dynamic_cast<AudioParameterFloat*>(getParameters()[index]);
  47. }
  48. void setRecordingEnabled(bool b);
  49. bool isRecordingEnabled() { return m_is_recording; }
  50. double getRecordingPositionPercent();
  51. std::unique_ptr<AudioFormatManager> m_afm;
  52. private:
  53. std::unique_ptr<Control> m_control;
  54. bool m_ready_to_play = false;
  55. AudioBuffer<float> m_recbuffer;
  56. double m_max_reclen = 10.0;
  57. bool m_is_recording = false;
  58. int m_rec_pos = 0;
  59. void finishRecording(int lenrecorded);
  60. bool m_using_memory_buffer = true;
  61. //==============================================================================
  62. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
  63. };