mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-26 17:44:44 +01:00
hopefully a fix for the linux crash
This commit is contained in:
parent
b943e6e869
commit
f2b8418a25
@ -89,15 +89,15 @@ namespace dsp::loop {
|
|||||||
float maxAmp = 0;
|
float maxAmp = 0;
|
||||||
for (int j = i; j < count; j++) {
|
for (int j = i; j < count; j++) {
|
||||||
if constexpr (std::is_same_v<T, complex_t>) {
|
if constexpr (std::is_same_v<T, complex_t>) {
|
||||||
inAmp = in[i].amplitude();
|
inAmp = in[j].amplitude();
|
||||||
}
|
}
|
||||||
if constexpr (std::is_same_v<T, float>) {
|
if constexpr (std::is_same_v<T, float>) {
|
||||||
inAmp = fabsf(in[i]);
|
inAmp = fabsf(in[j]);
|
||||||
}
|
}
|
||||||
if (inAmp > maxAmp) { maxAmp = inAmp; }
|
if (inAmp > maxAmp) { maxAmp = inAmp; }
|
||||||
}
|
}
|
||||||
amp = maxAmp;
|
amp = maxAmp;
|
||||||
gain = _setPoint / maxAmp;
|
gain = std::min<float>(_setPoint / amp, _maxGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale output by gain
|
// Scale output by gain
|
||||||
|
@ -11,7 +11,12 @@ namespace dsp::sink {
|
|||||||
public:
|
public:
|
||||||
RingBuffer() {}
|
RingBuffer() {}
|
||||||
|
|
||||||
RingBuffer(stream<T>* in) { base_type::init(in); }
|
RingBuffer(stream<T>* in, int maxLatency) { init(in, maxLatency); }
|
||||||
|
|
||||||
|
void init(stream<T>* in, int maxLatency) {
|
||||||
|
data.init(maxLatency);
|
||||||
|
base_type::init(in);
|
||||||
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
int count = base_type::_in->read();
|
int count = base_type::_in->read();
|
||||||
|
@ -318,11 +318,13 @@ private:
|
|||||||
|
|
||||||
void selectDemod(demod::Demodulator* demod) {
|
void selectDemod(demod::Demodulator* demod) {
|
||||||
// Stopcurrently selected demodulator and select new
|
// Stopcurrently selected demodulator and select new
|
||||||
|
afChain.stop();
|
||||||
if (selectedDemod) {
|
if (selectedDemod) {
|
||||||
selectedDemod->stop();
|
selectedDemod->stop();
|
||||||
delete selectedDemod;
|
delete selectedDemod;
|
||||||
}
|
}
|
||||||
selectedDemod = demod;
|
selectedDemod = demod;
|
||||||
|
afChain.start();
|
||||||
|
|
||||||
// Give the demodulator the most recent audio SR
|
// Give the demodulator the most recent audio SR
|
||||||
selectedDemod->AFSampRateChanged(audioSampleRate);
|
selectedDemod->AFSampRateChanged(audioSampleRate);
|
||||||
|
@ -34,8 +34,8 @@ public:
|
|||||||
_stream = stream;
|
_stream = stream;
|
||||||
_streamName = streamName;
|
_streamName = streamName;
|
||||||
s2m.init(_stream->sinkOut);
|
s2m.init(_stream->sinkOut);
|
||||||
monoRB.init(&s2m.out);
|
monoRB.init(&s2m.out, 480);
|
||||||
stereoRB.init(_stream->sinkOut);
|
stereoRB.init(_stream->sinkOut, 480);
|
||||||
|
|
||||||
// monoPacker.init(&s2m.out, 240);
|
// monoPacker.init(&s2m.out, 240);
|
||||||
// stereoPacker.init(_stream->sinkOut, 240);
|
// stereoPacker.init(_stream->sinkOut, 240);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user