2017-11-13 15:06:08 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
This file was auto-generated!
|
|
|
|
|
|
|
|
It contains the basic framework code for a JUCE plugin processor.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
#include "PS_Source/PaulStretchControl.h"
|
|
|
|
|
2017-11-23 17:36:46 +00:00
|
|
|
class MyThumbCache;
|
|
|
|
|
2017-12-12 17:14:43 +00:00
|
|
|
const int cpi_main_volume = 0;
|
|
|
|
const int cpi_stretchamount = 1;
|
|
|
|
const int cpi_fftsize = 2;
|
|
|
|
const int cpi_pitchshift = 3;
|
|
|
|
const int cpi_frequencyshift = 4;
|
|
|
|
const int cpi_soundstart = 5;
|
|
|
|
const int cpi_soundend = 6;
|
|
|
|
const int cpi_freeze = 7;
|
|
|
|
const int cpi_spreadamount = 8;
|
|
|
|
const int cpi_compress = 9;
|
|
|
|
const int cpi_loopxfadelen = 10;
|
|
|
|
const int cpi_numharmonics = 11;
|
|
|
|
const int cpi_harmonicsfreq = 12;
|
|
|
|
const int cpi_harmonicsbw = 13;
|
|
|
|
const int cpi_harmonicsgauss = 14;
|
|
|
|
const int cpi_octavesm2 = 15;
|
|
|
|
const int cpi_octavesm1 = 16;
|
|
|
|
const int cpi_octaves0 = 17;
|
|
|
|
const int cpi_octaves1 = 18;
|
|
|
|
const int cpi_octaves15 = 19;
|
|
|
|
const int cpi_octaves2 = 20;
|
|
|
|
const int cpi_tonalvsnoisebw = 21;
|
|
|
|
const int cpi_tonalvsnoisepreserve = 22;
|
|
|
|
const int cpi_filter_low = 23;
|
|
|
|
const int cpi_filter_high = 24;
|
2017-12-13 16:30:09 +00:00
|
|
|
const int cpi_onsetdetection = 25;
|
|
|
|
const int cpi_capture_enabled = 26;
|
2017-12-13 22:19:46 +00:00
|
|
|
const int cpi_num_outchans = 27;
|
2017-11-23 23:44:30 +00:00
|
|
|
|
2017-12-13 16:30:09 +00:00
|
|
|
class PaulstretchpluginAudioProcessor : public AudioProcessor, public MultiTimer
|
2017-11-13 15:06:08 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//==============================================================================
|
|
|
|
PaulstretchpluginAudioProcessor();
|
|
|
|
~PaulstretchpluginAudioProcessor();
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
|
|
|
|
void releaseResources() override;
|
|
|
|
|
|
|
|
#ifndef JucePlugin_PreferredChannelConfigurations
|
|
|
|
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void processBlock (AudioSampleBuffer&, MidiBuffer&) override;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
AudioProcessorEditor* createEditor() override;
|
|
|
|
bool hasEditor() const override;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
const String getName() const override;
|
|
|
|
|
|
|
|
bool acceptsMidi() const override;
|
|
|
|
bool producesMidi() const override;
|
|
|
|
bool isMidiEffect () const override;
|
|
|
|
double getTailLengthSeconds() const override;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
int getNumPrograms() override;
|
|
|
|
int getCurrentProgram() override;
|
|
|
|
void setCurrentProgram (int index) override;
|
|
|
|
const String getProgramName (int index) override;
|
|
|
|
void changeProgramName (int index, const String& newName) override;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
void getStateInformation (MemoryBlock& destData) override;
|
|
|
|
void setStateInformation (const void* data, int sizeInBytes) override;
|
2017-11-13 18:45:23 +00:00
|
|
|
AudioParameterFloat* getFloatParameter(int index)
|
|
|
|
{
|
|
|
|
return dynamic_cast<AudioParameterFloat*>(getParameters()[index]);
|
|
|
|
}
|
2017-11-13 19:21:30 +00:00
|
|
|
void setRecordingEnabled(bool b);
|
2017-11-13 20:35:36 +00:00
|
|
|
bool isRecordingEnabled() { return m_is_recording; }
|
|
|
|
double getRecordingPositionPercent();
|
2017-11-14 16:14:14 +00:00
|
|
|
String setAudioFile(File f);
|
|
|
|
File getAudioFile() { return m_current_file; }
|
2017-11-16 14:58:04 +00:00
|
|
|
Range<double> getTimeSelection();
|
2017-11-23 23:44:30 +00:00
|
|
|
SharedResourcePointer<AudioFormatManager> m_afm;
|
2017-11-20 22:39:07 +00:00
|
|
|
StretchAudioSource* getStretchSource() { return m_stretch_source.get(); }
|
|
|
|
double getPreBufferingPercent();
|
2017-12-13 16:30:09 +00:00
|
|
|
void timerCallback(int id) override;
|
2017-11-13 22:50:12 +00:00
|
|
|
private:
|
|
|
|
|
2017-11-13 21:42:13 +00:00
|
|
|
|
2017-11-13 16:15:07 +00:00
|
|
|
bool m_ready_to_play = false;
|
2017-11-13 19:21:30 +00:00
|
|
|
AudioBuffer<float> m_recbuffer;
|
2017-11-25 19:25:46 +00:00
|
|
|
double m_max_reclen = 10.0;
|
2017-11-13 20:35:36 +00:00
|
|
|
bool m_is_recording = false;
|
2017-11-13 19:21:30 +00:00
|
|
|
int m_rec_pos = 0;
|
2017-11-13 21:42:13 +00:00
|
|
|
void finishRecording(int lenrecorded);
|
2017-11-16 14:58:04 +00:00
|
|
|
bool m_using_memory_buffer = true;
|
2017-11-14 01:13:32 +00:00
|
|
|
int m_cur_num_out_chans = 2;
|
2017-12-12 18:43:43 +00:00
|
|
|
CriticalSection m_cs;
|
2017-11-14 16:14:14 +00:00
|
|
|
File m_current_file;
|
2017-11-20 22:39:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
TimeSliceThread m_bufferingthread;
|
|
|
|
std::unique_ptr<StretchAudioSource> m_stretch_source;
|
|
|
|
std::unique_ptr<MyBufferingAudioSource> m_buffering_source;
|
|
|
|
int m_prebuffer_amount = 1;
|
|
|
|
bool m_recreate_buffering_source = true;
|
|
|
|
|
|
|
|
int m_fft_size_to_use = 1024;
|
|
|
|
double m_last_outpos_pos = 0.0;
|
|
|
|
double m_last_in_pos = 0.0;
|
|
|
|
std::vector<int> m_bufamounts{ 4096,8192,16384,32768,65536,262144 };
|
|
|
|
ProcessParameters m_ppar;
|
|
|
|
void setPreBufferAmount(int x);
|
|
|
|
void setFFTSize(double size);
|
|
|
|
void startplay(Range<double> playrange, int numoutchans, String& err);
|
2017-11-23 17:36:46 +00:00
|
|
|
SharedResourcePointer<MyThumbCache> m_thumbcache;
|
2017-12-13 22:19:46 +00:00
|
|
|
AudioParameterInt* m_outchansparam = nullptr;
|
2017-11-13 21:42:13 +00:00
|
|
|
//==============================================================================
|
2017-11-13 15:06:08 +00:00
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
|
|
|
|
};
|