Calculate disk sample read count. Increase disk read cache 4x.

This commit is contained in:
xenakios 2018-05-19 15:03:30 +03:00
parent 021944dc37
commit eabcd891b3
5 changed files with 15 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class AInputS final : public InputS
public:
AInputS(AudioFormatManager* mana) : m_manager(mana)
{
m_readbuf.setSize(2, 65536*2);
m_readbuf.setSize(2, 65536*8);
m_readbuf.clear();
m_crossfadebuf.setSize(2, 44100);
m_crossfadebuf.clear();
@ -142,7 +142,8 @@ public:
Range<int64_t> possiblerange(pos, pos + m_readbuf.getNumSamples() + 0);
m_cached_file_range = activerange.getIntersectionWith(possiblerange);
m_afreader->read(&m_readbuf, 0, (int)m_cached_file_range.getLength(), pos, true, true);
return m_readbuf.getSample(ch, int(pos - m_cached_file_range.getStart()));
m_disk_read_count += m_cached_file_range.getLength()*m_afreader->numChannels;
return m_readbuf.getSample(ch, int(pos - m_cached_file_range.getStart()));
}
};
auto getCrossFadedSampleLambda=[this,&getSampleLambda](int64_t playpos, int chan, int64_t subt0, int64_t subt1, int xfadelen)

View File

@ -81,12 +81,13 @@ public:
return m_currentsample >= info.nsamples*m_activerange.getEnd();
}
virtual AudioBuffer<float>* getAudioBuffer()=0;
int64_t getDiskReadSampleCount() { return m_disk_read_count; }
protected:
volatile int64_t m_currentsample = 0;
int m_silenceoutputted = 0;
bool m_loop_enabled = false;
Range<double> m_activerange{ 0.0,1.0 };
int64_t m_disk_read_count = 0;
private:
int skipbufsize;
AudioBuffer<float> skipbuf;

View File

@ -65,6 +65,13 @@ bool StretchAudioSource::isResampling()
return (int)m_outsr!=m_inputfile->info.samplerate;
}
int64_t StretchAudioSource::getDiskReadSampleCount() const
{
if (m_inputfile == nullptr)
return 0;
return m_inputfile->getDiskReadSampleCount();
}
std::vector<SpectrumProcess> StretchAudioSource::getSpectrumProcessOrder()
{
return m_specproc_order;

View File

@ -82,6 +82,7 @@ public:
bool isLoopEnabled();
bool hasReachedEnd();
bool isResampling();
int64_t getDiskReadSampleCount() const;
std::vector<SpectrumProcess> getSpectrumProcessOrder();
void setSpectrumProcessOrder(std::vector<SpectrumProcess> order);
void setFFTWindowingType(int windowtype);

View File

@ -427,7 +427,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
String infotext;
if (processor.m_show_technical_info)
{
infotext += String(processor.m_prepare_count)+" ";
infotext += String(processor.getStretchSource()->getDiskReadSampleCount()) + " ";
infotext += String(processor.m_prepare_count)+" ";
infotext += String(processor.getStretchSource()->m_param_change_count);
infotext += " param changes ";
}