85 lines
1.8 KiB
C++
85 lines
1.8 KiB
C++
/***************************************************************************
|
|
|
|
source::worx raDIYo
|
|
Copyright © 2020-2022 c.holzheuer
|
|
chris@sourceworx.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 SWPlayerControl_H
|
|
#define SWPlayerControl_H
|
|
|
|
|
|
#include <QMediaPlayer>
|
|
#include <QAudioFormat>
|
|
#include <QAudioProbe>
|
|
#include <QAudioDeviceInfo>
|
|
#include <QSettings>
|
|
|
|
#include <ui_swplayercontrol.h>
|
|
#include <swcontrol.h>
|
|
#include <swfftcalc.h>
|
|
#include <swrangevalue.h>
|
|
|
|
|
|
/**
|
|
* @brief Dieses Control steuert den Mediaplayer und zeigt das Soundspektrum an.
|
|
* @see QMediaPlayer
|
|
* @see SWSpectrumWidget
|
|
*/
|
|
|
|
|
|
|
|
class SWPlayerControl : public SWControl, public SWRangeValue, private Ui_SWPlayerControl
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
|
|
|
|
explicit SWPlayerControl( QWidget* parent, QSettings* settings );
|
|
virtual ~SWPlayerControl();
|
|
|
|
void setValue( int value ) override;
|
|
|
|
void setUrl( const QString& urlText );
|
|
void togglePlaying( bool playIt );
|
|
void startPlaying();
|
|
void pausePlaying();
|
|
void stopPlaying();
|
|
|
|
signals:
|
|
|
|
void stateChanged( QMediaPlayer::State );
|
|
|
|
public slots:
|
|
|
|
void onDialDeltaChanged( int value ) override;
|
|
void onSpectrumReady( const SWValVec& spectrum );
|
|
void onAudioProbed( const QAudioBuffer& audiobuffer );
|
|
|
|
protected:
|
|
|
|
QString _volCmd = raDIYo::CmdVolume;
|
|
QUrl _mediaUrl ;
|
|
|
|
QAudioProbe _audioProbe;
|
|
QMediaPlayer _player;
|
|
|
|
SWFFTCalc _FFTCalc;
|
|
|
|
QThread _workerThread;
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif // SWPlayerControl_H
|