Switched to PortAudio
This commit is contained in:
40
audiodecoder.h
Normal file
40
audiodecoder.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QAudioDecoder>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
|
||||
class QAudioBuffer;
|
||||
class QIODevice;
|
||||
|
||||
class AudioDecoder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AudioDecoder(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void progress(int progress, int total);
|
||||
void decodingFinished(const QAudioBuffer &buffer);
|
||||
|
||||
public slots:
|
||||
void startDecoding(std::shared_ptr<QIODevice> device);
|
||||
|
||||
private slots:
|
||||
void error(const QAudioDecoder::Error error);
|
||||
void finished();
|
||||
void bufferReady();
|
||||
void durationChanged(const qint64 duration);
|
||||
|
||||
private:
|
||||
std::shared_ptr<QIODevice> m_device;
|
||||
QAudioDecoder m_decoder;
|
||||
QByteArray m_bytearray;
|
||||
QDateTime m_lastProgressUpdate;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<QIODevice>)
|
Reference in New Issue
Block a user