CubicSDR/src/audio/AudioThread.h

49 lines
956 B
C
Raw Normal View History

#pragma once
#include <queue>
#include <vector>
2014-11-21 21:50:14 -05:00
#include <string>
#include <atomic>
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/thread.h"
#include "AudioThread.h"
2014-11-21 21:50:14 -05:00
#include "ThreadQueue.h"
#include "RtAudio.h"
2014-12-11 19:07:21 -05:00
#include "DemodDefs.h"
class AudioThreadInput {
public:
int frequency;
int sampleRate;
std::vector<float> data;
};
typedef ThreadQueue<AudioThreadInput> AudioThreadInputQueue;
class AudioThread {
public:
std::atomic< std::queue<std::vector<float> > *> audio_queue;
std::atomic<unsigned int> audio_queue_ptr;
std::atomic<unsigned int> underflow_count;
2014-12-11 19:07:21 -05:00
AudioThread(AudioThreadInputQueue *inputQueue, DemodulatorThreadCommandQueue* threadQueueNotify);
2014-11-22 22:33:32 -05:00
~AudioThread();
2014-11-21 21:50:14 -05:00
void threadMain();
void terminate();
private:
AudioThreadInputQueue *inputQueue;
RtAudio dac;
std::atomic<bool> terminated;
2014-12-11 19:07:21 -05:00
DemodulatorThreadCommandQueue* threadQueueNotify;
2014-11-21 21:50:14 -05:00
};