]> git.sesse.net Git - kdenlive/blobdiff - src/scopes/audioscopes/abstractaudioscopewidget.h
Preparing for scope manager (merge from Granjow's work in refactoring)
[kdenlive] / src / scopes / audioscopes / abstractaudioscopewidget.h
diff --git a/src/scopes/audioscopes/abstractaudioscopewidget.h b/src/scopes/audioscopes/abstractaudioscopewidget.h
new file mode 100644 (file)
index 0000000..b9c3430
--- /dev/null
@@ -0,0 +1,59 @@
+/***************************************************************************
+ *   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.                                   *
+ ***************************************************************************/
+
+#ifndef ABSTRACTAUDIOSCOPEWIDGET_H
+#define ABSTRACTAUDIOSCOPEWIDGET_H
+
+
+#include <QtCore>
+#include <QWidget>
+
+#include <stdint.h>
+
+#include "abstractscopewidget.h"
+
+class QMenu;
+
+class Monitor;
+class Render;
+
+class AbstractAudioScopeWidget : public AbstractScopeWidget
+{
+    Q_OBJECT
+public:
+    AbstractAudioScopeWidget(bool trackMouse = false, QWidget *parent = 0);
+    virtual ~AbstractAudioScopeWidget();
+
+protected:
+    /** @brief This is just a wrapper function, subclasses can use renderAudioScope. */
+    virtual QImage renderScope(uint accelerationFactor);
+
+    ///// Unimplemented Methods /////
+    /** @brief Scope renderer. Must emit signalScopeRenderingFinished()
+        when calculation has finished, to allow multi-threading.
+        accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */
+    virtual QImage renderAudioScope(uint accelerationFactor,
+                               const QVector<int16_t> audioFrame, const int freq, const int num_channels, const int num_samples,
+                               const int newData) = 0;
+
+    int m_freq;
+    int m_nChannels;
+    int m_nSamples;
+
+private:
+    QVector<int16_t> m_audioFrame;
+    QAtomicInt m_newData;
+
+private slots:
+    void slotReceiveAudio(const QVector<int16_t>& sampleData, int freq, int num_channels, int num_samples);
+
+};
+
+#endif // ABSTRACTAUDIOSCOPEWIDGET_H