comparison SpectrogramProcessor.cpp @ 20:de7213b35755

* Removed warnings of comparisons with ints and size_t
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Fri, 15 Aug 2014 15:17:28 +0100
parents 1e4c02ca8b81
children 12b952286959
comparison
equal deleted inserted replaced
19:e90a4797e579 20:de7213b35755
66 66
67 //cout << m_hopSize << endl; 67 //cout << m_hopSize << endl;
68 while(readBlockPointerIndex <= inputLength) { 68 while(readBlockPointerIndex <= inputLength) {
69 69
70 int readPointer = readBlockPointerIndex - m_windowLength/2; 70 int readPointer = readBlockPointerIndex - m_windowLength/2;
71 for (unsigned int n = 0; n < m_windowLength; n++){ 71 for (int n = 0; n < (int)m_windowLength; n++){
72 if(readPointer < 0 || readPointer >= (int)inputLength){ 72 if(readPointer < 0 || readPointer >= (int)inputLength){
73 m_pFftInput[n] = 0.0; //pad with zeros 73 m_pFftInput[n] = 0.0; //pad with zeros
74 } 74 }
75 else{ 75 else{
76 m_pFftInput[n] = pInput[readPointer] * pWindow[n]; 76 m_pFftInput[n] = pInput[readPointer] * pWindow[n];
77 } 77 }
78 readPointer++; 78 readPointer++;
79 } 79 }
80 for (unsigned int n = m_windowLength; n < m_fftLength; n++){ 80 for (int n = m_windowLength; n < (int)m_fftLength; n++){
81 m_pFftInput[n] = 0.0; 81 m_pFftInput[n] = 0.0;
82 } 82 }
83 83
84 FFT::forward(m_fftLength, m_pFftInput, 0, m_pFftOutputReal, m_pFftOutputImag); 84 FFT::forward(m_fftLength, m_pFftInput, 0, m_pFftOutputReal, m_pFftOutputImag);
85 85
86 vector<float> binValues; 86 vector<float> binValues;
87 //@todo: sample at logarithmic spacing? Leave for host? 87 //@todo: sample at logarithmic spacing? Leave for host?
88 for(unsigned int k = 0; k < m_numberOfOutputBins; k++){ 88 for(int k = 0; k < (int)m_numberOfOutputBins; k++){
89 binValues.push_back(m_pFftOutputReal[k]*m_pFftOutputReal[k] + m_pFftOutputImag[k]*m_pFftOutputImag[k]); //Magnitude or power? 89 binValues.push_back(m_pFftOutputReal[k]*m_pFftOutputReal[k] + m_pFftOutputImag[k]*m_pFftOutputImag[k]); //Magnitude or power?
90 //std::cout << spectrogram[k][writeBlockPointer] << std::endl; 90 //std::cout << spectrogram[k][writeBlockPointer] << std::endl;
91 } 91 }
92 spectrogram.push_back(binValues); 92 spectrogram.push_back(binValues);
93 93