# HG changeset patch # User Chris Cannam # Date 1140717991 0 # Node ID 5ce844ec854a7d8b30bde195616afe142da3d84a # Parent beb80147374389b922957f9676e419a4bf2f2703 * Fix to phase cacheing diff -r beb801473743 -r 5ce844ec854a layer/SpectrogramLayer.h --- 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 {