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.

192 lines
5.9KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. It contains the basic framework code for a JUCE plugin processor.
  5. ==============================================================================
  6. */
  7. #include "PluginProcessor.h"
  8. #include "PluginEditor.h"
  9. std::unique_ptr<PropertiesFile> g_propsfile;
  10. //==============================================================================
  11. PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
  12. #ifndef JucePlugin_PreferredChannelConfigurations
  13. : AudioProcessor (BusesProperties()
  14. #if ! JucePlugin_IsMidiEffect
  15. #if ! JucePlugin_IsSynth
  16. .withInput ("Input", AudioChannelSet::stereo(), true)
  17. #endif
  18. .withOutput ("Output", AudioChannelSet::stereo(), true)
  19. #endif
  20. )
  21. #endif
  22. {
  23. m_afm = std::make_unique<AudioFormatManager>();
  24. m_afm->registerBasicFormats();
  25. m_control = std::make_unique<Control>(m_afm.get());
  26. }
  27. PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
  28. {
  29. }
  30. //==============================================================================
  31. const String PaulstretchpluginAudioProcessor::getName() const
  32. {
  33. return JucePlugin_Name;
  34. }
  35. bool PaulstretchpluginAudioProcessor::acceptsMidi() const
  36. {
  37. #if JucePlugin_WantsMidiInput
  38. return true;
  39. #else
  40. return false;
  41. #endif
  42. }
  43. bool PaulstretchpluginAudioProcessor::producesMidi() const
  44. {
  45. #if JucePlugin_ProducesMidiOutput
  46. return true;
  47. #else
  48. return false;
  49. #endif
  50. }
  51. bool PaulstretchpluginAudioProcessor::isMidiEffect() const
  52. {
  53. #if JucePlugin_IsMidiEffect
  54. return true;
  55. #else
  56. return false;
  57. #endif
  58. }
  59. double PaulstretchpluginAudioProcessor::getTailLengthSeconds() const
  60. {
  61. return 0.0;
  62. }
  63. int PaulstretchpluginAudioProcessor::getNumPrograms()
  64. {
  65. return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs,
  66. // so this should be at least 1, even if you're not really implementing programs.
  67. }
  68. int PaulstretchpluginAudioProcessor::getCurrentProgram()
  69. {
  70. return 0;
  71. }
  72. void PaulstretchpluginAudioProcessor::setCurrentProgram (int index)
  73. {
  74. }
  75. const String PaulstretchpluginAudioProcessor::getProgramName (int index)
  76. {
  77. return {};
  78. }
  79. void PaulstretchpluginAudioProcessor::changeProgramName (int index, const String& newName)
  80. {
  81. }
  82. //==============================================================================
  83. void PaulstretchpluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
  84. {
  85. // Use this method as the place to do any pre-playback
  86. // initialisation that you need..
  87. }
  88. void PaulstretchpluginAudioProcessor::releaseResources()
  89. {
  90. // When playback stops, you can use this as an opportunity to free up any
  91. // spare memory, etc.
  92. }
  93. #ifndef JucePlugin_PreferredChannelConfigurations
  94. bool PaulstretchpluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
  95. {
  96. #if JucePlugin_IsMidiEffect
  97. ignoreUnused (layouts);
  98. return true;
  99. #else
  100. // This is the place where you check if the layout is supported.
  101. // In this template code we only support mono or stereo.
  102. if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
  103. && layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
  104. return false;
  105. // This checks if the input layout matches the output layout
  106. #if ! JucePlugin_IsSynth
  107. if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
  108. return false;
  109. #endif
  110. return true;
  111. #endif
  112. }
  113. #endif
  114. void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
  115. {
  116. ScopedNoDenormals noDenormals;
  117. const int totalNumInputChannels = getTotalNumInputChannels();
  118. const int totalNumOutputChannels = getTotalNumOutputChannels();
  119. // In case we have more outputs than inputs, this code clears any output
  120. // channels that didn't contain input data, (because these aren't
  121. // guaranteed to be empty - they may contain garbage).
  122. // This is here to avoid people getting screaming feedback
  123. // when they first compile a plugin, but obviously you don't need to keep
  124. // this code if your algorithm always overwrites all the output channels.
  125. for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
  126. buffer.clear (i, 0, buffer.getNumSamples());
  127. // This is the place where you'd normally do the guts of your plugin's
  128. // audio processing...
  129. for (int channel = 0; channel < totalNumInputChannels; ++channel)
  130. {
  131. float* channelData = buffer.getWritePointer (channel);
  132. // ..do something to the data...
  133. }
  134. }
  135. //==============================================================================
  136. bool PaulstretchpluginAudioProcessor::hasEditor() const
  137. {
  138. return true; // (change this to false if you choose to not supply an editor)
  139. }
  140. AudioProcessorEditor* PaulstretchpluginAudioProcessor::createEditor()
  141. {
  142. return new PaulstretchpluginAudioProcessorEditor (*this);
  143. }
  144. //==============================================================================
  145. void PaulstretchpluginAudioProcessor::getStateInformation (MemoryBlock& destData)
  146. {
  147. // You should use this method to store your parameters in the memory block.
  148. // You could do that either as raw data, or use the XML or ValueTree classes
  149. // as intermediaries to make it easy to save and load complex data.
  150. }
  151. void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
  152. {
  153. // You should use this method to restore your parameters from this memory block,
  154. // whose contents will have been created by the getStateInformation() call.
  155. }
  156. //==============================================================================
  157. // This creates new instances of the plugin..
  158. AudioProcessor* JUCE_CALLTYPE createPluginFilter()
  159. {
  160. return new PaulstretchpluginAudioProcessor();
  161. }