mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-13 11:51:47 -05:00
NFM Modulator: Cleanup level meter code. Use experimental max value for modulation swing calculation
This commit is contained in:
parent
7a07b56b01
commit
ea53e63556
@ -134,7 +134,8 @@ void NFMMod::modulateSample()
|
||||
pullAF(t);
|
||||
calculateLevel(t);
|
||||
|
||||
m_modPhasor += (m_running.m_fmDeviation / (float) m_running.m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 1208.0f);
|
||||
// 378 = 302 * 1.25; 302 = number of filter taps (established experimentally)
|
||||
m_modPhasor += (m_running.m_fmDeviation / (float) m_running.m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 378.0f);
|
||||
m_modSample.real(cos(m_modPhasor) * 32678.0f);
|
||||
m_modSample.imag(sin(m_modPhasor) * 32678.0f);
|
||||
}
|
||||
|
@ -345,7 +345,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio input volume</string>
|
||||
<string>Audio input gain</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
@ -367,7 +367,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio input volume level</string>
|
||||
<string>Audio input gain value</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
@ -388,6 +388,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Volume meter. White line is 100% and shoul not be exceeded (red zone)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Modifications made to:
|
||||
* - use the widget horizontally
|
||||
* - differentiate each area with a different color
|
||||
* - allow overload by 25% with indication of 100% threshold and overload
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
@ -130,45 +131,31 @@ void LevelMeter::paintEvent(QPaintEvent *event)
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), Qt::black);
|
||||
|
||||
// red zone on top half
|
||||
QRect barTop = rect();
|
||||
barTop.setBottom(0.5 * rect().height());
|
||||
barTop.setLeft(0.75* rect().width());
|
||||
painter.fillRect(barTop, Qt::red);
|
||||
|
||||
QRect bar = rect();
|
||||
|
||||
// old
|
||||
// 100% full height white line
|
||||
bar.setLeft(0.75* rect().width() - 2);
|
||||
bar.setRight(0.75* rect().width());
|
||||
painter.fillRect(bar, Qt::white);
|
||||
|
||||
// bar.setTop(rect().top() + (1.0 - m_peakHoldLevel) * rect().height());
|
||||
// bar.setBottom(bar.top() + 5);
|
||||
// painter.fillRect(bar, m_rmsColor);
|
||||
// bar.setBottom(rect().bottom());
|
||||
//
|
||||
// bar.setTop(rect().top() + (1.0 - m_decayedPeakLevel) * rect().height());
|
||||
// painter.fillRect(bar, m_peakColor);
|
||||
//
|
||||
// bar.setTop(rect().top() + (1.0 - m_rmsLevel) * rect().height());
|
||||
// painter.fillRect(bar, m_rmsColor);
|
||||
// Bottom moving gauge
|
||||
|
||||
// old v.2
|
||||
bar.setTop(0.5 * rect().height());
|
||||
|
||||
// bar.setTop(rect().top() + (1.0 - m_peakHoldLevel) * rect().height());
|
||||
// bar.setBottom(bar.top() + 5);
|
||||
// painter.fillRect(bar, m_peakColor);
|
||||
// bar.setBottom(rect().bottom());
|
||||
//
|
||||
// bar.setTop(rect().top() + (1.0 - m_decayedPeakLevel) * rect().height());
|
||||
// painter.fillRect(bar, m_decayedPeakColor);
|
||||
//
|
||||
// bar.setTop(rect().top() + (1.0 - m_rmsLevel) * rect().height());
|
||||
// painter.fillRect(bar, m_rmsColor);
|
||||
|
||||
// new
|
||||
|
||||
bar.setRight(rect().right() - (1.0 - m_peakHoldLevel) * rect().width());
|
||||
bar.setRight(rect().right() - (1.0 - 0.75*m_peakHoldLevel) * rect().width());
|
||||
bar.setLeft(bar.right() - 5);
|
||||
painter.fillRect(bar, m_peakColor);
|
||||
bar.setLeft(rect().left());
|
||||
|
||||
bar.setRight(rect().right() - (1.0 - m_decayedPeakLevel) * rect().width());
|
||||
bar.setRight(rect().right() - (1.0 - 0.75*m_decayedPeakLevel) * rect().width());
|
||||
painter.fillRect(bar, m_decayedPeakColor);
|
||||
|
||||
bar.setRight(rect().right() - (1.0 - m_rmsLevel) * rect().width());
|
||||
bar.setRight(rect().right() - (1.0 - 0.75*m_rmsLevel) * rect().width());
|
||||
painter.fillRect(bar, m_rmsColor);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Modifications made to:
|
||||
* - use the widget horizontally
|
||||
* - differentiate each area with a different color
|
||||
* - allow overload by 25% with indication of 100% threshold and overload
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
|
Loading…
Reference in New Issue
Block a user