Tiny improvements but things arestill not working right

This commit is contained in:
xenakios 2017-11-14 00:50:12 +02:00
parent aab3fcf2a3
commit 962d4806b5
4 changed files with 13 additions and 1 deletions

View File

@ -57,6 +57,7 @@ public:
info.nsamples = len;
info.samplerate = samplerate;
m_currentsample = 0;
m_loop_enabled = true;
m_crossfadebuf.setSize(info.nchannels, m_crossfadebuf.getNumSamples());
m_cached_file_range = { 0,len };
updateXFadeCache();

View File

@ -34,6 +34,10 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
*processor.getFloatParameter(5) = range.getStart();
*processor.getFloatParameter(6) = range.getEnd();
};
m_wavecomponent.CursorPosCallback = [this]()
{
return processor.m_control->getLivePlayPosition();
};
m_wavecomponent.ShowFileCacheRange = true;
startTimer(1, 100);
}

View File

@ -25,11 +25,14 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
)
#endif
{
m_recbuffer.setSize(2, 44100);
m_recbuffer.clear();
m_afm = std::make_unique<AudioFormatManager>();
m_afm->registerBasicFormats();
m_control = std::make_unique<Control>(m_afm.get());
m_control->ppar.pitch_shift.enabled = true;
m_control->ppar.freq_shift.enabled = true;
m_control->setOnsetDetection(0.0);
m_control->getStretchAudioSource()->setLoopingEnabled(true);
addParameter(new AudioParameterFloat("mainvolume0", "Main volume", -24.0f, 12.0f, -3.0f));
addParameter(new AudioParameterFloat("stretchamount0", "Stretch amount", 0.1f, 128.0f, 1.0f));
@ -110,10 +113,13 @@ void PaulstretchpluginAudioProcessor::changeProgramName (int index, const String
//==============================================================================
void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
{
if (m_using_memory_buffer == true)
m_control->getStretchAudioSource()->setAudioBufferAsInputSource(&m_recbuffer, getSampleRate(), m_recbuffer.getNumSamples());
if (m_ready_to_play == false)
{
m_control->update_player_stretch();
m_control->update_process_parameters();
String err;
m_control->startplay(false, true,
{ *getFloatParameter(5),*getFloatParameter(6) },

View File

@ -63,8 +63,9 @@ public:
bool isRecordingEnabled() { return m_is_recording; }
double getRecordingPositionPercent();
std::unique_ptr<AudioFormatManager> m_afm;
private:
std::unique_ptr<Control> m_control;
private:
bool m_ready_to_play = false;
AudioBuffer<float> m_recbuffer;