Plugin initialization bug existed also on Windows, fixed for now...Make the GUI poll for some state changes from the AudioProcessor, instead of the processor calling the GUI. When using memory buffer in input source, copy all channels to xfade buffer. Some other tweaks.
This commit is contained in:
parent
84e564b393
commit
43be82edc8
@ -23,6 +23,7 @@
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
#include "InputS.h"
|
||||
#include <mutex>
|
||||
|
||||
inline double ramp(int64_t pos, int64_t totallen, int64_t rampinlen, int64_t rampoutlen)
|
||||
{
|
||||
@ -238,7 +239,10 @@ public:
|
||||
if (m_afreader != nullptr && m_using_memory_buffer == false)
|
||||
m_afreader->read(&m_crossfadebuf, 0, m_xfadelen, (int64_t)(m_activerange.getStart()*info.nsamples), true, true);
|
||||
if (m_afreader == nullptr && m_using_memory_buffer == true)
|
||||
m_crossfadebuf.copyFrom(0, 0, m_readbuf, 0, (int64_t)(m_activerange.getStart()*info.nsamples), m_xfadelen);
|
||||
{
|
||||
for (int i=0;i<info.nchannels;++i)
|
||||
m_crossfadebuf.copyFrom(i, 0, m_readbuf, i, (int64_t)(m_activerange.getStart()*info.nsamples), m_xfadelen);
|
||||
}
|
||||
m_cached_crossfade_range =
|
||||
Range<int64_t>((int64_t)(m_activerange.getStart()*info.nsamples),(int64_t)(m_activerange.getStart()*info.nsamples+m_xfadelen));
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
|
||||
};
|
||||
m_wavecomponent.ShowFileCacheRange = true;
|
||||
startTimer(1, 100);
|
||||
startTimer(2, 1000);
|
||||
m_wavecomponent.startTimer(100);
|
||||
}
|
||||
|
||||
@ -113,6 +114,14 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
|
||||
double prebufavail=processor.m_control->getPreBufferingPercent();
|
||||
m_info_label.setText(String(prebufavail,1), dontSendNotification);
|
||||
}
|
||||
if (id == 2)
|
||||
{
|
||||
if (processor.getAudioFile() != File() && processor.getAudioFile() != m_wavecomponent.getAudioFile())
|
||||
{
|
||||
m_wavecomponent.setAudioFile(processor.getAudioFile());
|
||||
}
|
||||
m_wavecomponent.setTimeSelection(processor.getTimeSelection());
|
||||
}
|
||||
}
|
||||
|
||||
void PaulstretchpluginAudioProcessorEditor::setAudioFile(File f)
|
||||
@ -264,6 +273,7 @@ void WaveformComponent::setAudioFile(File f)
|
||||
else
|
||||
{
|
||||
m_thumb->setSource(nullptr);
|
||||
m_curfile = File();
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
@ -318,6 +328,7 @@ void WaveformComponent::setViewRange(Range<double> rng)
|
||||
void WaveformComponent::mouseDown(const MouseEvent & e)
|
||||
{
|
||||
m_mousedown = true;
|
||||
m_lock_timesel_set = true;
|
||||
double pos = jmap<double>(e.x, 0, getWidth(), m_view_range.getStart(), m_view_range.getEnd());
|
||||
if (e.y < m_topmargin)
|
||||
{
|
||||
@ -341,6 +352,7 @@ void WaveformComponent::mouseDown(const MouseEvent & e)
|
||||
|
||||
void WaveformComponent::mouseUp(const MouseEvent & /*e*/)
|
||||
{
|
||||
m_lock_timesel_set = false;
|
||||
m_mousedown = false;
|
||||
m_didseek = false;
|
||||
if (m_didchangetimeselection)
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
void changeListenerCallback(ChangeBroadcaster* cb) override;
|
||||
void paint(Graphics& g) override;
|
||||
void setAudioFile(File f);
|
||||
const File& getAudioFile() const { return m_curfile; }
|
||||
void setAudioBuffer(AudioBuffer<float>* buf, int samplerate, int len);
|
||||
void beginAddingAudioBlocks(int channels, int samplerate, int totalllen);
|
||||
void addAudioBlock(AudioBuffer<float>& buf, int samplerate, int pos);
|
||||
@ -97,6 +98,8 @@ public:
|
||||
}
|
||||
void setTimeSelection(Range<double> rng)
|
||||
{
|
||||
if (m_lock_timesel_set == true)
|
||||
return;
|
||||
if (rng.isEmpty())
|
||||
rng = { -1.0,1.0 };
|
||||
m_time_sel_start = rng.getStart();
|
||||
@ -128,6 +131,7 @@ private:
|
||||
OpenGLContext m_ogl;
|
||||
bool m_use_opengl = false;
|
||||
double m_rec_pos = 0.0;
|
||||
bool m_lock_timesel_set = false;
|
||||
};
|
||||
|
||||
|
||||
|
@ -280,7 +280,6 @@ void PaulstretchpluginAudioProcessor::getStateInformation (MemoryBlock& destData
|
||||
|
||||
void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
|
||||
{
|
||||
return;
|
||||
ValueTree tree = ValueTree::readFromData(data, sizeInBytes);
|
||||
if (tree.isValid())
|
||||
{
|
||||
@ -296,15 +295,6 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int
|
||||
m_using_memory_buffer = false;
|
||||
File f(fn);
|
||||
setAudioFile(f);
|
||||
Timer::callAfterDelay(500, [this,f]()
|
||||
{
|
||||
callGUI(this,[f,this](PaulstretchpluginAudioProcessorEditor* ed)
|
||||
{
|
||||
ed->setAudioFile(f);
|
||||
ed->m_wavecomponent.setTimeSelection({ *getFloatParameter(5),*getFloatParameter(6) });
|
||||
}, false);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -354,6 +344,11 @@ String PaulstretchpluginAudioProcessor::setAudioFile(File f)
|
||||
return String();
|
||||
}
|
||||
|
||||
Range<double> PaulstretchpluginAudioProcessor::getTimeSelection()
|
||||
{
|
||||
return { *getFloatParameter(5),*getFloatParameter(6) };
|
||||
}
|
||||
|
||||
void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording)
|
||||
{
|
||||
m_is_recording = false;
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
double getRecordingPositionPercent();
|
||||
String setAudioFile(File f);
|
||||
File getAudioFile() { return m_current_file; }
|
||||
Range<double> getTimeSelection();
|
||||
std::unique_ptr<AudioFormatManager> m_afm;
|
||||
std::unique_ptr<Control> m_control;
|
||||
private:
|
||||
@ -75,7 +76,7 @@ private:
|
||||
bool m_is_recording = false;
|
||||
int m_rec_pos = 0;
|
||||
void finishRecording(int lenrecorded);
|
||||
bool m_using_memory_buffer = false;
|
||||
bool m_using_memory_buffer = true;
|
||||
int m_cur_num_out_chans = 2;
|
||||
std::mutex m_mutex;
|
||||
File m_current_file;
|
||||
|
@ -86,11 +86,11 @@
|
||||
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="x64"
|
||||
debugInformationFormat="ProgramDatabase" enablePluginBinaryCopyStep="1"
|
||||
linkTimeOptimisation="0" isDebug="1" optimisation="1" targetName="paulstretchplugin"
|
||||
headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\VSTPlugins"/>
|
||||
headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\VSTPlugins_64bit"/>
|
||||
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="x64"
|
||||
debugInformationFormat="ProgramDatabase" enablePluginBinaryCopyStep="1"
|
||||
linkTimeOptimisation="1" isDebug="0" optimisation="3" targetName="paulstretchplugin"
|
||||
headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\VSTPlugins"/>
|
||||
headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\VSTPlugins_64bit"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_core" path="../JUCE/modules"/>
|
||||
|
Loading…
Reference in New Issue
Block a user