comparison data/fft/FFTDataServer.cpp @ 217:b3dfc3714006

* Fix a crash in spectrogram * Don't clear background of curved area of thumbwheel (this way it looks better on a dark background)
author Chris Cannam
date Mon, 22 Jan 2007 16:09:03 +0000
parents 7f8ffe65d453
children bf753a9abf0c
comparison
equal deleted inserted replaced
216:7f8ffe65d453 217:b3dfc3714006
832 float 832 float
833 FFTDataServer::getMagnitudeAt(size_t x, size_t y) 833 FFTDataServer::getMagnitudeAt(size_t x, size_t y)
834 { 834 {
835 Profiler profiler("FFTDataServer::getMagnitudeAt", false); 835 Profiler profiler("FFTDataServer::getMagnitudeAt", false);
836 836
837 if (x >= m_width || y >= m_height) return 0;
838
837 size_t col; 839 size_t col;
838 FFTCache *cache = getCache(x, col); 840 FFTCache *cache = getCache(x, col);
839 if (!cache) return 0; 841 if (!cache) return 0;
840 842
841 if (!cache->haveSetColumnAt(col)) { 843 if (!cache->haveSetColumnAt(col)) {
849 float 851 float
850 FFTDataServer::getNormalizedMagnitudeAt(size_t x, size_t y) 852 FFTDataServer::getNormalizedMagnitudeAt(size_t x, size_t y)
851 { 853 {
852 Profiler profiler("FFTDataServer::getNormalizedMagnitudeAt", false); 854 Profiler profiler("FFTDataServer::getNormalizedMagnitudeAt", false);
853 855
856 if (x >= m_width || y >= m_height) return 0;
857
854 size_t col; 858 size_t col;
855 FFTCache *cache = getCache(x, col); 859 FFTCache *cache = getCache(x, col);
856 if (!cache) return 0; 860 if (!cache) return 0;
857 861
858 if (!cache->haveSetColumnAt(col)) { 862 if (!cache->haveSetColumnAt(col)) {
864 float 868 float
865 FFTDataServer::getMaximumMagnitudeAt(size_t x) 869 FFTDataServer::getMaximumMagnitudeAt(size_t x)
866 { 870 {
867 Profiler profiler("FFTDataServer::getMaximumMagnitudeAt", false); 871 Profiler profiler("FFTDataServer::getMaximumMagnitudeAt", false);
868 872
873 if (x >= m_width) return 0;
874
869 size_t col; 875 size_t col;
870 FFTCache *cache = getCache(x, col); 876 FFTCache *cache = getCache(x, col);
871 if (!cache) return 0; 877 if (!cache) return 0;
872 878
873 if (!cache->haveSetColumnAt(col)) { 879 if (!cache->haveSetColumnAt(col)) {
878 884
879 float 885 float
880 FFTDataServer::getPhaseAt(size_t x, size_t y) 886 FFTDataServer::getPhaseAt(size_t x, size_t y)
881 { 887 {
882 Profiler profiler("FFTDataServer::getPhaseAt", false); 888 Profiler profiler("FFTDataServer::getPhaseAt", false);
889
890 if (x >= m_width || y >= m_height) return 0;
883 891
884 size_t col; 892 size_t col;
885 FFTCache *cache = getCache(x, col); 893 FFTCache *cache = getCache(x, col);
886 if (!cache) return 0; 894 if (!cache) return 0;
887 895
926 bool 934 bool
927 FFTDataServer::isColumnReady(size_t x) 935 FFTDataServer::isColumnReady(size_t x)
928 { 936 {
929 Profiler profiler("FFTDataServer::isColumnReady", false); 937 Profiler profiler("FFTDataServer::isColumnReady", false);
930 938
939 if (x >= m_width) return true;
940
931 if (!haveCache(x)) { 941 if (!haveCache(x)) {
932 if (m_lastUsedCache == -1) { 942 if (m_lastUsedCache == -1) {
933 if (m_suspended) { 943 if (m_suspended) {
934 std::cerr << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << std::endl; 944 std::cerr << "FFTDataServer::isColumnReady(" << x << "): no cache, calling resume" << std::endl;
935 resume(); 945 resume();
948 958
949 void 959 void
950 FFTDataServer::fillColumn(size_t x) 960 FFTDataServer::fillColumn(size_t x)
951 { 961 {
952 Profiler profiler("FFTDataServer::fillColumn", false); 962 Profiler profiler("FFTDataServer::fillColumn", false);
963
964 if (!m_fftInput) {
965 std::cerr << "WARNING: FFTDataServer::fillColumn(" << x << "): "
966 << "input has already been completed and discarded?"
967 << std::endl;
968 return;
969 }
970
971 if (x >= m_width) {
972 std::cerr << "WARNING: FFTDataServer::fillColumn(" << x << "): "
973 << "x > width (" << x << " > " << m_width << ")"
974 << std::endl;
975 return;
976 }
953 977
954 size_t col; 978 size_t col;
955 #ifdef DEBUG_FFT_SERVER_FILL 979 #ifdef DEBUG_FFT_SERVER_FILL
956 std::cout << "FFTDataServer::fillColumn(" << x << ")" << std::endl; 980 std::cout << "FFTDataServer::fillColumn(" << x << ")" << std::endl;
957 #endif 981 #endif