js8call/JS8_Audio/SoundOutput.h
Chris-AC9KH 1ab08249b1 remove MainWindow class from mainwindow.cpp and replace it with UI_Constructor class
rename remaining files that didn't match their class definitions
relocate the explicit UI_Constructor member function to JS8_MainWindow
relocate the processBufferedActivity member function to JS8_MainWindow
format affected files with LLVM clang-format

Set default APRS inbound relay to off
Fix layout of General->Networking & Autoreply tab in Settings
2026-01-18 19:19:15 -06:00

54 lines
1.2 KiB
C++

// -*- Mode: C++ -*-
#ifndef SOUNDOUT_H__
#define SOUNDOUT_H__
#include <QAudioDevice>
#include <QAudioFormat>
#include <QAudioSink>
#include <QObject>
#include <QString>
// An instance of this sends audio data to a specified soundcard.
class SoundOutput : public QObject {
Q_OBJECT;
public:
SoundOutput() = default;
qreal attenuation() const;
QAudioFormat format() const;
public Q_SLOTS:
void setFormat(QAudioDevice const &device, unsigned channels,
unsigned msBuffered = 0u);
void setDeviceFormat(QAudioDevice const &device, QAudioFormat const &format,
unsigned msBuffered = 0u);
void restart(QIODevice *);
void suspend();
void resume();
void reset();
void stop();
void setAttenuation(qreal); /* unsigned */
void resetAttenuation(); /* to zero */
Q_SIGNALS:
void error(QString message) const;
void status(QString message) const;
private:
bool checkStream() const;
private Q_SLOTS:
void handleStateChanged(QAudio::State) const;
private:
QAudioDevice m_device;
QScopedPointer<QAudioSink> m_stream;
QAudioFormat m_format;
unsigned m_msBuffered = 0u;
qreal m_volume = 1.0;
bool m_error = false;
};
#endif