mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-07 07:55:15 +00:00
Rewrite of audio data processing/beat detection.
Consolidated audio processing code into the PCM class, removing the BeatDetect class in the process. Beat detection now uses the same algorithm as Milkdrop, passing the proper relative bass/mid/treb values to presets. Makes many presets look less jumpy/flickering, as the values are now (smoothly) alternating around 1.0. Updating frame audio is now done in a function that must specifically be called. Any subsequent calls to GetFrameAudioData() will then return the exact same copy of the audio data. As of now with the exception that new waveform data may be passed in via a separate thread, which will then be returned and might not match the spectrum data. Will fix that in a later commit.
This commit is contained in:
@ -2,8 +2,9 @@
|
||||
|
||||
#include "projectM-4/projectM.h"
|
||||
|
||||
#include "Audio/AudioConstants.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <sstream>
|
||||
|
||||
void projectMWrapper::PresetSwitchRequestedEvent(bool isHardCut) const
|
||||
@ -337,7 +338,7 @@ void projectm_set_window_size(projectm_handle instance, size_t width, size_t hei
|
||||
|
||||
unsigned int projectm_pcm_get_max_samples()
|
||||
{
|
||||
return libprojectM::Audio::PCM::maxSamples;
|
||||
return libprojectM::Audio::WaveformSamples;
|
||||
}
|
||||
|
||||
template<class BufferType>
|
||||
@ -345,14 +346,7 @@ static auto PcmAdd(projectm_handle instance, const BufferType* samples, unsigned
|
||||
{
|
||||
auto* projectMInstance = handle_to_instance(instance);
|
||||
|
||||
if (channels == PROJECTM_MONO)
|
||||
{
|
||||
projectMInstance->PCM().AddMono(samples, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectMInstance->PCM().AddStereo(samples, count);
|
||||
}
|
||||
projectMInstance->PCM().Add(samples, channels, count);
|
||||
}
|
||||
|
||||
auto projectm_pcm_add_float(projectm_handle instance, const float* samples, unsigned int count, projectm_channels channels) -> void
|
||||
|
||||
Reference in New Issue
Block a user