Skip to content

Commit dd2e59b

Browse files
committed
Added sample rate display and fixed a bug where if samplerate would be > 400, plugin would stop working
1 parent be98131 commit dd2e59b

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

IMGS/Demonstration.PNG

-445 KB
Loading

SDRSharp.SCATuner/Audio/AudioPlayer.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public int BufferSize
4141
}
4242
}
4343

44+
public int InternalSampleRate
45+
{
46+
get
47+
{
48+
return (int)(this._sampleRate) / 1000;
49+
}
50+
}
51+
4452
public double SCAFrequency
4553
{
4654
set
@@ -131,15 +139,10 @@ private unsafe void AudioSamplesIn(float* buffer, double samplerate, int length)
131139
{
132140
if (this._wavePlayer == null || samplerate != this._sampleRate)
133141
{
134-
if (samplerate <= 0.0 || samplerate > 400000.0)
135-
{
136-
return;
137-
}
138142
this._sampleRate = samplerate;
139143
this._sampleRateOut = this.control.AudioSampleRate;
140144
this._maxBufferSize = (int)this._sampleRate;
141145

142-
143146
//We multiplay our Length by 0.1 so audio device doesn't run out of samples (hear silence when that happens)
144147
this._inputLength = (int)(this._sampleRate*OutputLatency);
145148
this._outputLength = (int)(this._sampleRateOut*OutputLatency);

SDRSharp.SCATuner/UI/SCATunerPanel.Designer.cs

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SDRSharp.SCATuner/UI/SCATunerPanel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ private void displayTimer_Tick(object sender, EventArgs e)
144144
{
145145
this.disbalanceLabel.Text = string.Format("Lost buffers {0:f0}", this._player.LostBuffers);
146146
this.bufferProgressBar.Value = this._player.BufferSize;
147+
148+
//Show user what internal sapmle rate we have
149+
this.SampleRateLbl.Text = String.Format("Sample rate: {0} kHz", this._player.InternalSampleRate);
147150
}
148151

149152
private void audioDeviceComboBox_SelectedIndexChanged(object sender, EventArgs e)

0 commit comments

Comments
 (0)