Added a new optional audio sink as a test

This commit is contained in:
Ryzerth
2021-07-17 19:43:44 +02:00
parent 45e4c21870
commit 63ae56cb9b
15 changed files with 534 additions and 35 deletions

View File

@ -264,6 +264,11 @@ namespace dsp {
generic_block<SampleFrameBuffer<T>>::tempStart();
}
void flush() {
std::unique_lock lck(bufMtx);
readCur = writeCur;
}
int run() {
// Wait for data
int count = _in->read();

View File

@ -344,18 +344,21 @@ void MainWindow::draw() {
if (playing) {
ImGui::PushID(ImGui::GetID("sdrpp_stop_btn"));
if (ImGui::ImageButton(icons::STOP, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(GLFW_KEY_END, false)) {
sigpath::sourceManager.stop();
playing = false;
onPlayStateChange.emit(false);
sigpath::sourceManager.stop();
sigpath::signalPath.inputBuffer.flush();
}
ImGui::PopID();
}
else { // TODO: Might need to check if there even is a device
ImGui::PushID(ImGui::GetID("sdrpp_play_btn"));
if (ImGui::ImageButton(icons::PLAY, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(GLFW_KEY_END, false)) {
sigpath::signalPath.inputBuffer.flush();
sigpath::sourceManager.start();
// TODO: tune in module instead
sigpath::sourceManager.tune(gui::waterfall.getCenterFrequency());
playing = true;
onPlayStateChange.emit(true);
}
ImGui::PopID();
}

View File

@ -33,6 +33,8 @@ public:
bool lockWaterfallControls = false;
Event<bool> onPlayStateChange;
private:
void generateFFTWindow(int win, int size);
static void fftHandler(dsp::complex_t* samples, int count, void* ctx);