mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 12:47:40 +01:00
added throttle block
This commit is contained in:
parent
f88e2312b8
commit
1675ee99a4
@ -180,4 +180,45 @@ namespace dsp {
|
||||
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class Splitter : public generic_block<Splitter<T>> {
|
||||
public:
|
||||
Splitter() {}
|
||||
|
||||
Splitter(stream<T>* in) { init(in); }
|
||||
|
||||
void init(stream<T>* in) {
|
||||
_in = in;
|
||||
generic_block<Splitter>::registerInput(_in);
|
||||
}
|
||||
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
||||
generic_block<Splitter>::tempStop();
|
||||
generic_block<Splitter>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<Splitter>::registerInput(_in);
|
||||
generic_block<Splitter>::tempStart();
|
||||
}
|
||||
|
||||
stream<T> out;
|
||||
|
||||
private:
|
||||
int run() {
|
||||
// TODO: If too slow, buffering might be necessary
|
||||
int count = _in->read();
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
|
||||
_in->flush();
|
||||
out.swap(count);
|
||||
return count;
|
||||
}
|
||||
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last;
|
||||
|
||||
stream<T>* _in;
|
||||
};
|
||||
}
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
writeBuffer = new int8_t[STREAM_BUFFER_SIZE];
|
||||
|
||||
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 150000, INPUT_SAMPLE_RATE, 1);
|
||||
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 120000, INPUT_SAMPLE_RATE, 1);
|
||||
demod.init(vfo->output, INPUT_SAMPLE_RATE, 72000.0f, 32, 0.6f, 0.1f, 0.005f);
|
||||
split.init(demod.out);
|
||||
split.bindStream(&symSinkStream);
|
||||
@ -71,7 +71,7 @@ public:
|
||||
}
|
||||
|
||||
void enable() {
|
||||
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 150000, INPUT_SAMPLE_RATE, 1);
|
||||
vfo = sigpath::vfoManager.createVFO(name, ImGui::WaterfallVFO::REF_CENTER, 0, 120000, INPUT_SAMPLE_RATE, 1);
|
||||
|
||||
demod.setInput(vfo->output);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user