mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-24 18:08:27 +01:00
MacOS do be wasting my time
This commit is contained in:
parent
927bbab330
commit
ce1b0d0170
39
core/src/dsp/sink/ring_buffer.h
Normal file
39
core/src/dsp/sink/ring_buffer.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include "../sink.h"
|
||||
#include "../buffer/ring_buffer.h"
|
||||
|
||||
// NOTE: THIS IS COMPLETELY UNTESTED AND PROBABLY BROKEN!!!
|
||||
|
||||
namespace dsp::sink {
|
||||
template <class T>
|
||||
class RingBuffer : public Sink<T> {
|
||||
using base_type = Sink<T>;
|
||||
public:
|
||||
RingBuffer() {}
|
||||
|
||||
RingBuffer(stream<T>* in) { base_type::init(in); }
|
||||
|
||||
int run() {
|
||||
int count = base_type::_in->read();
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
|
||||
|
||||
base_type::_in->flush();
|
||||
return count;
|
||||
}
|
||||
|
||||
buffer::RingBuffer<T> data;
|
||||
|
||||
private:
|
||||
void doStop() {
|
||||
base_type::_in->stopReader();
|
||||
data.stopWriter();
|
||||
if (base_type::workerThread.joinable()) {
|
||||
base_type::workerThread.join();
|
||||
}
|
||||
base_type::_in->clearReadStop();
|
||||
data.clearWriteStop();
|
||||
}
|
||||
};
|
||||
}
|
@ -4,8 +4,8 @@
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <signal_path/sink.h>
|
||||
#include <portaudio.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <dsp/processing.h>
|
||||
#include <dsp/convert/stereo_to_mono.h>
|
||||
#include <dsp/sink/ring_buffer.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <core.h>
|
||||
|
||||
@ -249,9 +249,9 @@ private:
|
||||
|
||||
|
||||
SinkManager::Stream* _stream;
|
||||
dsp::StereoToMono s2m;
|
||||
dsp::RingBufferSink<float> monoRB;
|
||||
dsp::RingBufferSink<dsp::stereo_t> stereoRB;
|
||||
dsp::convert::StereoToMono s2m;
|
||||
dsp::sink::RingBuffer<float> monoRB;
|
||||
dsp::sink::RingBuffer<dsp::stereo_t> stereoRB;
|
||||
|
||||
// dsp::Packer<float> monoPacker;
|
||||
// dsp::Packer<dsp::stereo_t> stereoPacker;
|
||||
|
Loading…
Reference in New Issue
Block a user