18#include <swplayercontrol.h>
25 _audioProbe.setSource( &_player );
27 connect( &_audioProbe, SIGNAL( audioBufferProbed(QAudioBuffer) ),
this, SLOT(onAudioProbed(QAudioBuffer) ) );
28 connect( &_FFTCalc, SIGNAL( spectrumReady(SWDoubleVec) ),
this, SLOT( onSpectrumReady(SWDoubleVec) ) );
31 const auto deviceInfos = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
32 for (
const QAudioDeviceInfo &deviceInfo : deviceInfos)
33 qDebug() <<
"Device name: " << deviceInfo.deviceName();
34 const QAudioDeviceInfo& defDev = QAudioDeviceInfo::defaultOutputDevice();
35 qDebug() <<
"Default Device name: " << defDev.deviceName();
39SWPlayerControl::~SWPlayerControl()
44void SWPlayerControl::loadSettings()
49void SWPlayerControl::saveSettings()
54void SWPlayerControl::onDialClicked()
56 qDebug() <<
"player onClick";
61void SWPlayerControl::onDialValueChanged(
int value )
65 _player.setVolume( _volume );
70void SWPlayerControl::onAudioProbed( QAudioBuffer audiobuffer )
78void SWPlayerControl::onSpectrumReady(
const SWDoubleVec& spectrum )
83 int numbins = _spectrumWidget->numBars();
85 int numvals = spectrum.size() / 4 * 2;
87 int divider = numvals / numbins;
88 QVector<int> bins( numbins );
89 SWDoubleVec vals( numbins );
91 for(
int i=0; i<numvals; ++i )
94 vals[ i/divider ] += spectrum[i];
98 for(
int i=0; i<numbins; ++i )
101 vals[ i ] /= bins[i];
103 _spectrumWidget->onValueListChanged( vals );
117 qDebug() <<
"SWPlayerControl::startPlaying: local" << urlText <<
" local: " << url.toLocalFile();
119 _player.setMedia( url );
120 _player.setVolume( _volume );
125void SWPlayerControl::stopPlaying()
128 qDebug() <<
"SWPlayerControl::stopPlaying: ";
131 _spectrumWidget->clearValueList();
void collectFrames(QAudioBuffer &audiobuffer)
Track::getPeakValue.
void startPlaying(const QString &urlText)
SWPlayerControl::startPlaying: Erwartet eine ordentliche URL als String.