Qt5 upgrade and new audio engine based in QtMultimedia.
New GUI.
This commit is contained in:
parent
6e268323d2
commit
cccd987bdd
23 changed files with 724 additions and 983 deletions
45
src/audiodecoder.h
Normal file
45
src/audiodecoder.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef AUDIODECODER_H
|
||||
#define AUDIODECODER_H
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QAudioFormat>
|
||||
#include <QAudioDecoder>
|
||||
|
||||
class AudioDecoder : public QIODevice
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioDecoder(const QAudioFormat &format, qint64 durationUs, int sampleRate, QObject *parent);
|
||||
AudioDecoder(const QAudioFormat &format, QObject *parent);
|
||||
~AudioDecoder();
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
qint64 readData(char *data, qint64 maxlen);
|
||||
qint64 writeData(const char *data, qint64 len);
|
||||
qint64 bytesAvailable() const;
|
||||
|
||||
void loadMedia(QString file);
|
||||
|
||||
void setPos(qint64 pos);
|
||||
|
||||
private:
|
||||
void generateData(const QAudioFormat &format, qint64 durationUs, int sampleRate);
|
||||
qint64 m_pos;
|
||||
QByteArray m_buffer;
|
||||
QAudioDecoder *m_decoder;
|
||||
|
||||
private slots:
|
||||
void readBuffer();
|
||||
void errorDecoding(QAudioDecoder::Error msg);
|
||||
void decoderFinished();
|
||||
void trackTimeChanged(qint64 dur);
|
||||
|
||||
signals:
|
||||
void totalTimeChanged(qint64 dur);
|
||||
void fileLoaded(QString file);
|
||||
};
|
||||
|
||||
#endif // AUDIODECODER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue