24 #ifndef AUDIORECORDERADAPTER_H
25 #define AUDIORECORDERADAPTER_H
28 #include "../circularbuffer.h"
31 #include "../../piano/piano.h"
121 #endif // AUDIORECORDERADAPTER_H
AudioRecorderAdapter()
Constructor.
std::vector< PCMDataType > PacketType
Type definition of a PCM packet (vector of PCM values).
Stroboscope * getStroboscope()
Abstract adapter class for recording audio signals.
virtual ~AudioRecorderAdapter()
Empty destructor.
void setWaitingFlag(bool flag)
double mSlidingLevel
Sliding VU level of the signal.
static const double ATTACKRATE
Attack rate at which the sliding level goes up (1=instantly).
double convertIntensityToLevel(double intensity)
Convert an intensity (variance) of the signal to a VU level.
void setMuted(bool muted)
Set and reset the muting flag.
CircularBuffer< PCMDataType > mCurrentPacket
Local audio buffer.
bool mMuted
Is the input device muted.
static const double LEVEL_TRIGGER
Level above which the recorder starts to operate.
void pushRawData(const PacketType &data)
The implementation calls this function when new data is available.
void controlRecordingState(double level)
Control the beginning and the end of recording.
static const int BUFFER_SIZE_IN_SECONDS
Capacity of the local circular audio buffer in seconds.
std::mutex mCurrentPacketMutex
Buffer access mutexbo.
Stroboscope mStroboscope
Instance of stroboscope.
bool mStandby
Standby flag.
bool mRecording
Flag true if recording is on.
Class for a stroboscopic tuning indicator.
virtual void setDeviceInputGain(double volume)=0
bool mWaiting
Wait for the data analysis to be completed.
int mCounterThreshold
Counter threshold for updating energy.
double getStopLevel() const
double convertLevelToIntensity(double level)
Convert a VU level to the corresponding intensity. This function is the inverse of convertIntensityTo...
std::map< int, double > mIntensityHistogram
Histogram of intensities.
int mPacketCounter
Counter for the number of packages.
static const int UPDATE_IN_MILLISECONDS
Update interval in milliseconds, defining the packet size.
void readAll(PacketType &packet)
Read all data from the internal buffer.
void resetInputLevelControl()
Reset input level control.
double mStopLevel
Level at which recording stops.
double mGain
Recording amplification factor.
static const double LEVEL_CUTOFF
Level above which the input mGain is automatically reduced.
void setSamplingRate(int rate) override
void automaticControl(double intensity, double level)
Automatic noise estimation and threshold adjustment.
static const double DB_OFF
dB shift for off mark (high value = shorter recording)
double mPacketM2
Second intensity moment of a single packet.
static const double LEVEL_RETRIGGER
Level below which retriggering (restart) is allowed.
double mPacketM1
First intensity moment of a single packet.
virtual double getDeviceInputGain() const =0
bool mRestartable
Flag true if start/retriggering possible.
int mCounter
Counts counting incoming PCM values.
void cutSilence(PacketType &packet)
Cut trailing silence.
void setStandby(bool flag)
Abstract base class for audio interfaces.
static const double DECAYRATE
Decay rate at which the sliding level goes down.