diff layer/SpectrogramLayer.h @ 41:f2c416cbdaa9

* Add time/Hz description for waveform model to the bottom right of a pane containing a waveform (also tried this in the status bar, wasn't so good) * Further spectrogram fixes
author Chris Cannam
date Fri, 24 Feb 2006 17:26:11 +0000
parents 3be4438b186d
children 1bdf285c4eac
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Fri Feb 24 15:46:47 2006 +0000
+++ b/layer/SpectrogramLayer.h	Fri Feb 24 17:26:11 2006 +0000
@@ -260,7 +260,7 @@
 	}
 
 	void setNormalizationFactor(size_t x, float factor) {
-	    m_factor[x] = factor;
+	    if (x < m_width) m_factor[x] = factor;
 	}
 
 	void setMagnitudeAt(size_t x, size_t y, float mag) {
@@ -269,12 +269,16 @@
 	}
 
 	void setNormalizedMagnitudeAt(size_t x, size_t y, float norm) {
-	    m_magnitude[y][x] = uint16_t(norm * 65535.0);
+	    if (x < m_width && y < m_height) {
+		m_magnitude[y][x] = uint16_t(norm * 65535.0);
+	    }
 	}
 
 	void setPhaseAt(size_t x, size_t y, float phase) {
 	    // phase in range -pi -> pi
-	    m_phase[y][x] = uint16_t(int16_t((phase * 32767) / M_PI));
+	    if (x < m_width && y < m_height) {
+		m_phase[y][x] = uint16_t(int16_t((phase * 32767) / M_PI));
+	    }
 	}
 
 	QColor getColour(unsigned char index) const {