| @@ -436,6 +436,10 @@ func runDSP(ctx context.Context, src sdr.Source, cfg config.Config, det *detecto | |||||
| dcEnabled = upd.dcBlock | dcEnabled = upd.dcBlock | ||||
| iqEnabled = upd.iqBalance | iqEnabled = upd.iqBalance | ||||
| if cfg.FFTSize != prevFFT || cfg.UseGPUFFT != prevUseGPU { | if cfg.FFTSize != prevFFT || cfg.UseGPUFFT != prevUseGPU { | ||||
| if flushable, ok := src.(sdr.Flushable); ok { | |||||
| flushable.Flush() | |||||
| } | |||||
| gotSamples = false | |||||
| if gpuEngine != nil { | if gpuEngine != nil { | ||||
| gpuEngine.Close() | gpuEngine.Close() | ||||
| gpuEngine = nil | gpuEngine = nil | ||||
| @@ -61,3 +61,5 @@ func (s *Source) ReadIQ(n int) ([]complex64, error) { | |||||
| func (s *Source) Stats() sdr.SourceStats { | func (s *Source) Stats() sdr.SourceStats { | ||||
| return sdr.SourceStats{} | return sdr.SourceStats{} | ||||
| } | } | ||||
| func (s *Source) Flush() {} | |||||
| @@ -22,4 +22,8 @@ type StatsProvider interface { | |||||
| Stats() SourceStats | Stats() SourceStats | ||||
| } | } | ||||
| type Flushable interface { | |||||
| Flush() | |||||
| } | |||||
| var ErrNotImplemented = errors.New("sdrplay support not built; build with -tags sdrplay or use --mock") | var ErrNotImplemented = errors.New("sdrplay support not built; build with -tags sdrplay or use --mock") | ||||
| @@ -287,6 +287,16 @@ func (s *Source) Stats() sdr.SourceStats { | |||||
| return sdr.SourceStats{BufferSamples: s.size, Dropped: s.dropped, Resets: s.resets} | return sdr.SourceStats{BufferSamples: s.size, Dropped: s.dropped, Resets: s.resets} | ||||
| } | } | ||||
| func (s *Source) Flush() { | |||||
| s.mu.Lock() | |||||
| s.head = 0 | |||||
| s.size = 0 | |||||
| s.mu.Unlock() | |||||
| if s.cond != nil { | |||||
| s.cond.Broadcast() | |||||
| } | |||||
| } | |||||
| func min(a, b int) int { | func min(a, b int) int { | ||||
| if a < b { | if a < b { | ||||
| return a | return a | ||||