26 #include "../../messages/messagehandler.h"
27 #include "../../messages/messagestroboscope.h"
28 #include "../../math/mathtools.h"
43 mSamplesPerFrame(22050),
64 std::lock_guard<std::mutex> lock (
mMutex);
65 for (
auto &pcm : data)
71 for (
int i=0; i<N; ++i)
81 MessageHandler::send<MessageStroboscope>(normalizedPhases);
118 std::lock_guard<std::mutex> lock (
mMutex);
124 for (
auto &f : frequencies)
ComplexVector mComplexPhase
Rotating complex number.
void setFramesPerSecond(double fps)
Stroboscope::setFramesPerSecond.
std::vector< PCMDataType > PacketType
Type definition of a PCM packet (vector of PCM values).
Abstract adapter class for recording audio signals.
static Settings & getSingleton()
Get a pointer to the singleton instance.
void pushRawData(const AudioBase::PacketType &data)
Stroboscope::pushRawData.
bool mActive
Flag indicating activity (start/stop)
std::mutex mMutex
Mutex protecting access from different threads.
ComplexVector mComplexIncrement
Factor by which the complex number rotates.
ComplexVector mMeanComplexPhase
Phase average over the actual frame.
const double FRAME_DAMPING
Damping of the complex phases from frame to frame (0...1)
int mSampleCounter
Actual number of PCM samples read.
Stroboscope(AudioRecorderAdapter *recorder)
Constructor.
std::vector< Complex > ComplexVector
Type for a vector of complex numbers.
void setFrequencies(const std::vector< double > &frequencies)
Stroboscope::setFrequencies.
int getSamplingRate() const
Get the actual sampling rate.
const double AMPLITUDE_DAMPING
Damping factor of the normalizing amplitude level on a single frame (0...1)
double mMaxAmplitude
Sliding amplitude to normalize the data.
AudioRecorderAdapter * mRecorder
Pointer to the audio recorder.
int mSamplesPerFrame
Number of PCM samples per frame.
std::complex< double > Complex
Type for a complex number.