2019-10-08 14:33:38 -04:00
|
|
|
#ifndef NOTIFICATIONAUDIO_H
|
|
|
|
#define NOTIFICATIONAUDIO_H
|
|
|
|
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QBuffer>
|
|
|
|
#include <QAudioDeviceInfo>
|
|
|
|
#include <QAudioFormat>
|
|
|
|
#include <QAudioOutput>
|
|
|
|
#include <QFile>
|
2019-10-15 13:52:30 -04:00
|
|
|
#include <QPointer>
|
2019-10-08 14:33:38 -04:00
|
|
|
|
2019-10-15 13:52:30 -04:00
|
|
|
#include "AudioDevice.hpp"
|
|
|
|
#include "AudioDecoder.h"
|
2019-10-16 22:28:45 -04:00
|
|
|
#include "WaveFile.h"
|
2019-10-15 13:52:30 -04:00
|
|
|
#include "soundout.h"
|
|
|
|
|
2019-10-16 22:28:45 -04:00
|
|
|
|
2019-10-15 13:52:30 -04:00
|
|
|
class NotificationAudio :
|
|
|
|
public QObject
|
2019-10-08 14:33:38 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
NotificationAudio(QObject * parent=nullptr);
|
2019-10-08 21:26:17 -04:00
|
|
|
~NotificationAudio();
|
2019-10-08 14:33:38 -04:00
|
|
|
|
|
|
|
public slots:
|
2019-10-15 13:52:30 -04:00
|
|
|
void setDevice(const QAudioDeviceInfo &device, unsigned channels, unsigned msBuffer=0);
|
2019-10-08 14:33:38 -04:00
|
|
|
void play(const QString &filePath);
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
2019-10-15 13:52:30 -04:00
|
|
|
QPointer<SoundOutput> m_stream;
|
|
|
|
QPointer<AudioDecoder> m_decoder;
|
2019-10-16 22:28:45 -04:00
|
|
|
QPointer<WaveFile> m_file;
|
|
|
|
QAudioDeviceInfo m_device;
|
|
|
|
unsigned m_channels;
|
|
|
|
unsigned m_msBuffer;
|
2019-10-08 14:33:38 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NOTIFICATIONAUDIO_H
|