changeset 39:5ce844ec854a

* Fix to phase cacheing
author Chris Cannam
date Thu, 23 Feb 2006 18:06:31 +0000
parents beb801473743
children 3be4438b186d
files layer/SpectrogramLayer.h
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Thu Feb 23 18:01:31 2006 +0000
+++ b/layer/SpectrogramLayer.h	Thu Feb 23 18:06:31 2006 +0000
@@ -244,7 +244,8 @@
 	}
 
 	float getPhaseAt(size_t x, size_t y) const {
-	    return (float(m_phase[y][x]) / 32767.0) * M_PI;
+	    int16_t i = (int16_t)m_phase[y][x];
+	    return (float(i) / 32767.0) * M_PI;
 	}
 
 	bool isLocalPeak(size_t x, size_t y) const {
@@ -273,7 +274,7 @@
 
 	void setPhaseAt(size_t x, size_t y, float phase) {
 	    // phase in range -pi -> pi
-	    m_phase[y][x] = uint16_t((phase * 32767) / M_PI);
+	    m_phase[y][x] = uint16_t(int16_t((phase * 32767) / M_PI));
 	}
 
 	QColor getColour(unsigned char index) const {