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.

560 lines
19KB

  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. #include <set>
  10. #ifdef WIN32
  11. #undef min
  12. #undef max
  13. #endif
  14. std::set<PaulstretchpluginAudioProcessor*> g_activeprocessors;
  15. template<typename F>
  16. void callGUI(AudioProcessor* ap, F&& f, bool async)
  17. {
  18. auto ed = dynamic_cast<PaulstretchpluginAudioProcessorEditor*>(ap->getActiveEditor());
  19. if (ed)
  20. {
  21. if (async == false)
  22. f(ed);
  23. else
  24. MessageManager::callAsync([ed,f]() { f(ed); });
  25. }
  26. }
  27. int get_optimized_updown(int n, bool up) {
  28. int orig_n = n;
  29. while (true) {
  30. n = orig_n;
  31. while (!(n % 11)) n /= 11;
  32. while (!(n % 7)) n /= 7;
  33. while (!(n % 5)) n /= 5;
  34. while (!(n % 3)) n /= 3;
  35. while (!(n % 2)) n /= 2;
  36. if (n<2) break;
  37. if (up) orig_n++;
  38. else orig_n--;
  39. if (orig_n<4) return 4;
  40. };
  41. return orig_n;
  42. };
  43. int optimizebufsize(int n) {
  44. int n1 = get_optimized_updown(n, false);
  45. int n2 = get_optimized_updown(n, true);
  46. if ((n - n1)<(n2 - n)) return n1;
  47. else return n2;
  48. };
  49. //==============================================================================
  50. PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
  51. : m_bufferingthread("pspluginprebufferthread")
  52. #ifndef JucePlugin_PreferredChannelConfigurations
  53. : AudioProcessor (BusesProperties()
  54. #if ! JucePlugin_IsMidiEffect
  55. #if ! JucePlugin_IsSynth
  56. .withInput ("Input", AudioChannelSet::stereo(), true)
  57. #endif
  58. .withOutput ("Output", AudioChannelSet::stereo(), true)
  59. #endif
  60. )
  61. #endif
  62. {
  63. g_activeprocessors.insert(this);
  64. m_recbuffer.setSize(2, 44100);
  65. m_recbuffer.clear();
  66. if (m_afm->getNumKnownFormats()==0)
  67. m_afm->registerBasicFormats();
  68. m_stretch_source = std::make_unique<StretchAudioSource>(2, m_afm);
  69. setPreBufferAmount(2);
  70. m_ppar.pitch_shift.enabled = true;
  71. m_ppar.freq_shift.enabled = true;
  72. m_ppar.filter.enabled = true;
  73. m_ppar.compressor.enabled = true;
  74. m_stretch_source->setOnsetDetection(0.0);
  75. m_stretch_source->setLoopingEnabled(true);
  76. m_stretch_source->setFFTWindowingType(1);
  77. addParameter(new AudioParameterFloat("mainvolume0", "Main volume", -24.0f, 12.0f, -3.0f)); // 0
  78. addParameter(new AudioParameterFloat("stretchamount0", "Stretch amount",
  79. NormalisableRange<float>(0.1f, 128.0f, 0.01f, 0.5),1.0f)); // 1
  80. addParameter(new AudioParameterFloat("fftsize0", "FFT size", 0.0f, 1.0f, 0.7f)); // 2
  81. addParameter(new AudioParameterFloat("pitchshift0", "Pitch shift", -24.0f, 24.0f, 0.0f)); // 3
  82. addParameter(new AudioParameterFloat("freqshift0", "Frequency shift", -1000.0f, 1000.0f, 0.0f)); // 4
  83. addParameter(new AudioParameterFloat("playrange_start0", "Sound start", 0.0f, 1.0f, 0.0f)); // 5
  84. addParameter(new AudioParameterFloat("playrange_end0", "Sound end", 0.0f, 1.0f, 1.0f)); // 6
  85. addParameter(new AudioParameterBool("freeze0", "Freeze", false)); // 7
  86. addParameter(new AudioParameterFloat("spread0", "Frequency spread", 0.0f, 1.0f, 0.0f)); // 8
  87. addParameter(new AudioParameterFloat("compress0", "Compress", 0.0f, 1.0f, 0.0f)); // 9
  88. addParameter(new AudioParameterFloat("loopxfadelen0", "Loop xfade length", 0.0f, 1.0f, 0.0f)); // 10
  89. addParameter(new AudioParameterFloat("numharmonics0", "Num harmonics", 0.0f, 100.0f, 0.0f)); // 11
  90. addParameter(new AudioParameterFloat("harmonicsfreq0", "Harmonics base freq",
  91. NormalisableRange<float>(1.0f, 5000.0f, 1.00f, 0.5), 128.0f)); // 12
  92. addParameter(new AudioParameterFloat("harmonicsbw0", "Harmonics bandwidth", 0.1f, 200.0f, 25.0f)); // 13
  93. addParameter(new AudioParameterBool("harmonicsgauss0", "Gaussian harmonics", false)); // 14
  94. addParameter(new AudioParameterFloat("octavemixm2_0", "2 octaves down level", 0.0f, 1.0f, 0.0f)); // 15
  95. addParameter(new AudioParameterFloat("octavemixm1_0", "Octave down level", 0.0f, 1.0f, 0.0f)); // 16
  96. addParameter(new AudioParameterFloat("octavemix0_0", "Normal pitch level", 0.0f, 1.0f, 1.0f)); // 17
  97. addParameter(new AudioParameterFloat("octavemix1_0", "1 octave up level", 0.0f, 1.0f, 0.0f)); // 18
  98. addParameter(new AudioParameterFloat("octavemix15_0", "1 octave and fifth up level", 0.0f, 1.0f, 0.0f)); // 19
  99. addParameter(new AudioParameterFloat("octavemix2_0", "2 octaves up level", 0.0f, 1.0f, 0.0f)); // 20
  100. addParameter(new AudioParameterFloat("tonalvsnoisebw_0", "Tonal vs Noise BW", 0.74f, 1.0f, 0.74f)); // 21
  101. addParameter(new AudioParameterFloat("tonalvsnoisepreserve_0", "Tonal vs Noise preserve", -1.0f, 1.0f, 0.5f)); // 22
  102. addParameter(new AudioParameterFloat("filter_low_0", "Filter low", 20.0f, 10000.0f, 20.0f)); // 23
  103. addParameter(new AudioParameterFloat("filter_high_0", "Filter high", 20.0f, 20000.0f, 20000.0f)); // 24
  104. addParameter(new AudioParameterFloat("onsetdetect_0", "Onset detection", 0.0f, 1.0f, 0.0f)); // 25
  105. addParameter(new AudioParameterBool("capture_enabled0", "Capture", false)); // 26
  106. m_outchansparam = new AudioParameterInt("numoutchans0", "Num output channels", 2, 8, 2);
  107. addParameter(m_outchansparam); // 27
  108. startTimer(1, 50);
  109. }
  110. PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
  111. {
  112. g_activeprocessors.erase(this);
  113. m_bufferingthread.stopThread(1000);
  114. }
  115. void PaulstretchpluginAudioProcessor::setPreBufferAmount(int x)
  116. {
  117. int temp = jlimit(0, 5, x);
  118. if (temp != m_prebuffer_amount)
  119. {
  120. m_prebuffer_amount = temp;
  121. m_recreate_buffering_source = true;
  122. }
  123. }
  124. //==============================================================================
  125. const String PaulstretchpluginAudioProcessor::getName() const
  126. {
  127. return JucePlugin_Name;
  128. }
  129. bool PaulstretchpluginAudioProcessor::acceptsMidi() const
  130. {
  131. #if JucePlugin_WantsMidiInput
  132. return true;
  133. #else
  134. return false;
  135. #endif
  136. }
  137. bool PaulstretchpluginAudioProcessor::producesMidi() const
  138. {
  139. #if JucePlugin_ProducesMidiOutput
  140. return true;
  141. #else
  142. return false;
  143. #endif
  144. }
  145. bool PaulstretchpluginAudioProcessor::isMidiEffect() const
  146. {
  147. #if JucePlugin_IsMidiEffect
  148. return true;
  149. #else
  150. return false;
  151. #endif
  152. }
  153. double PaulstretchpluginAudioProcessor::getTailLengthSeconds() const
  154. {
  155. return (double)m_bufamounts[m_prebuffer_amount]/getSampleRate();
  156. }
  157. int PaulstretchpluginAudioProcessor::getNumPrograms()
  158. {
  159. return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs,
  160. // so this should be at least 1, even if you're not really implementing programs.
  161. }
  162. int PaulstretchpluginAudioProcessor::getCurrentProgram()
  163. {
  164. return 0;
  165. }
  166. void PaulstretchpluginAudioProcessor::setCurrentProgram (int index)
  167. {
  168. }
  169. const String PaulstretchpluginAudioProcessor::getProgramName (int index)
  170. {
  171. return {};
  172. }
  173. void PaulstretchpluginAudioProcessor::changeProgramName (int index, const String& newName)
  174. {
  175. }
  176. void PaulstretchpluginAudioProcessor::setFFTSize(double size)
  177. {
  178. if (m_prebuffer_amount == 5)
  179. m_fft_size_to_use = pow(2, 7.0 + size * 14.5);
  180. else m_fft_size_to_use = pow(2, 7.0 + size * 10.0); // chicken out from allowing huge FFT sizes if not enough prebuffering
  181. int optim = optimizebufsize(m_fft_size_to_use);
  182. m_fft_size_to_use = optim;
  183. m_stretch_source->setFFTSize(optim);
  184. //Logger::writeToLog(String(m_fft_size_to_use));
  185. }
  186. void PaulstretchpluginAudioProcessor::startplay(Range<double> playrange, int numoutchans, String& err)
  187. {
  188. m_stretch_source->setPlayRange(playrange, true);
  189. int bufamt = m_bufamounts[m_prebuffer_amount];
  190. if (m_buffering_source != nullptr && numoutchans != m_buffering_source->getNumberOfChannels())
  191. m_recreate_buffering_source = true;
  192. if (m_recreate_buffering_source == true)
  193. {
  194. m_buffering_source = std::make_unique<MyBufferingAudioSource>(m_stretch_source.get(),
  195. m_bufferingthread, false, bufamt, numoutchans, false);
  196. m_recreate_buffering_source = false;
  197. }
  198. if (m_bufferingthread.isThreadRunning() == false)
  199. m_bufferingthread.startThread();
  200. m_stretch_source->setNumOutChannels(numoutchans);
  201. m_stretch_source->setFFTSize(m_fft_size_to_use);
  202. m_stretch_source->setProcessParameters(&m_ppar);
  203. m_last_outpos_pos = 0.0;
  204. m_last_in_pos = playrange.getStart()*m_stretch_source->getInfileLengthSeconds();
  205. m_buffering_source->prepareToPlay(1024, getSampleRate());
  206. };
  207. void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
  208. {
  209. ScopedLock locker(m_cs);
  210. int numoutchans = *m_outchansparam;
  211. if (numoutchans != m_cur_num_out_chans)
  212. m_ready_to_play = false;
  213. if (m_using_memory_buffer == true)
  214. {
  215. int len = jlimit(100,m_recbuffer.getNumSamples(), m_rec_pos);
  216. m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer,
  217. getSampleRate(),
  218. len);
  219. callGUI(this,[this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRate(), len); },false);
  220. }
  221. if (m_ready_to_play == false)
  222. {
  223. setFFTSize(*getFloatParameter(2));
  224. m_stretch_source->setProcessParameters(&m_ppar);
  225. String err;
  226. startplay({ *getFloatParameter(5),*getFloatParameter(6) },
  227. numoutchans, err);
  228. m_cur_num_out_chans = numoutchans;
  229. m_ready_to_play = true;
  230. }
  231. }
  232. void PaulstretchpluginAudioProcessor::releaseResources()
  233. {
  234. //m_control->stopplay();
  235. //m_ready_to_play = false;
  236. }
  237. #ifndef JucePlugin_PreferredChannelConfigurations
  238. bool PaulstretchpluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
  239. {
  240. #if JucePlugin_IsMidiEffect
  241. ignoreUnused (layouts);
  242. return true;
  243. #else
  244. // This is the place where you check if the layout is supported.
  245. // In this template code we only support mono or stereo.
  246. if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono()
  247. && layouts.getMainOutputChannelSet() != AudioChannelSet::stereo())
  248. return false;
  249. // This checks if the input layout matches the output layout
  250. #if ! JucePlugin_IsSynth
  251. if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
  252. return false;
  253. #endif
  254. return true;
  255. #endif
  256. }
  257. #endif
  258. void copyAudioBufferWrappingPosition(const AudioBuffer<float>& src, AudioBuffer<float>& dest, int destbufpos, int maxdestpos)
  259. {
  260. for (int i = 0; i < dest.getNumChannels(); ++i)
  261. {
  262. int channel_to_copy = i % src.getNumChannels();
  263. if (destbufpos + src.getNumSamples() > maxdestpos)
  264. {
  265. int wrappos = (destbufpos + src.getNumSamples()) % maxdestpos;
  266. int partial_len = src.getNumSamples() - wrappos;
  267. dest.copyFrom(channel_to_copy, destbufpos, src, channel_to_copy, 0, partial_len);
  268. dest.copyFrom(channel_to_copy, partial_len, src, channel_to_copy, 0, wrappos);
  269. }
  270. else
  271. {
  272. dest.copyFrom(channel_to_copy, destbufpos, src, channel_to_copy, 0, src.getNumSamples());
  273. }
  274. }
  275. }
  276. void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
  277. {
  278. ScopedLock locker(m_cs);
  279. ScopedNoDenormals noDenormals;
  280. const int totalNumInputChannels = getTotalNumInputChannels();
  281. const int totalNumOutputChannels = getTotalNumOutputChannels();
  282. for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
  283. buffer.clear (i, 0, buffer.getNumSamples());
  284. if (m_ready_to_play == false)
  285. return;
  286. if (m_is_recording == true)
  287. {
  288. int recbuflenframes = m_max_reclen * getSampleRate();
  289. copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes);
  290. callGUI(this,[this, &buffer](PaulstretchpluginAudioProcessorEditor*ed)
  291. {
  292. ed->addAudioBlock(buffer, getSampleRate(), m_rec_pos);
  293. }, false);
  294. m_rec_pos = (m_rec_pos + buffer.getNumSamples()) % recbuflenframes;
  295. return;
  296. }
  297. jassert(m_buffering_source != nullptr);
  298. jassert(m_bufferingthread.isThreadRunning());
  299. m_stretch_source->setMainVolume(*getFloatParameter(0));
  300. m_stretch_source->setRate(*getFloatParameter(1));
  301. setFFTSize(*getFloatParameter(cpi_fftsize));
  302. m_ppar.pitch_shift.cents = *getFloatParameter(cpi_pitchshift) * 100.0;
  303. m_ppar.freq_shift.Hz = *getFloatParameter(cpi_frequencyshift);
  304. m_ppar.spread.enabled = *getFloatParameter(cpi_spreadamount) > 0.0f;
  305. m_ppar.spread.bandwidth = *getFloatParameter(cpi_spreadamount);
  306. m_ppar.compressor.enabled = *getFloatParameter(cpi_compress)>0.0f;
  307. m_ppar.compressor.power = *getFloatParameter(cpi_compress);
  308. m_ppar.harmonics.enabled = *getFloatParameter(cpi_numharmonics)>=1.0;
  309. m_ppar.harmonics.nharmonics = *getFloatParameter(cpi_numharmonics);
  310. m_ppar.harmonics.freq = *getFloatParameter(cpi_harmonicsfreq);
  311. m_ppar.harmonics.bandwidth = *getFloatParameter(cpi_harmonicsbw);
  312. m_ppar.harmonics.gauss = getParameter(cpi_harmonicsgauss);
  313. m_ppar.octave.om2 = *getFloatParameter(cpi_octavesm2);
  314. m_ppar.octave.om1 = *getFloatParameter(cpi_octavesm1);
  315. m_ppar.octave.o0 = *getFloatParameter(cpi_octaves0);
  316. m_ppar.octave.o1 = *getFloatParameter(cpi_octaves1);
  317. m_ppar.octave.o15 = *getFloatParameter(cpi_octaves15);
  318. m_ppar.octave.o2 = *getFloatParameter(cpi_octaves2);
  319. m_ppar.octave.enabled = true;
  320. m_ppar.filter.low = *getFloatParameter(cpi_filter_low);
  321. m_ppar.filter.high = *getFloatParameter(cpi_filter_high);
  322. m_ppar.tonal_vs_noise.enabled = (*getFloatParameter(cpi_tonalvsnoisebw)) > 0.75;
  323. m_ppar.tonal_vs_noise.bandwidth = *getFloatParameter(cpi_tonalvsnoisebw);
  324. m_ppar.tonal_vs_noise.preserve = *getFloatParameter(cpi_tonalvsnoisepreserve);
  325. m_stretch_source->setOnsetDetection(*getFloatParameter(cpi_onsetdetection));
  326. m_stretch_source->setLoopXFadeLength(*getFloatParameter(cpi_loopxfadelen));
  327. double t0 = *getFloatParameter(cpi_soundstart);
  328. double t1 = *getFloatParameter(cpi_soundend);
  329. if (t0 > t1)
  330. std::swap(t0, t1);
  331. if (t1 - t0 < 0.001)
  332. t1 = t0 + 0.001;
  333. m_stretch_source->setPlayRange({ t0,t1 }, true);
  334. m_stretch_source->setFreezing(getParameter(cpi_freeze));
  335. m_stretch_source->setProcessParameters(&m_ppar);
  336. AudioSourceChannelInfo aif(buffer);
  337. m_buffering_source->getNextAudioBlock(aif);
  338. }
  339. //==============================================================================
  340. bool PaulstretchpluginAudioProcessor::hasEditor() const
  341. {
  342. return true; // (change this to false if you choose to not supply an editor)
  343. }
  344. AudioProcessorEditor* PaulstretchpluginAudioProcessor::createEditor()
  345. {
  346. return new PaulstretchpluginAudioProcessorEditor (*this);
  347. }
  348. //==============================================================================
  349. void PaulstretchpluginAudioProcessor::getStateInformation (MemoryBlock& destData)
  350. {
  351. ValueTree paramtree("paulstretch3pluginstate");
  352. for (int i=0;i<getNumParameters();++i)
  353. {
  354. auto par = getFloatParameter(i);
  355. if (par != nullptr)
  356. {
  357. paramtree.setProperty(par->paramID, (double)*par, nullptr);
  358. }
  359. }
  360. paramtree.setProperty(m_outchansparam->paramID, (int)*m_outchansparam, nullptr);
  361. if (m_current_file != File())
  362. {
  363. paramtree.setProperty("importedfile", m_current_file.getFullPathName(), nullptr);
  364. }
  365. MemoryOutputStream stream(destData,true);
  366. paramtree.writeToStream(stream);
  367. }
  368. void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
  369. {
  370. ValueTree tree = ValueTree::readFromData(data, sizeInBytes);
  371. if (tree.isValid())
  372. {
  373. {
  374. ScopedLock locker(m_cs);
  375. for (int i = 0; i < getNumParameters(); ++i)
  376. {
  377. auto par = getFloatParameter(i);
  378. if (par != nullptr)
  379. {
  380. double parval = tree.getProperty(par->paramID, (double)*par);
  381. *par = parval;
  382. }
  383. }
  384. if (tree.hasProperty(m_outchansparam->paramID))
  385. *m_outchansparam = tree.getProperty(m_outchansparam->paramID, 2);
  386. }
  387. String fn = tree.getProperty("importedfile");
  388. if (fn.isEmpty() == false)
  389. {
  390. File f(fn);
  391. setAudioFile(f);
  392. }
  393. }
  394. }
  395. void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b)
  396. {
  397. ScopedLock locker(m_cs);
  398. int lenbufframes = getSampleRate()*m_max_reclen;
  399. if (b == true)
  400. {
  401. m_using_memory_buffer = true;
  402. m_current_file = File();
  403. m_recbuffer.setSize(2, m_max_reclen*getSampleRate()+4096,false,false,true);
  404. m_recbuffer.clear();
  405. m_rec_pos = 0;
  406. callGUI(this,[this,lenbufframes](PaulstretchpluginAudioProcessorEditor* ed)
  407. {
  408. ed->beginAddingAudioBlocks(2, getSampleRate(), lenbufframes);
  409. },false);
  410. m_is_recording = true;
  411. }
  412. else
  413. {
  414. if (m_is_recording == true)
  415. {
  416. finishRecording(lenbufframes);
  417. }
  418. }
  419. }
  420. double PaulstretchpluginAudioProcessor::getRecordingPositionPercent()
  421. {
  422. if (m_is_recording==false)
  423. return 0.0;
  424. return 1.0 / m_recbuffer.getNumSamples()*m_rec_pos;
  425. }
  426. String PaulstretchpluginAudioProcessor::setAudioFile(File f)
  427. {
  428. auto ai = unique_from_raw(m_afm->createReaderFor(f));
  429. if (ai != nullptr)
  430. {
  431. if (ai->numChannels > 32)
  432. {
  433. //MessageManager::callAsync([cb, file]() { cb("Too many channels in file " + file.getFullPathName()); });
  434. return "Too many channels in file "+f.getFullPathName();
  435. }
  436. if (ai->bitsPerSample>32)
  437. {
  438. //MessageManager::callAsync([cb, file]() { cb("Too high bit depth in file " + file.getFullPathName()); });
  439. return "Too high bit depth in file " + f.getFullPathName();
  440. }
  441. ScopedLock locker(m_cs);
  442. m_stretch_source->setAudioFile(f);
  443. m_current_file = f;
  444. m_using_memory_buffer = false;
  445. return String();
  446. //MessageManager::callAsync([cb, file]() { cb(String()); });
  447. }
  448. return "Could not open file " + f.getFullPathName();
  449. }
  450. Range<double> PaulstretchpluginAudioProcessor::getTimeSelection()
  451. {
  452. return { *getFloatParameter(5),*getFloatParameter(6) };
  453. }
  454. double PaulstretchpluginAudioProcessor::getPreBufferingPercent()
  455. {
  456. if (m_buffering_source==nullptr)
  457. return 0.0;
  458. return m_buffering_source->getPercentReady();
  459. }
  460. void PaulstretchpluginAudioProcessor::timerCallback(int id)
  461. {
  462. if (id == 1)
  463. {
  464. bool capture = getParameter(cpi_capture_enabled);
  465. if (capture == true && m_is_recording == false)
  466. {
  467. setRecordingEnabled(true);
  468. return;
  469. }
  470. if (capture == false && m_is_recording == true)
  471. {
  472. setRecordingEnabled(false);
  473. return;
  474. }
  475. if (m_cur_num_out_chans != *m_outchansparam)
  476. {
  477. ScopedLock locker(m_cs);
  478. m_ready_to_play = false;
  479. m_cur_num_out_chans = *m_outchansparam;
  480. //Logger::writeToLog("Switching to use " + String(m_cur_num_out_chans) + " out channels");
  481. String err;
  482. startplay({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) },
  483. m_cur_num_out_chans, err);
  484. m_ready_to_play = true;
  485. }
  486. }
  487. }
  488. void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording)
  489. {
  490. m_is_recording = false;
  491. m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer, getSampleRate(), lenrecording);
  492. m_stretch_source->setPlayRange({ *getFloatParameter(5),*getFloatParameter(6) }, true);
  493. auto ed = dynamic_cast<PaulstretchpluginAudioProcessorEditor*>(getActiveEditor());
  494. if (ed)
  495. {
  496. //ed->setAudioBuffer(&m_recbuffer, getSampleRate(), lenrecording);
  497. }
  498. }
  499. //==============================================================================
  500. // This creates new instances of the plugin..
  501. AudioProcessor* JUCE_CALLTYPE createPluginFilter()
  502. {
  503. return new PaulstretchpluginAudioProcessor();
  504. }