diff layer/ScrollableMagRangeCache.cpp @ 1120:65cdaf8d6b50 spectrogram-minor-refactor

Toward updating mag cache
author Chris Cannam
date Wed, 20 Jul 2016 13:40:23 +0100
parents 175d4e15884d
children 94370157b265
line wrap: on
line diff
--- a/layer/ScrollableMagRangeCache.cpp	Wed Jul 20 08:42:04 2016 +0100
+++ b/layer/ScrollableMagRangeCache.cpp	Wed Jul 20 13:40:23 2016 +0100
@@ -78,6 +78,19 @@
 }
 
 void
+ScrollableMagRangeCache::sampleColumn(int column, const MagnitudeRange &r)
+{
+    if (!in_range_for(m_ranges, column)) {
+	cerr << "ERROR: ScrollableMagRangeCache::sampleColumn: column " << column
+	     << " is out of range for cache of width " << m_ranges.size()
+	     << " (with start frame " << m_startFrame << ")" << endl;
+	throw logic_error("column out of range");
+    } else {
+	m_ranges[column].sample(r);
+    }
+}
+
+void
 ScrollableMagRangeCache::sampleColumn(const LayerGeometryProvider *v,
 				      sv_frame_t frame,
 				      const MagnitudeRange &r)
@@ -88,7 +101,9 @@
     if (!in_range_for(m_ranges, x)) {
 	cerr << "WARNING: ScrollableMagRangeCache::sampleColumn: column " << x
 	     << " arising from frame " << frame << " is out of range for cache "
-	     << "of width " << m_ranges.size() << endl;
+	     << "of width " << m_ranges.size()
+	     << " (with start frame " << m_startFrame << ")" << endl;
+	throw logic_error("column out of range");
     } else {
 	sampleColumn(x, r);
     }