diff --git a/CMakeLists.txt b/CMakeLists.txt index e40ca224b..da89a7aa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,8 +59,6 @@ set (musikbox_LINK_LIBS ${linux_LINK_LIBS} ${BOOST_LINK_LIBS} dl - fftw3 - fftw3f ) include_directories ( @@ -145,4 +143,4 @@ install( OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ GROUP_WRITE WORLD_EXECUTE WORLD_READ -) \ No newline at end of file +) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 36006f3e5..9418f0a3f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -27,6 +27,7 @@ set(CORE_SOURCES ./support/PreferenceKeys.cpp ../3rdparty/src/md5/md5.c ../3rdparty/src/sqlite/sqlite3.c + ../3rdparty/src/fft.cpp ) include_directories( diff --git a/src/core/audio/Buffer.cpp b/src/core/audio/Buffer.cpp index a1c6a356d..8a7025813 100644 --- a/src/core/audio/Buffer.cpp +++ b/src/core/audio/Buffer.cpp @@ -195,14 +195,14 @@ bool Buffer::Fft(float* buffer, int size) { int count = this->sampleSize / FFT_BUFFER_SIZE; - /* de-interlace the audio first */ - float* deinterlaced = new float[FFT_BUFFER_SIZE * count]; + /* de-interleave the audio first */ + float* deinterleaved = new float[FFT_BUFFER_SIZE * count]; for (int i = 0; i < count * FFT_BUFFER_SIZE; i++) { const int to = ((i % this->channels) * FFT_BUFFER_SIZE) + (i / count); - deinterlaced[to] = this->buffer[i]; + deinterleaved[to] = this->buffer[i]; } - /* if there's more than one set of interlaced data then + /* if there's more than one set of interleaved data then allocate a scratch buffer. we'll use this for averaging the result */ float* scratch = nullptr; @@ -216,7 +216,7 @@ bool Buffer::Fft(float* buffer, int size) { fft_perform(this->buffer, buffer, state); for (int i = 1; i < count; i++) { - fft_perform(&deinterlaced[i * FFT_BUFFER_SIZE], scratch, state); + fft_perform(&deinterleaved[i * FFT_BUFFER_SIZE], scratch, state); /* average with the previous read */ for (int j = 0; j < FFT_BUFFER_SIZE; j++) { @@ -224,7 +224,7 @@ bool Buffer::Fft(float* buffer, int size) { } } - delete[] deinterlaced; + delete[] deinterleaved; delete[] scratch; fft_close(state);