Calculate disk sample read count. Increase disk read cache 4x.
This commit is contained in:
		@@ -41,7 +41,7 @@ class AInputS final : public InputS
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
    AInputS(AudioFormatManager* mana) : m_manager(mana)
 | 
					    AInputS(AudioFormatManager* mana) : m_manager(mana)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		m_readbuf.setSize(2, 65536*2);
 | 
							m_readbuf.setSize(2, 65536*8);
 | 
				
			||||||
		m_readbuf.clear();
 | 
							m_readbuf.clear();
 | 
				
			||||||
		m_crossfadebuf.setSize(2, 44100);
 | 
							m_crossfadebuf.setSize(2, 44100);
 | 
				
			||||||
		m_crossfadebuf.clear();
 | 
							m_crossfadebuf.clear();
 | 
				
			||||||
@@ -142,7 +142,8 @@ public:
 | 
				
			|||||||
                Range<int64_t> possiblerange(pos, pos + m_readbuf.getNumSamples() + 0);
 | 
					                Range<int64_t> possiblerange(pos, pos + m_readbuf.getNumSamples() + 0);
 | 
				
			||||||
                m_cached_file_range = activerange.getIntersectionWith(possiblerange);
 | 
					                m_cached_file_range = activerange.getIntersectionWith(possiblerange);
 | 
				
			||||||
                m_afreader->read(&m_readbuf, 0, (int)m_cached_file_range.getLength(), pos, true, true);
 | 
					                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)
 | 
							auto getCrossFadedSampleLambda=[this,&getSampleLambda](int64_t playpos, int chan, int64_t subt0, int64_t subt1, int xfadelen)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,12 +81,13 @@ public:
 | 
				
			|||||||
		return m_currentsample >= info.nsamples*m_activerange.getEnd();
 | 
							return m_currentsample >= info.nsamples*m_activerange.getEnd();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
    virtual AudioBuffer<float>* getAudioBuffer()=0;
 | 
					    virtual AudioBuffer<float>* getAudioBuffer()=0;
 | 
				
			||||||
 | 
						int64_t getDiskReadSampleCount() { return m_disk_read_count; }
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
	volatile int64_t m_currentsample = 0;
 | 
						volatile int64_t m_currentsample = 0;
 | 
				
			||||||
	int m_silenceoutputted = 0;
 | 
						int m_silenceoutputted = 0;
 | 
				
			||||||
	bool m_loop_enabled = false;
 | 
						bool m_loop_enabled = false;
 | 
				
			||||||
	Range<double> m_activerange{ 0.0,1.0 };
 | 
						Range<double> m_activerange{ 0.0,1.0 };
 | 
				
			||||||
	
 | 
						int64_t m_disk_read_count = 0;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	int skipbufsize;
 | 
						int skipbufsize;
 | 
				
			||||||
	AudioBuffer<float> skipbuf;
 | 
						AudioBuffer<float> skipbuf;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,6 +65,13 @@ bool StretchAudioSource::isResampling()
 | 
				
			|||||||
    return (int)m_outsr!=m_inputfile->info.samplerate;
 | 
					    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()
 | 
					std::vector<SpectrumProcess> StretchAudioSource::getSpectrumProcessOrder()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_specproc_order;
 | 
						return m_specproc_order;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,6 +82,7 @@ public:
 | 
				
			|||||||
	bool isLoopEnabled();
 | 
						bool isLoopEnabled();
 | 
				
			||||||
	bool hasReachedEnd();
 | 
						bool hasReachedEnd();
 | 
				
			||||||
    bool isResampling();
 | 
					    bool isResampling();
 | 
				
			||||||
 | 
						int64_t getDiskReadSampleCount() const;
 | 
				
			||||||
	std::vector<SpectrumProcess> getSpectrumProcessOrder();
 | 
						std::vector<SpectrumProcess> getSpectrumProcessOrder();
 | 
				
			||||||
	void setSpectrumProcessOrder(std::vector<SpectrumProcess> order);
 | 
						void setSpectrumProcessOrder(std::vector<SpectrumProcess> order);
 | 
				
			||||||
	void setFFTWindowingType(int windowtype);
 | 
						void setFFTWindowingType(int windowtype);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -427,7 +427,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
 | 
				
			|||||||
		String infotext; 
 | 
							String infotext; 
 | 
				
			||||||
		if (processor.m_show_technical_info)
 | 
							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 += String(processor.getStretchSource()->m_param_change_count);
 | 
				
			||||||
			infotext += " param changes ";
 | 
								infotext += " param changes ";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user