33 m_upsamplerLastValue(0.0f),
38 m_audioBuffer.resize(48000);
39 m_audioBufferFill = 0;
41 std::fill(m_dvAudioSamples, m_dvAudioSamples+SerialDV::MBE_AUDIO_BLOCK_SIZE, 0);
61 qDebug(
"AMBEWorker::process: started");
65 std::this_thread::sleep_for(std::chrono::seconds(1));
68 qDebug(
"AMBEWorker::process: stopped");
89 float volume = pow(10.0, dBVolume / 10.0f);
91 upsampling = upsampling > 6 ? 6 : upsampling < 1 ? 1 : upsampling;
104 if (upsampling > 1) {
117 qDebug(
"AMBEWorker::handleInputMessages: %u/%u audio samples written", res,
m_audioBufferFill);
125 qDebug(
"AMBEWorker::handleInputMessages: MsgMbeDecode: decode failed");
133 qDebug(
"AMBEWorker::handleInputMessages: MsgMbeDecode: too many messages in queue. Flushing...");
144 qDebug(
"AMBEWorker::handleInputMessages: %u/%u audio samples written", res,
m_audioBufferFill);
156 unsigned char channels,
171 return m_timestamp.time().msecsTo(QDateTime::currentDateTime().time()) > 1000;
181 for (
int i = 0;
i < nbSamplesIn;
i++)
188 for (
int j = 1; j <= upsampling; j++)
203 qDebug(
"AMBEWorker::upsample(%d): audio buffer is full check its size", upsampling);
209 for (
int i = 0;
i < nbSamplesIn;
i++)
221 qDebug(
"AMBEWorker::noUpsample: audio buffer is full check its size");
MBEAudioInterpolatorFilter m_upsampleFilter
Message * pop()
Pop message from queue.
AudioCompressor m_compressor
AudioFifo * getAudioFifo()
void push(Message *message, bool emitSignal=true)
Push message onto queue.
int size()
Returns queue size.
float runHP(const float &sample)
bool hasFifo(AudioFifo *audioFifo)
float runLP(const float &sample)
SerialDV::DVController m_dvController
void handleInputMessages()
static MsgMbeDecode * create(const unsigned char *mbeFrame, int mbeRateIndex, int volumeIndex, unsigned char channels, bool useHP, int upsampling, AudioFifo *audioFifo)
float m_upsamplerLastValue
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
short m_dvAudioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE]
int getUpsampling() const
unsigned char getChannels() const
void noUpsample(short *in, int nbSamplesIn, unsigned char channels)
SerialDV::DVRate getMbeRate() const
void pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, unsigned char channels, bool useHP, int upsampling, AudioFifo *audioFifo)
static bool match(const Message *message)
float m_upsamplingFactors[7]
void upsample(int upsampling, short *in, int nbSamplesIn, unsigned char channels)
AudioVector m_audioBuffer
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
int16_t compress(int16_t sample)
const unsigned char * getMbeFrame() const
bool open(const std::string &deviceRef)
Either serial device or ip:port.
uint32_t write(const quint8 *data, uint32_t numSamples)
int getVolumeIndex() const