#define MIN_FREQ_VALUE 1000
Spectrogram::Spectrogram(QWidget *parent) :
- AbstractAudioScopeWidget(true, parent)
- , m_fftTools()
- , m_fftHistory()
- , m_fftHistoryImg()
- , m_dBmin(-70)
- , m_dBmax(0)
- , m_freqMax(0)
- , m_customFreq(false)
- , m_parameterChanged(false)
+ AbstractAudioScopeWidget(true, parent)
+ , m_fftTools()
+ , m_fftHistory()
+ , m_fftHistoryImg()
+ , m_dBmin(-70)
+ , m_dBmax(0)
+ , m_freqMax(0)
+ , m_customFreq(false)
+ , m_parameterChanged(false)
{
ui = new Ui::Spectrogram_UI;
ui->setupUi(this);
QRect Spectrogram::scopeRect()
{
m_scopeRect = QRect(
- QPoint(
+ QPoint(
10, // Left
ui->verticalSpacer->geometry().top()+6 // Top
- ),
- AbstractAudioScopeWidget::rect().bottomRight()
- );
+ ),
+ AbstractAudioScopeWidget::rect().bottomRight()
+ );
m_innerScopeRect = QRect(
- QPoint(
+ QPoint(
m_scopeRect.left()+66, // Left
m_scopeRect.top()+6 // Top
- ), QPoint(
+ ), QPoint(
ui->verticalSpacer->geometry().right()-70,
ui->verticalSpacer->geometry().bottom()-40
- )
- );
+ )
+ );
return m_scopeRect;
}
x = leftDist + mouseX;
davinci.drawLine(x, topDist, x, topDist + m_innerScopeRect.height()+6);
davinci.drawText(x-10, y, i18n("%1 kHz", QString("%1")
- .arg((double)(m_mousePos.x()-m_innerScopeRect.left())/m_innerScopeRect.width() * m_freqMax/1000, 0, 'f', 2)));
+ .arg((double)(m_mousePos.x()-m_innerScopeRect.left())/m_innerScopeRect.width() * m_freqMax/1000, 0, 'f', 2)));
}
// Draw the dB brightness scale
if (
audioFrame.size() > 63
&& m_innerScopeRect.width() > 0 && m_innerScopeRect.height() > 0
- ) {
+ ) {
if (!m_customFreq) {
m_freqMax = freq / 2;
}
#ifdef DEBUG_SPECTROGRAM
qDebug() << "Rendered " << y-topDist << "lines from " << m_fftHistory.size() << " available samples in " << start.elapsed() << " ms"
- << (completeRedraw ? "" : " (re-used old image)");
+ << (completeRedraw ? "" : " (re-used old image)");
uint storedBytes = 0;
for (QList< QVector<float> >::iterator it = m_fftHistory.begin(); it != m_fftHistory.end(); it++) {
storedBytes += (*it).size() * sizeof((*it)[0]);