mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-24 13:08:34 -04:00
Qt's built-in QAudio calls rather than PortAudio. Also includes some refactoring of the arrangement for these calls, and more use of C++ style. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3523 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
53 lines
858 B
C++
53 lines
858 B
C++
#ifndef SOUNDOUT_H__
|
|
#define SOUNDOUT_H__
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QAudioOutput>
|
|
|
|
#include "Modulator.hpp"
|
|
|
|
class QAudioDeviceInfo;
|
|
|
|
// An instance of this sends audio data to a specified soundcard.
|
|
|
|
class SoundOutput : public QObject
|
|
{
|
|
Q_OBJECT;
|
|
|
|
Q_PROPERTY(bool running READ isRunning);
|
|
|
|
private:
|
|
Q_DISABLE_COPY (SoundOutput);
|
|
|
|
public:
|
|
SoundOutput ()
|
|
: m_active(false)
|
|
{
|
|
}
|
|
~SoundOutput ();
|
|
|
|
bool isRunning() const {return m_active;}
|
|
|
|
public Q_SLOTS:
|
|
bool start(QAudioDeviceInfo const& device, QIODevice * source);
|
|
void stop();
|
|
|
|
Q_SIGNALS:
|
|
void error (QString message) const;
|
|
void status (QString message) const;
|
|
|
|
private:
|
|
bool audioError () const;
|
|
|
|
private Q_SLOTS:
|
|
void handleStateChanged (QAudio::State) const;
|
|
|
|
private:
|
|
QScopedPointer<QAudioOutput> m_stream;
|
|
|
|
bool m_active;
|
|
};
|
|
|
|
#endif
|