Add parameters. Use plain old member variables for main volume and loop xfade length. GUI layout tweak.
This commit is contained in:
@ -129,6 +129,20 @@ void StretchAudioSource::setAudioBufferAsInputSource(AudioBuffer<float>* buf, in
|
||||
setPlayRange({ 0.0,1.0 }, true);
|
||||
}
|
||||
|
||||
void StretchAudioSource::setMainVolume(double decibels)
|
||||
{
|
||||
std::lock_guard <decltype(m_mutex)> locker(m_mutex);
|
||||
m_main_volume = jlimit(-144.0, 12.0, decibels);
|
||||
++m_param_change_count;
|
||||
}
|
||||
|
||||
void StretchAudioSource::setLoopXFadeLength(double lenseconds)
|
||||
{
|
||||
std::lock_guard <decltype(m_mutex)> locker(m_mutex);
|
||||
m_loopxfadelen = jlimit(0.0, 1.0, lenseconds);
|
||||
++m_param_change_count;
|
||||
}
|
||||
|
||||
void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill)
|
||||
{
|
||||
// for realtime play, this is assumed to be used with BufferingAudioSource, so mutex locking should not be too bad...
|
||||
@ -145,7 +159,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
|
||||
e->set_freezing(m_freezing);
|
||||
}
|
||||
|
||||
double maingain = Decibels::decibelsToGain((double)val_MainVolume.getValue());
|
||||
double maingain = Decibels::decibelsToGain(m_main_volume);
|
||||
if (m_vol_smoother.getTargetValue() != maingain)
|
||||
m_vol_smoother.setValue(maingain);
|
||||
FloatVectorOperations::disableDenormalisedNumberSupport();
|
||||
@ -158,7 +172,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
|
||||
return;
|
||||
if (m_inputfile->info.nsamples == 0)
|
||||
return;
|
||||
m_inputfile->setXFadeLenSeconds(val_XFadeLen.getValue());
|
||||
m_inputfile->setXFadeLenSeconds(m_loopxfadelen);
|
||||
|
||||
double silencethreshold = Decibels::decibelsToGain(-70.0);
|
||||
bool tempfirst = true;
|
||||
@ -633,8 +647,8 @@ void MultiStretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & b
|
||||
m_blocksize = bufferToFill.numSamples;
|
||||
if (m_is_in_switch == false)
|
||||
{
|
||||
getActiveStretchSource()->val_MainVolume.setValue(val_MainVolume.getValue());
|
||||
getActiveStretchSource()->val_XFadeLen.setValue(val_XFadeLen.getValue());
|
||||
getActiveStretchSource()->setMainVolume(val_MainVolume.getValue());
|
||||
getActiveStretchSource()->setLoopXFadeLength(val_XFadeLen.getValue());
|
||||
getActiveStretchSource()->setFreezing(m_freezing);
|
||||
getActiveStretchSource()->getNextAudioBlock(bufferToFill);
|
||||
|
||||
@ -648,10 +662,10 @@ void MultiStretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & b
|
||||
}
|
||||
AudioSourceChannelInfo ascinfo1(m_processbuffers[0]);
|
||||
AudioSourceChannelInfo ascinfo2(m_processbuffers[1]);
|
||||
m_stretchsources[0]->val_MainVolume.setValue(val_MainVolume.getValue());
|
||||
m_stretchsources[1]->val_MainVolume.setValue(val_MainVolume.getValue());
|
||||
m_stretchsources[0]->val_XFadeLen.setValue(val_XFadeLen.getValue());
|
||||
m_stretchsources[1]->val_XFadeLen.setValue(val_XFadeLen.getValue());
|
||||
m_stretchsources[0]->setMainVolume(val_MainVolume.getValue());
|
||||
m_stretchsources[1]->setMainVolume(val_MainVolume.getValue());
|
||||
m_stretchsources[0]->setLoopXFadeLength(val_XFadeLen.getValue());
|
||||
m_stretchsources[1]->setLoopXFadeLength(val_XFadeLen.getValue());
|
||||
m_stretchsources[0]->setFreezing(m_freezing);
|
||||
m_stretchsources[1]->setFreezing(m_freezing);
|
||||
m_stretchsources[1]->setFFTWindowingType(m_stretchsources[0]->getFFTWindowingType());
|
||||
|
@ -82,8 +82,7 @@ public:
|
||||
void setFFTWindowingType(int windowtype);
|
||||
int getFFTWindowingType() { return m_fft_window_type; }
|
||||
std::pair<Range<double>,Range<double>> getFileCachedRangesNormalized();
|
||||
Value val_MainVolume;
|
||||
Value val_XFadeLen;
|
||||
|
||||
ValueTree getStateTree();
|
||||
void setStateTree(ValueTree state);
|
||||
void setClippingEnabled(bool b) { m_clip_output = b; }
|
||||
@ -91,6 +90,10 @@ public:
|
||||
void setLoopingEnabled(bool b);
|
||||
void setMaxLoops(int64_t numloops) { m_maxloops = numloops; }
|
||||
void setAudioBufferAsInputSource(AudioBuffer<float>* buf, int sr, int len);
|
||||
void setMainVolume(double decibels);
|
||||
double getMainVolume() const { return m_main_volume; }
|
||||
void setLoopXFadeLength(double lenseconds);
|
||||
double getLoopXFadeLengtj() const { return m_loopxfadelen; }
|
||||
int m_param_change_count = 0;
|
||||
private:
|
||||
CircularBuffer<float> m_stretchoutringbuf{ 1024 * 1024 };
|
||||
@ -107,6 +110,8 @@ private:
|
||||
double m_outsr = 44100.0;
|
||||
int m_process_fftsize = 0;
|
||||
int m_fft_window_type = -1;
|
||||
double m_main_volume = 0.0;
|
||||
double m_loopxfadelen = 0.0;
|
||||
ProcessParameters m_ppar;
|
||||
BinauralBeatsParameters m_bbpar;
|
||||
double m_playrate = 1.0;
|
||||
|
Reference in New Issue
Block a user