js8call/NotificationAudio.h

42 lines
848 B
C
Raw Normal View History

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"
#include "WaveFile.h"
2019-10-15 13:52:30 -04:00
#include "soundout.h"
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);
~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;
QPointer<WaveFile> m_file;
QAudioDeviceInfo m_device;
unsigned m_channels;
unsigned m_msBuffer;
2019-10-08 14:33:38 -04:00
};
#endif // NOTIFICATIONAUDIO_H