mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-25 20:33:08 -05:00
f076c37c19
default). Reorganized Modulator interface so that it can control the stream it writes to. Make sure only QAudioOutput::stop is called at the end of sending rather than QAudioOutput::reset which discards pending samples. Added a quick close option to the Modulator::stop slot to discard pending buffers if required. Fix issue in CW synthesizer that was causing CW to be inverted occasionally. Made global arrays of symbols volatile because compiler waa optimizing away reads in sound thread. These global variables must go eventually as they are a multi-threading hazard. Simplified TX sequencing to remove some duplicate signals. Increased range of TX attenuator from 10dB to 30dB. This is mainly for non-Windows platforms where the attenuator isn't linearized correctly. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3985 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
55 lines
1006 B
C++
55 lines
1006 B
C++
// -*- Mode: C++ -*-
|
|
#ifndef SOUNDOUT_H__
|
|
#define SOUNDOUT_H__
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QAudioOutput>
|
|
#include <QAudioDeviceInfo>
|
|
|
|
class QAudioDeviceInfo;
|
|
|
|
// An instance of this sends audio data to a specified soundcard.
|
|
|
|
class SoundOutput
|
|
: public QObject
|
|
{
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
SoundOutput ()
|
|
: m_msBuffered {0u}
|
|
, m_volume {1.0}
|
|
{
|
|
}
|
|
|
|
qreal attenuation () const;
|
|
|
|
public Q_SLOTS:
|
|
void setFormat (QAudioDeviceInfo const& device, unsigned channels, 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 audioError () const;
|
|
|
|
private Q_SLOTS:
|
|
void handleStateChanged (QAudio::State);
|
|
|
|
private:
|
|
QScopedPointer<QAudioOutput> m_stream;
|
|
unsigned m_msBuffered;
|
|
qreal m_volume;
|
|
};
|
|
|
|
#endif
|