Enabled showing the file source cached time ranges
This commit is contained in:
		@@ -53,6 +53,11 @@ inline String toString(double x)
 | 
				
			|||||||
    return String(x,3);
 | 
					    return String(x,3);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename T>
 | 
				
			||||||
 | 
					inline String toString(const Range<T>& x)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return String(x.getStart()) + " " + String(x.getEnd());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename... Args>
 | 
					template<typename... Args>
 | 
				
			||||||
inline String formatted(Args... args)
 | 
					inline String formatted(Args... args)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,7 +160,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
 | 
				
			|||||||
		if (processor.getStretchSource()->getPlayRange().contains(pos))
 | 
							if (processor.getStretchSource()->getPlayRange().contains(pos))
 | 
				
			||||||
			processor.getStretchSource()->seekPercent(pos);
 | 
								processor.getStretchSource()->seekPercent(pos);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	m_wavecomponent.ShowFileCacheRange = true;
 | 
						
 | 
				
			||||||
	m_spec_order_ed.setSource(processor.getStretchSource());
 | 
						m_spec_order_ed.setSource(processor.getStretchSource());
 | 
				
			||||||
	addAndMakeVisible(&m_spec_order_ed);
 | 
						addAndMakeVisible(&m_spec_order_ed);
 | 
				
			||||||
	m_spec_order_ed.ModuleSelectedCallback = [this](int id)
 | 
						m_spec_order_ed.ModuleSelectedCallback = [this](int id)
 | 
				
			||||||
@@ -446,6 +446,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
 | 
				
			|||||||
		m_wavecomponent.setAudioInfo(processor.getSampleRateChecked(), processor.getStretchSource()->getLastSeekPos(),
 | 
							m_wavecomponent.setAudioInfo(processor.getSampleRateChecked(), processor.getStretchSource()->getLastSeekPos(),
 | 
				
			||||||
			processor.getStretchSource()->getFFTSize());
 | 
								processor.getStretchSource()->getFFTSize());
 | 
				
			||||||
		String infotext; 
 | 
							String infotext; 
 | 
				
			||||||
 | 
							m_wavecomponent.ShowFileCacheRange = processor.m_show_technical_info;
 | 
				
			||||||
		if (processor.m_show_technical_info)
 | 
							if (processor.m_show_technical_info)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			infotext += String(processor.getStretchSource()->getDiskReadSampleCount()) + " ";
 | 
								infotext += String(processor.getStretchSource()->getDiskReadSampleCount()) + " ";
 | 
				
			||||||
@@ -705,20 +706,21 @@ void WaveformComponent::paint(Graphics & g)
 | 
				
			|||||||
		int xcorright = normalizedToViewX<int>(m_time_sel_end);
 | 
							int xcorright = normalizedToViewX<int>(m_time_sel_end);
 | 
				
			||||||
		g.fillRect(xcorleft, m_topmargin, xcorright - xcorleft, getHeight() - m_topmargin);
 | 
							g.fillRect(xcorleft, m_topmargin, xcorright - xcorleft, getHeight() - m_topmargin);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (m_file_cached.first.getLength() > 0.0 &&
 | 
						if (m_file_cached.first.getLength() > 0.0 && ShowFileCacheRange == true)
 | 
				
			||||||
		(bool)ShowFileCacheRange.getValue())
 | 
					 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		g.setColour(Colours::red.withAlpha(0.2f));
 | 
							g.setColour(Colours::red.withAlpha(0.2f));
 | 
				
			||||||
		int xcorleft = (int)jmap<double>(m_file_cached.first.getStart(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
							int xcorleft = (int)jmap<double>(m_file_cached.first.getStart(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
				
			||||||
		int xcorright = (int)jmap<double>(m_file_cached.first.getEnd(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
							int xcorright = (int)jmap<double>(m_file_cached.first.getEnd(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
				
			||||||
		g.fillRect(xcorleft, 0, xcorright - xcorleft, m_topmargin / 2);
 | 
							g.fillRect(xcorleft, 0, xcorright - xcorleft, getHeight());
 | 
				
			||||||
		xcorleft = (int)jmap<double>(m_file_cached.second.getStart(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
							xcorleft = (int)jmap<double>(m_file_cached.second.getStart(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
				
			||||||
		xcorright = (int)jmap<double>(m_file_cached.second.getEnd(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
							xcorright = (int)jmap<double>(m_file_cached.second.getEnd(), m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
 | 
				
			||||||
		if (xcorright - xcorleft>0)
 | 
							if (xcorright - xcorleft>0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			g.setColour(Colours::blue.withAlpha(0.2f));
 | 
								g.setColour(Colours::blue.withAlpha(0.2f));
 | 
				
			||||||
			g.fillRect(xcorleft, m_topmargin / 2, xcorright - xcorleft, m_topmargin / 2);
 | 
								g.fillRect(xcorleft, m_topmargin / 2, xcorright - xcorleft, getHeight());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							g.setColour(Colours::white);
 | 
				
			||||||
 | 
							g.drawText(toString(m_file_cached.first), 0, 30, 200, 30, Justification::centredLeft);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g.setColour(Colours::white);
 | 
						g.setColour(Colours::white);
 | 
				
			||||||
@@ -750,6 +752,7 @@ void WaveformComponent::timerCallback()
 | 
				
			|||||||
		m_last_source_pos = m_sas->getLastSourcePosition();
 | 
							m_last_source_pos = m_sas->getLastSourcePosition();
 | 
				
			||||||
		m_last_source_pos_update_time = Time::getMillisecondCounterHiRes();
 | 
							m_last_source_pos_update_time = Time::getMillisecondCounterHiRes();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						m_file_cached = m_sas->getFileCachedRangesNormalized();
 | 
				
			||||||
	repaint();
 | 
						repaint();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -151,7 +151,7 @@ public:
 | 
				
			|||||||
	void setFileCachedRange(std::pair<Range<double>, Range<double>> rng);
 | 
						void setFileCachedRange(std::pair<Range<double>, Range<double>> rng);
 | 
				
			||||||
	void setTimerEnabled(bool b);
 | 
						void setTimerEnabled(bool b);
 | 
				
			||||||
	void setViewRange(Range<double> rng);
 | 
						void setViewRange(Range<double> rng);
 | 
				
			||||||
	Value ShowFileCacheRange;
 | 
						bool ShowFileCacheRange=false;
 | 
				
			||||||
	void setRecordingPosition(double pos) { m_rec_pos = pos; }
 | 
						void setRecordingPosition(double pos) { m_rec_pos = pos; }
 | 
				
			||||||
	int m_image_init_count = 0;
 | 
						int m_image_init_count = 0;
 | 
				
			||||||
	int m_image_update_count = 0;
 | 
						int m_image_update_count = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user