Skip to content

Commit

Permalink
Merge pull request #439 from drowe67/ms-clear-audio-plots
Browse files Browse the repository at this point in the history
Clear audio plots when recording or playback starts.
  • Loading branch information
tmiw authored Jun 16, 2023
2 parents d50b9d9 + 7eb08f4 commit 922fe8f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions USER_MANUAL.html
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ <h2 data-number="17.1" id="v1.8.12-tbd-2023"><span class="header-section-number"
<ol type="1">
<li>Bugfixes:
<ul>
<li>Clear audio plots when recording or playback starts. (PR #439)</li>
<li>Clear button now clears the callsign list. (PR #436)</li>
</ul></li>
<li>Build system:
Expand Down
1 change: 1 addition & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
## V1.8.12 TBD 2023

1. Bugfixes:
* Clear audio plots when recording or playback starts. (PR #439)
* Clear button now clears the callsign list. (PR #436)
2. Build system:
* Bump Codec2 version to v1.1.1. (PR #437)
Expand Down
Binary file modified USER_MANUAL.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions src/dlg_audiooptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,12 @@ void AudioOptsDialog::plotDeviceInputForAFewSecs(wxString devName, PlotScalar *p
FIFO *fifo, *callbackFifo;
int src_error;

// Reset plot before starting.
CallAfter([&]() {
ps->clearSamples();
ps->Refresh();
});

fifo = codec2_fifo_create((int)(DT*TEST_WAVEFORM_PLOT_FS*2)); assert(fifo != NULL);
src = src_new(SRC_SINC_FASTEST, 1, &src_error); assert(src != NULL);

Expand Down Expand Up @@ -940,6 +946,12 @@ void AudioOptsDialog::plotDeviceOutputForAFewSecs(wxString devName, PlotScalar *
FIFO *fifo, *callbackFifo;
int src_error, n = 0;

// Reset plot before starting.
CallAfter([&]() {
ps->clearSamples();
ps->Refresh();
});

fifo = codec2_fifo_create((int)(DT*TEST_WAVEFORM_PLOT_FS*2)); assert(fifo != NULL);
src = src_new(SRC_SINC_FASTEST, 1, &src_error); assert(src != NULL);

Expand Down
5 changes: 5 additions & 0 deletions src/plot_scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ void PlotScalar::drawGraticule(wxGraphicsContext* ctx)

}

void PlotScalar::clearSamples()
{
memset(m_mem, 0, sizeof(float) * m_samples);
}

//----------------------------------------------------------------
// OnSize()
//----------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/plot_scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class PlotScalar: public PlotPanel
void setBarGraph(int bar_graph) { m_bar_graph = bar_graph; }
void setLogY(int logy) { m_logy = logy; }

void clearSamples();

protected:

int m_channels;
Expand Down

0 comments on commit 922fe8f

Please sign in to comment.