diff --git a/amplitudedemod.cpp b/amplitudedemod.cpp index f486e82..cdf1267 100644 --- a/amplitudedemod.cpp +++ b/amplitudedemod.cpp @@ -19,7 +19,7 @@ #include "amplitudedemod.h" -AmplitudeDemod::AmplitudeDemod(SampleSource> *src) : SampleBuffer(src) +AmplitudeDemod::AmplitudeDemod(std::shared_ptr>> src) : SampleBuffer(src) { } diff --git a/amplitudedemod.h b/amplitudedemod.h index 4425391..7ce1988 100644 --- a/amplitudedemod.h +++ b/amplitudedemod.h @@ -24,6 +24,6 @@ class AmplitudeDemod : public SampleBuffer, float> { public: - AmplitudeDemod(SampleSource> *src); + AmplitudeDemod(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; }; diff --git a/frequencydemod.cpp b/frequencydemod.cpp index bf8b915..c6e5b4d 100644 --- a/frequencydemod.cpp +++ b/frequencydemod.cpp @@ -21,7 +21,7 @@ #include #include "util.h" -FrequencyDemod::FrequencyDemod(SampleSource> *src) : SampleBuffer(src) +FrequencyDemod::FrequencyDemod(std::shared_ptr>> src) : SampleBuffer(src) { } diff --git a/frequencydemod.h b/frequencydemod.h index 4242b9c..fb7a016 100644 --- a/frequencydemod.h +++ b/frequencydemod.h @@ -24,6 +24,6 @@ class FrequencyDemod : public SampleBuffer, float> { public: - FrequencyDemod(SampleSource> *src); + FrequencyDemod(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; }; diff --git a/plots.cpp b/plots.cpp index 1de2770..9a5070f 100644 --- a/plots.cpp +++ b/plots.cpp @@ -34,27 +34,25 @@ Plot* Plots::samplePlot(std::shared_ptr source) Plot* Plots::amplitudePlot(std::shared_ptr source) { + typedef SampleSource> ss; + std::shared_ptr cs = std::dynamic_pointer_cast(source); return new TracePlot( - std::make_shared( - std::dynamic_pointer_cast>>(source).get() - ) + std::make_shared(cs) ); } Plot* Plots::frequencyPlot(std::shared_ptr source) { + typedef SampleSource> ss; + std::shared_ptr cs = std::dynamic_pointer_cast(source); return new TracePlot( - std::make_shared( - std::dynamic_pointer_cast>>(source).get() - ) + std::make_shared(cs) ); } Plot* Plots::thresholdPlot(std::shared_ptr source) { - return new TracePlot( - std::make_shared( - std::dynamic_pointer_cast>(source).get() - ) - ); -} \ No newline at end of file + typedef SampleSource ss; + std::shared_ptr cs = std::dynamic_pointer_cast(source); + return new TracePlot( std::make_shared( cs ) ); +} diff --git a/samplebuffer.cpp b/samplebuffer.cpp index 6135c8e..10bbdb1 100644 --- a/samplebuffer.cpp +++ b/samplebuffer.cpp @@ -22,7 +22,7 @@ #include "samplebuffer.h" template -SampleBuffer::SampleBuffer(SampleSource *src) : src(src) +SampleBuffer::SampleBuffer(std::shared_ptr> src) : src(src) { src->subscribe(this); } diff --git a/samplebuffer.h b/samplebuffer.h index 8cb4438..39c93fc 100644 --- a/samplebuffer.h +++ b/samplebuffer.h @@ -28,11 +28,11 @@ template class SampleBuffer : public SampleSource, public Subscriber { private: - SampleSource *src; + std::shared_ptr> src; QMutex mutex; public: - SampleBuffer(SampleSource *src); + SampleBuffer(std::shared_ptr> src); ~SampleBuffer(); void invalidateEvent(); virtual std::unique_ptr getSamples(off_t start, off_t length); diff --git a/spectrogramplot.cpp b/spectrogramplot.cpp index 90ea391..d7a0f2a 100644 --- a/spectrogramplot.cpp +++ b/spectrogramplot.cpp @@ -45,7 +45,7 @@ SpectrogramPlot::SpectrogramPlot(std::shared_ptr(src.get()); + tunerTransform = std::make_shared(src); connect(&tuner, &Tuner::tunerMoved, this, &SpectrogramPlot::tunerMoved); src->subscribe(this); } diff --git a/threshold.cpp b/threshold.cpp index dd3b467..7f569db 100644 --- a/threshold.cpp +++ b/threshold.cpp @@ -19,7 +19,7 @@ #include "threshold.h" -Threshold::Threshold(SampleSource *src) : SampleBuffer(src) +Threshold::Threshold(std::shared_ptr> src) : SampleBuffer(src) { } diff --git a/threshold.h b/threshold.h index e142cb5..da3b436 100644 --- a/threshold.h +++ b/threshold.h @@ -24,6 +24,6 @@ class Threshold : public SampleBuffer { public: - Threshold(SampleSource *src); + Threshold(std::shared_ptr> src); void work(void *input, void *output, int count, off_t sampleid) override; }; diff --git a/tunertransform.cpp b/tunertransform.cpp index bd12cd3..71325e4 100644 --- a/tunertransform.cpp +++ b/tunertransform.cpp @@ -21,7 +21,7 @@ #include #include "util.h" -TunerTransform::TunerTransform(SampleSource> *src) : SampleBuffer(src), frequency(0), bandwidth(1.), taps{1.0f} +TunerTransform::TunerTransform(std::shared_ptr>> src) : SampleBuffer(src), frequency(0), bandwidth(1.), taps{1.0f} { } diff --git a/tunertransform.h b/tunertransform.h index d1520d6..789d7d1 100644 --- a/tunertransform.h +++ b/tunertransform.h @@ -30,7 +30,7 @@ private: std::vector taps; public: - TunerTransform(SampleSource> *src); + TunerTransform(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; void setFrequency(float frequency); void setTaps(std::vector taps);