Logo Search packages:      
Sourcecode: kdenlive version File versions  Download package


 *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
 *   This file is part of kdenlive. See www.kdenlive.org.                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *

   Displays a spectral power distribution of audio samples.
   The frequency distribution is calculated by means of a Fast Fourier Transformation.
   For more information see Wikipedia:FFT and the code comments.


// Enables debugging

// Show overmodulation

#include <QtCore>
#include <QVector>
#include <QHash>

#include "abstractaudioscopewidget.h"
#include "ui_audiospectrum_ui.h"
#include "tools/kiss_fftr.h"
#include "ffttools.h"

class AudioSpectrum_UI;
00036 class AudioSpectrum : public AbstractAudioScopeWidget {

    AudioSpectrum(QWidget *parent = 0);

    // Implemented virtual methods
    QString widgetName() const;

    ///// Implemented methods /////
    QRect scopeRect();
    QImage renderHUD(uint accelerationFactor);
    QImage renderAudioScope(uint accelerationFactor, const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples, const int newData);
    QImage renderBackground(uint accelerationFactor);
    bool isHUDDependingOnInput() const;
    bool isScopeDependingOnInput() const;
    bool isBackgroundDependingOnInput() const;
    virtual void readConfig();
    void writeConfig();

    virtual void handleMouseDrag(const QPoint movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers);

    Ui::AudioSpectrum_UI *ui;

    QAction *m_aResetHz;
    QAction *m_aTrackMouse;
    QAction *m_aShowMax;

    FFTTools m_fftTools;
    QVector<float> m_lastFFT;
    QSemaphore m_lastFFTLock;

    QVector<float> m_peaks;
    QVector<float> m_peakMap;

    /** Contains the plot only; m_scopeRect contains text and widgets as well */
00076     QRect m_innerScopeRect;

    /** Lower bound for the dB value to display */
00079     int m_dBmin;
    /** Upper bound (max: 0) */
00081     int m_dBmax;

    /** Maximum frequency (limited by the sampling rate if determined automatically).
        Stored for the painters. */
00085     int m_freqMax;
    /** The user has chosen a custom frequency. */
00087     bool m_customFreq;

    float colorizeFactor;

    long m_timeTotal;
    long m_showTotal;

private slots:
    void slotResetMaxFreq();



Generated by  Doxygen 1.6.0   Back to index