kopia lustrzana https://gitlab.com/eliggett/wfview
Added average metering.
rodzic
fbf1c4bce9
commit
9623226b0c
|
@ -158,7 +158,7 @@ bool audioConverter::convert(audioPacket audio)
|
||||||
|
|
||||||
{
|
{
|
||||||
audio.amplitudePeak = samplesF.array().abs().maxCoeff();
|
audio.amplitudePeak = samplesF.array().abs().maxCoeff();
|
||||||
audio.amplitudeRMS = samplesF.squaredNorm();
|
audio.amplitudeRMS = samplesF.array().abs().mean();
|
||||||
|
|
||||||
// Set the volume
|
// Set the volume
|
||||||
samplesF *= audio.volume;
|
samplesF *= audio.volume;
|
||||||
|
|
16
meter.cpp
16
meter.cpp
|
@ -320,6 +320,22 @@ void meter::setLevel(int current)
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void meter::setLevels(int current, int peak)
|
||||||
|
{
|
||||||
|
this->current = current;
|
||||||
|
this->peak = peak;
|
||||||
|
|
||||||
|
avgLevels[(avgPosition++)%averageBalisticLength] = current;
|
||||||
|
int sum=0;
|
||||||
|
for(unsigned int i=0; i < (unsigned int)std::min(avgPosition, (int)avgLevels.size()); i++)
|
||||||
|
{
|
||||||
|
sum += avgLevels.at(i);
|
||||||
|
}
|
||||||
|
this->average = sum / std::min(avgPosition, (int)avgLevels.size());
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
void meter::setLevels(int current, int peak, int average)
|
void meter::setLevels(int current, int peak, int average)
|
||||||
{
|
{
|
||||||
this->current = current;
|
this->current = current;
|
||||||
|
|
1
meter.h
1
meter.h
|
@ -24,6 +24,7 @@ public slots:
|
||||||
|
|
||||||
void updateDrawing(int num);
|
void updateDrawing(int num);
|
||||||
void setLevels(int current, int peak, int average);
|
void setLevels(int current, int peak, int average);
|
||||||
|
void setLevels(int current, int peak); // calculate avg
|
||||||
void setLevel(int current);
|
void setLevel(int current);
|
||||||
void clearMeterOnPTTtoggle();
|
void clearMeterOnPTTtoggle();
|
||||||
void clearMeter();
|
void clearMeter();
|
||||||
|
|
21
wfmain.cpp
21
wfmain.cpp
|
@ -623,6 +623,26 @@ void wfmain::receiveStatusUpdate(networkStatus status)
|
||||||
|
|
||||||
void wfmain::receiveNetworkAudioLevels(networkAudioLevels l)
|
void wfmain::receiveNetworkAudioLevels(networkAudioLevels l)
|
||||||
{
|
{
|
||||||
|
meterKind m2mtr = ui->meter2Widget->getMeterType();
|
||||||
|
if(m2mtr == meterAudio)
|
||||||
|
{
|
||||||
|
if(amTransmitting)
|
||||||
|
{
|
||||||
|
if(l.haveTxLevels)
|
||||||
|
ui->meter2Widget->setLevels(l.txAudioRMS, l.txAudioPeak);
|
||||||
|
} else {
|
||||||
|
if(l.haveRxLevels)
|
||||||
|
ui->meter2Widget->setLevels(l.rxAudioRMS, l.rxAudioPeak);
|
||||||
|
}
|
||||||
|
} else if (m2mtr == meterTxMod) {
|
||||||
|
if(l.haveTxLevels)
|
||||||
|
ui->meter2Widget->setLevels(l.txAudioRMS, l.txAudioPeak);
|
||||||
|
} else if (m2mtr == meterRxAudio) {
|
||||||
|
if(l.haveRxLevels)
|
||||||
|
ui->meter2Widget->setLevels(l.rxAudioRMS, l.rxAudioPeak);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
meterKind m = meterNone;
|
meterKind m = meterNone;
|
||||||
if(l.haveRxLevels)
|
if(l.haveRxLevels)
|
||||||
{
|
{
|
||||||
|
@ -634,6 +654,7 @@ void wfmain::receiveNetworkAudioLevels(networkAudioLevels l)
|
||||||
m = meterTxMod;
|
m = meterTxMod;
|
||||||
receiveMeter(m, l.txAudioRMS);
|
receiveMeter(m, l.txAudioRMS);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void wfmain::setupPlots()
|
void wfmain::setupPlots()
|
||||||
|
|
Ładowanie…
Reference in New Issue