1 /***************************************************************************
2 * Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com) *
3 * This file is part of kdenlive. See www.kdenlive.org. *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #include "abstractaudioscopewidget.h"
15 #include <QtConcurrentRun>
19 #include <QMouseEvent>
22 // Uncomment for debugging
29 AbstractAudioScopeWidget::AbstractAudioScopeWidget(bool trackMouse, QWidget *parent) :
30 AbstractScopeWidget(trackMouse, parent),
39 void AbstractAudioScopeWidget::slotReceiveAudio(const QVector<int16_t> &sampleData, int freq, int num_channels, int num_samples)
42 qDebug() << "Received audio for " << widgetName() << ".";
44 m_audioFrame = sampleData;
46 m_nChannels = num_channels;
47 m_nSamples = num_samples;
49 m_newData.fetchAndAddAcquire(1);
51 AbstractScopeWidget::slotRenderZoneUpdated();
54 AbstractAudioScopeWidget::~AbstractAudioScopeWidget() {}
56 QImage AbstractAudioScopeWidget::renderScope(uint accelerationFactor)
58 int newData = m_newData.fetchAndStoreAcquire(0);
60 return renderAudioScope(accelerationFactor, m_audioFrame, m_freq, m_nChannels, m_nSamples, newData);