mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-05 10:15:46 +00:00
Replaced FFT implementation.
Removed the previous FFT algorithm, now using a modernized version of the original Milkdrop FFT transform which also has both an equalizer and frequency envelope, making it slightly more sophisticated. Modernization mainly included replacing raw pointer arrays with std::vector and using STL types/functions for the calculation, specifically std::complex as the FFT heavily uses these numbers. This makes the code more compact and readable. Manually tested both original and modernized versions of the class to test if the algorithm still returns the exact same results, which is the case.
This commit is contained in:
22
src/libprojectM/Audio/CMakeLists.txt
Normal file
22
src/libprojectM/Audio/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
add_library(Audio OBJECT
|
||||
AudioConstants.hpp
|
||||
BeatDetect.cpp
|
||||
BeatDetect.hpp
|
||||
MilkdropFFT.cpp
|
||||
MilkdropFFT.hpp
|
||||
FrameAudioData.cpp
|
||||
FrameAudioData.hpp
|
||||
PCM.cpp
|
||||
PCM.hpp
|
||||
)
|
||||
|
||||
target_include_directories(Audio
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(Audio
|
||||
PUBLIC
|
||||
libprojectM::API
|
||||
)
|
||||
207
src/libprojectM/Audio/MilkdropFFT.cpp
Normal file
207
src/libprojectM/Audio/MilkdropFFT.cpp
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "MilkdropFFT.hpp"
|
||||
|
||||
namespace libprojectM {
|
||||
namespace Audio {
|
||||
|
||||
constexpr auto PI = 3.141592653589793238462643383279502884197169399f;
|
||||
|
||||
void MilkdropFFT::Init(size_t samplesIn, size_t samplesOut, bool equalize, float envelopePower)
|
||||
{
|
||||
m_samplesIn = samplesIn;
|
||||
m_numFrequencies = samplesOut * 2;
|
||||
|
||||
InitBitRevTable();
|
||||
InitCosSinTable();
|
||||
InitEnvelopeTable(envelopePower);
|
||||
InitEqualizeTable(equalize);
|
||||
}
|
||||
|
||||
void MilkdropFFT::InitEnvelopeTable(float power)
|
||||
{
|
||||
if (power < 0.0f)
|
||||
{
|
||||
// Keep all values as-is.
|
||||
m_envelope = std::vector<float>(m_samplesIn, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
float const multiplier = 1.0f / static_cast<float>(m_samplesIn) * 2.0f * PI;
|
||||
|
||||
m_envelope.resize(m_samplesIn);
|
||||
|
||||
if (power == 1.0f)
|
||||
{
|
||||
for (size_t i = 0; i < m_samplesIn; i++)
|
||||
{
|
||||
m_envelope[i] = 0.5f + 0.5f * std::sin(static_cast<float>(i) * multiplier - PI * 0.5f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_samplesIn; i++)
|
||||
{
|
||||
m_envelope[i] = std::pow(0.5f + 0.5f * std::sin(static_cast<float>(i) * multiplier - PI * 0.5f), power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MilkdropFFT::InitEqualizeTable(bool equalize)
|
||||
{
|
||||
if (!equalize)
|
||||
{
|
||||
m_equalize = std::vector<float>(m_numFrequencies / 2, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
float const scaling = -0.02f;
|
||||
float const inverseHalfNumFrequencies = 1.0f / static_cast<float>(m_numFrequencies / 2);
|
||||
|
||||
m_equalize.resize(m_numFrequencies / 2);
|
||||
|
||||
for (size_t i = 0; i < m_numFrequencies / 2; i++)
|
||||
{
|
||||
m_equalize[i] = scaling * std::log(static_cast<float>(m_numFrequencies / 2 - i) * inverseHalfNumFrequencies);
|
||||
}
|
||||
}
|
||||
|
||||
void MilkdropFFT::InitBitRevTable()
|
||||
{
|
||||
m_bitRevTable.resize(m_numFrequencies);
|
||||
|
||||
for (size_t i = 0; i < m_numFrequencies; i++)
|
||||
{
|
||||
m_bitRevTable[i] = i;
|
||||
}
|
||||
|
||||
size_t j{};
|
||||
for (size_t i = 0; i < m_numFrequencies; i++)
|
||||
{
|
||||
if (j > i)
|
||||
{
|
||||
size_t const temp{m_bitRevTable[i]};
|
||||
m_bitRevTable[i] = m_bitRevTable[j];
|
||||
m_bitRevTable[j] = temp;
|
||||
}
|
||||
|
||||
size_t m = m_numFrequencies >> 1;
|
||||
|
||||
while (m >= 1 && j >= m)
|
||||
{
|
||||
j -= m;
|
||||
m >>= 1;
|
||||
}
|
||||
|
||||
j += m;
|
||||
}
|
||||
}
|
||||
|
||||
void MilkdropFFT::InitCosSinTable()
|
||||
{
|
||||
size_t tabsize{};
|
||||
size_t dftsize{2};
|
||||
|
||||
while (dftsize <= m_numFrequencies)
|
||||
{
|
||||
tabsize++;
|
||||
dftsize <<= 1;
|
||||
}
|
||||
|
||||
m_cosSinTable.resize(tabsize);
|
||||
|
||||
dftsize = 2;
|
||||
size_t index{0};
|
||||
while (dftsize <= m_numFrequencies)
|
||||
{
|
||||
auto const theta{-2.0f * PI / static_cast<float>(dftsize)};
|
||||
m_cosSinTable[index] = std::polar(1.0f, theta); // Radius 1 is the unity circle.
|
||||
index++;
|
||||
dftsize <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void MilkdropFFT::TimeToFrequencyDomain(const std::vector<float>& waveformData, std::vector<float>& spectralData)
|
||||
{
|
||||
if (m_bitRevTable.empty() || m_cosSinTable.empty() || waveformData.size() < m_samplesIn)
|
||||
{
|
||||
spectralData.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Set up input to the FFT
|
||||
std::vector<std::complex<float>> spectrumData(m_numFrequencies, std::complex<float>());
|
||||
for (size_t i = 0; i < m_numFrequencies; i++)
|
||||
{
|
||||
size_t const idx{m_bitRevTable[i]};
|
||||
if (idx < m_samplesIn)
|
||||
{
|
||||
spectrumData[i].real(waveformData[idx] * m_envelope[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Perform FFT
|
||||
size_t dftSize{2};
|
||||
size_t octave{0};
|
||||
|
||||
while (dftSize <= m_numFrequencies)
|
||||
{
|
||||
std::complex<float> w{1.0f, 0.0f};
|
||||
std::complex<float> const wp{m_cosSinTable[octave]};
|
||||
|
||||
size_t const hdftsize{dftSize >> 1};
|
||||
|
||||
for (size_t m = 0; m < hdftsize; m += 1)
|
||||
{
|
||||
for (size_t i = m; i < m_numFrequencies; i += dftSize)
|
||||
{
|
||||
size_t const j{i + hdftsize};
|
||||
std::complex<float> const tempNum{spectrumData[j] * w};
|
||||
spectrumData[j] = spectrumData[i] - tempNum;
|
||||
spectrumData[i] = spectrumData[i] + tempNum;
|
||||
}
|
||||
|
||||
w *= wp;
|
||||
}
|
||||
|
||||
dftSize <<= 1;
|
||||
octave++;
|
||||
}
|
||||
|
||||
// 3. Take the magnitude & eventually equalize it (on a log10 scale) for output
|
||||
spectralData.resize(m_numFrequencies / 2);
|
||||
for (size_t i = 0; i < m_numFrequencies / 2; i++)
|
||||
{
|
||||
spectralData[i] = m_equalize[i] * std::abs(spectrumData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Audio
|
||||
} // namespace libprojectM
|
||||
159
src/libprojectM/Audio/MilkdropFFT.hpp
Normal file
159
src/libprojectM/Audio/MilkdropFFT.hpp
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
LICENSE
|
||||
-------
|
||||
Copyright 2005-2013 Nullsoft, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Nullsoft nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <complex>
|
||||
#include <vector>
|
||||
|
||||
namespace libprojectM {
|
||||
namespace Audio {
|
||||
|
||||
/**
|
||||
* @brief Performs a Fast Fourier Transform on audio sample data.
|
||||
* Also applies an equalizer pattern with an envelope curve to the resulting data to smooth out
|
||||
* certain artifacts.
|
||||
*/
|
||||
class MilkdropFFT
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Initializes the Fast Fourier Transform.
|
||||
* @param samplesIn Number of waveform samples which will be fed into the FFT
|
||||
* @param samplesOut Number of frequency samples generated; MUST BE A POWER OF 2.
|
||||
* @param equalize true to roughly equalize the magnitude of the basses and trebles,
|
||||
* false to leave them untouched.
|
||||
* @param envelopePower Specifies the envelope power. Set to any negative value to disable the envelope.
|
||||
* See InitEnvelopeTable for more info.
|
||||
*/
|
||||
void Init(size_t samplesIn, size_t samplesOut, bool equalize = true, float envelopePower = 1.0f);
|
||||
|
||||
/**
|
||||
* @breif Converts time-domain samples into frequency-domain samples.
|
||||
* The array lengths are the two parameters to Init().
|
||||
*
|
||||
* The last sample of the output data will represent the frequency
|
||||
* that is 1/4th of the input sampling rate. For example,
|
||||
* if the input wave data is sampled at 44,100 Hz, then the last
|
||||
* sample of the spectral data output will represent the frequency
|
||||
* 11,025 Hz. The first sample will be 0 Hz; the frequencies of
|
||||
* the rest of the samples vary linearly in between.
|
||||
*
|
||||
* Note that since human hearing is limited to the range 200 - 20,000
|
||||
* Hz. 200 is a low bass hum; 20,000 is an ear-piercing high shriek.
|
||||
*
|
||||
* Each time the frequency doubles, that sounds like going up an octave.
|
||||
* That means that the difference between 200 and 300 Hz is FAR more
|
||||
* than the difference between 5000 and 5100, for example!
|
||||
*
|
||||
* So, when trying to analyze bass, you'll want to look at (probably)
|
||||
* the 200-800 Hz range; whereas for treble, you'll want the 1,400 -
|
||||
* 11,025 Hz range.
|
||||
*
|
||||
* If you want to get 3 bands, try it this way:
|
||||
* a) 11,025 / 200 = 55.125
|
||||
* b) to get the number of octaves between 200 and 11,025 Hz, solve for n:
|
||||
* 2^n = 55.125
|
||||
* n = log 55.125 / log 2
|
||||
* n = 5.785
|
||||
* c) so each band should represent 5.785/3 = 1.928 octaves; the ranges are:
|
||||
* 1) 200 - 200*2^1.928 or 200 - 761 Hz
|
||||
* 2) 200*2^1.928 - 200*2^(1.928*2) or 761 - 2897 Hz
|
||||
* 3) 200*2^(1.928*2) - 200*2^(1.928*3) or 2897 - 11025 Hz
|
||||
*
|
||||
* A simple sine-wave-based envelope is convolved with the waveform
|
||||
* data before doing the FFT, to emeliorate the bad frequency response
|
||||
* of a square (i.e. nonexistent) filter.
|
||||
*
|
||||
* You might want to slightly damp (blur) the input if your signal isn't
|
||||
* of a very high quality, to reduce high-frequency noise that would
|
||||
* otherwise show up in the output.
|
||||
* @param waveformData The waveform data to convert. Must contain at least the number of elements passed as samplesIn in Init().
|
||||
* @param spectralData The resulting frequency data. Vector will be resized to samplesOut elements as passed to Init().
|
||||
* If the conversion failed, e.g. not initialized or too few input samples, the result vector will be empty.
|
||||
*/
|
||||
void TimeToFrequencyDomain(const std::vector<float>& waveformData, std::vector<float>& spectralData);
|
||||
|
||||
/**
|
||||
* @brief Returns the number of frequency samples calculated.
|
||||
* This is twice the value of samplesOut passed to Init().
|
||||
* @return The number of frequency samples calculated.
|
||||
*/
|
||||
auto NumFrequencies() const -> size_t
|
||||
{
|
||||
return m_numFrequencies;
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Initializes the equalizer envelope table.
|
||||
*
|
||||
* This pre-computation is for multiplying the waveform sample
|
||||
* by a bell-curve-shaped envelope, so we don't see the ugly
|
||||
* frequency response (oscillations) of a square filter.
|
||||
*
|
||||
* - a power of 1.0 will compute the FFT with exactly one convolution.
|
||||
* - a power of 2.0 is like doing it twice; the resulting frequency
|
||||
* output will be smoothed out and the peaks will be "fatter".
|
||||
* - a power of 0.5 is closer to not using an envelope, and you start
|
||||
* to get the frequency response of the square filter as 'power'
|
||||
* approaches zero; the peaks get tighter and more precise, but
|
||||
* you also see small oscillations around their bases.
|
||||
* @param power Number of convolutions in the envelope.
|
||||
*/
|
||||
void InitEnvelopeTable(float power);
|
||||
|
||||
/**
|
||||
* @brief Calculates equalization factors for each frequency domain.
|
||||
*
|
||||
* @param equalize If false, all factors will be set to 1, otherwise will calculate a frequency-based multiplier.
|
||||
*/
|
||||
void InitEqualizeTable(bool equalize);
|
||||
|
||||
/**
|
||||
* @brief Builds the sample lookup table for each octave.
|
||||
*/
|
||||
void InitBitRevTable();
|
||||
|
||||
/**
|
||||
* @brief Builds a table with the Nth roots of unity inputs for the transform.
|
||||
*/
|
||||
void InitCosSinTable();
|
||||
|
||||
size_t m_samplesIn{}; //!< Number of waveform samples to use for the FFT calculation.
|
||||
size_t m_numFrequencies{}; //!< Number of frequency samples calculated by the FFT.
|
||||
|
||||
std::vector<size_t> m_bitRevTable; //!< Index table for frequency-specific waveform data lookups.
|
||||
std::vector<float> m_envelope; //!< Equalizer envelope table.
|
||||
std::vector<float> m_equalize; //!< Equalization values.
|
||||
std::vector<std::complex<float>> m_cosSinTable; //!< Table with complex polar coordinates for the different frequency domains used in the FFT.
|
||||
};
|
||||
|
||||
} // namespace Audio
|
||||
} // namespace libprojectM
|
||||
@ -26,11 +26,11 @@
|
||||
|
||||
#include "PCM.hpp"
|
||||
|
||||
#include "fftsg.h"
|
||||
#include "MilkdropFFT.hpp"
|
||||
#include "AudioConstants.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace libprojectM {
|
||||
namespace Audio {
|
||||
@ -40,7 +40,7 @@ namespace Audio {
|
||||
* means that none of the code downstream (waveforms, beatdetect, etc) needs
|
||||
* to worry about it.
|
||||
*
|
||||
* 1) Don't over react to level changes within a song
|
||||
* 1) Don't overreact to level changes within a song
|
||||
* 2) Ignore silence/gaps
|
||||
*
|
||||
* I don't know if it's necessary to have both sum and max, but that makes
|
||||
@ -134,29 +134,6 @@ void PCM::AddStereo(int16_t const* const samples, size_t const count)
|
||||
}
|
||||
|
||||
|
||||
template<size_t aSize, size_t ipSize, size_t wSize>
|
||||
void Rdft(
|
||||
int const isgn,
|
||||
std::array<double, aSize>& a,
|
||||
std::array<int, ipSize>& ip,
|
||||
std::array<double, wSize>& w)
|
||||
{
|
||||
// per rdft() documentation
|
||||
// length of ip >= 2+sqrt(n/2) and length of w == n/2
|
||||
// n: length of a, power of 2, n >= 2
|
||||
// see fftsg.cpp
|
||||
static_assert(2 * (ipSize - 2) * (ipSize - 2) >= aSize,
|
||||
"rdft invariant not preserved: length of ip >= 2+sqrt(n/2)");
|
||||
static_assert(2 * wSize == aSize,
|
||||
"rdft invariant not preserved: length of w == n/2");
|
||||
static_assert(aSize >= 2,
|
||||
"rdft invariant not preserved: n >= 2");
|
||||
static_assert((aSize & (aSize - 1)) == 0,
|
||||
"rdft invariant not preserved: n is power of two");
|
||||
rdft(aSize, isgn, a.data(), ip.data(), w.data());
|
||||
}
|
||||
|
||||
|
||||
// puts sound data requested at provided pointer
|
||||
//
|
||||
// samples is number of PCM samples to return
|
||||
@ -203,25 +180,28 @@ void PCM::UpdateFftChannel(size_t const channel)
|
||||
{
|
||||
assert(channel == 0 || channel == 1);
|
||||
|
||||
auto& freq = channel == 0 ? m_freqL : m_freqR;
|
||||
CopyPcm(freq.data(), channel, freq.size());
|
||||
Rdft(1, freq, m_ip, m_w);
|
||||
// ToDo: Add as member, init only once.
|
||||
MilkdropFFT fft;
|
||||
fft.Init(WaveformSamples, fftLength, true);
|
||||
|
||||
// compute magnitude data (m^2 actually)
|
||||
auto& spectrum = channel == 0 ? m_spectrumL : m_spectrumR;
|
||||
for (size_t i = 1; i < fftLength; i++)
|
||||
std::vector<float> waveformSamples(WaveformSamples);
|
||||
std::vector<float> spectrumValues;
|
||||
|
||||
// Get waveform data from ring buffer
|
||||
auto const& from = channel == 0 ? m_pcmL : m_pcmR;
|
||||
for (size_t i = 0, pos = m_start; i < WaveformSamples; i++)
|
||||
{
|
||||
auto const m2 = static_cast<float>(freq[i * 2] * freq[i * 2] + freq[i * 2 + 1] * freq[i * 2 + 1]);
|
||||
spectrum[i - 1] = static_cast<float>(i) * m2 / fftLength;
|
||||
if (pos == 0)
|
||||
{
|
||||
pos = maxSamples;
|
||||
}
|
||||
waveformSamples[i] = static_cast<float>(from[--pos]);
|
||||
}
|
||||
spectrum[fftLength - 1] = static_cast<float>(freq[1] * freq[1]);
|
||||
}
|
||||
|
||||
// CPP17: std::clamp
|
||||
auto Clamp(double const x, double const lo, double const hi) -> double
|
||||
{
|
||||
return x > hi ? hi : x < lo ? lo
|
||||
: x;
|
||||
fft.TimeToFrequencyDomain(waveformSamples, spectrumValues);
|
||||
|
||||
auto& spectrum = channel == 0 ? m_spectrumL : m_spectrumR;
|
||||
std::copy(spectrumValues.begin(), spectrumValues.end(), spectrum.begin());
|
||||
}
|
||||
|
||||
// pull data from circular buffer
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* projectM -- Milkdrop-esque visualisation SDK
|
||||
* Copyright (C)2003-2007 projectM Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* See 'LICENSE.txt' included within this release
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* $Id: fftsg.h,v 1.1.1.1 2005/12/23 18:05:00 psperl Exp $
|
||||
*
|
||||
* Wrapper for rdft() and friends
|
||||
*
|
||||
* $Log$
|
||||
*/
|
||||
|
||||
#ifndef _FFTSG_H
|
||||
#define _FFTSG_H
|
||||
|
||||
extern void rdft(int n, int isgn, double *a, int *ip, double *w);
|
||||
|
||||
#endif /** !_FFTSG_H */
|
||||
|
||||
@ -12,20 +12,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
include_directories("${MSVC_EXTRA_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(Audio)
|
||||
add_subdirectory(MilkdropPreset)
|
||||
add_subdirectory(Renderer)
|
||||
|
||||
add_library(projectM_main OBJECT
|
||||
"${PROJECTM_EXPORT_HEADER}"
|
||||
Audio/AudioConstants.hpp
|
||||
Audio/BeatDetect.cpp
|
||||
Audio/BeatDetect.hpp
|
||||
Audio/FrameAudioData.cpp
|
||||
Audio/FrameAudioData.hpp
|
||||
Audio/PCM.cpp
|
||||
Audio/PCM.hpp
|
||||
Audio/fftsg.cpp
|
||||
Audio/fftsg.h
|
||||
Preset.hpp
|
||||
PresetFactory.cpp
|
||||
PresetFactory.hpp
|
||||
@ -43,6 +35,7 @@ add_library(projectM_main OBJECT
|
||||
|
||||
target_link_libraries(projectM_main
|
||||
PUBLIC
|
||||
Audio
|
||||
MilkdropPreset
|
||||
Renderer
|
||||
hlslparser
|
||||
@ -71,6 +64,7 @@ target_include_directories(projectM_main
|
||||
# This syntax will pull in the compiled object files into the final library.
|
||||
add_library(projectM
|
||||
${PROJECTM_DUMMY_SOURCE_FILE} # CMake needs at least one "real" source file.
|
||||
$<TARGET_OBJECTS:Audio>
|
||||
$<TARGET_OBJECTS:MilkdropPreset>
|
||||
$<TARGET_OBJECTS:Renderer>
|
||||
$<TARGET_OBJECTS:hlslparser>
|
||||
|
||||
@ -4,6 +4,7 @@ add_executable(projectM-unittest
|
||||
PCMTest.cpp
|
||||
PresetFileParserTest.cpp
|
||||
|
||||
$<TARGET_OBJECTS:Audio>
|
||||
$<TARGET_OBJECTS:MilkdropPreset>
|
||||
$<TARGET_OBJECTS:Renderer>
|
||||
$<TARGET_OBJECTS:hlslparser>
|
||||
|
||||
Reference in New Issue
Block a user