mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-19 10:32:02 -05:00
Moved audio input to the audio thread.
Change source URLs in teh CMake scripts for the kvasd binaries. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3563 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
1d4921caa8
commit
0cd7046a2a
@ -111,7 +111,7 @@ elseif (CMAKE_HOST_WIN32)
|
|||||||
add_definitions (-DWIN32)
|
add_definitions (-DWIN32)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_definitions (-DWSJT_SOFT_KEYING)
|
# add_definitions (-DWSJT_SOFT_KEYING)
|
||||||
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT)
|
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT)
|
||||||
|
|
||||||
|
|
||||||
@ -124,15 +124,13 @@ add_subdirectory (lib)
|
|||||||
#
|
#
|
||||||
# fetch kvasd
|
# fetch kvasd
|
||||||
#
|
#
|
||||||
if (WIN32)
|
if (APPLE)
|
||||||
set (kvasd_NAME KVASD.EXE)
|
set (kvasd_NAME http://svn.berlios.de/wsvn/wsjt/trunk/KVASD_gfortran_Mac${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
elseif (APPLE)
|
|
||||||
set (kvasd_NAME KVASD_gfortran_Mac${CMAKE_EXECUTABLE_SUFFIX})
|
|
||||||
else ()
|
else ()
|
||||||
set (kvasd_NAME KVASD_g95${CMAKE_EXECUTABLE_SUFFIX})
|
set (kvasd_NAME http://www.physics.princeton.edu/pulsar/K1JT/kvasd${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
endif ()
|
endif ()
|
||||||
file (
|
file (
|
||||||
DOWNLOAD http://svn.berlios.de/wsvn/wsjt/trunk/${kvasd_NAME} contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX}
|
DOWNLOAD ${kvasd_NAME} contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX}
|
||||||
STATUS kvasd_STATUS
|
STATUS kvasd_STATUS
|
||||||
LOG kvasd_LOG
|
LOG kvasd_LOG
|
||||||
SHOW_PROGRESS
|
SHOW_PROGRESS
|
||||||
|
17
Detector.hpp
17
Detector.hpp
@ -22,14 +22,7 @@ public:
|
|||||||
//
|
//
|
||||||
Detector (unsigned frameRate, unsigned periodLengthInSeconds, unsigned framesPerSignal, QObject * parent = 0);
|
Detector (unsigned frameRate, unsigned periodLengthInSeconds, unsigned framesPerSignal, QObject * parent = 0);
|
||||||
|
|
||||||
bool open (Channel channel = Mono) {return AudioDevice::open (QIODevice::WriteOnly, channel);}
|
|
||||||
|
|
||||||
bool isMonitoring () const {return m_monitoring;}
|
bool isMonitoring () const {return m_monitoring;}
|
||||||
void setMonitoring (bool newState) {m_monitoring = newState;}
|
|
||||||
|
|
||||||
bool reset ();
|
|
||||||
|
|
||||||
Q_SIGNAL void framesWritten (qint64);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
qint64 readData (char * /* data */, qint64 /* maxSize */)
|
qint64 readData (char * /* data */, qint64 /* maxSize */)
|
||||||
@ -40,13 +33,21 @@ protected:
|
|||||||
qint64 writeData (char const * data, qint64 maxSize);
|
qint64 writeData (char const * data, qint64 maxSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// these are private because we want thread safety, must be called via Qt queued connections
|
||||||
|
Q_SLOT void open (AudioDevice::Channel channel = Mono) {AudioDevice::open (QIODevice::WriteOnly, channel);}
|
||||||
|
Q_SLOT void setMonitoring (bool newState) {m_monitoring = newState;}
|
||||||
|
Q_SLOT bool reset ();
|
||||||
|
Q_SLOT void close () {AudioDevice::close ();}
|
||||||
|
|
||||||
|
Q_SIGNAL void framesWritten (qint64);
|
||||||
|
|
||||||
void clear (); // discard buffer contents
|
void clear (); // discard buffer contents
|
||||||
unsigned secondInPeriod () const;
|
unsigned secondInPeriod () const;
|
||||||
|
|
||||||
unsigned m_frameRate;
|
unsigned m_frameRate;
|
||||||
unsigned m_period;
|
unsigned m_period;
|
||||||
unsigned m_framesPerSignal;
|
unsigned m_framesPerSignal;
|
||||||
bool m_monitoring;
|
bool volatile m_monitoring;
|
||||||
bool m_starting;
|
bool m_starting;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
m_wideGraph (new WideGraph (settings)),
|
m_wideGraph (new WideGraph (settings)),
|
||||||
m_logDlg (new LogQSO (settings, this)),
|
m_logDlg (new LogQSO (settings, this)),
|
||||||
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, this),
|
m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2),
|
||||||
m_audioInputDevice (QAudioDeviceInfo::defaultInputDevice ()), // start with default
|
m_audioInputDevice (QAudioDeviceInfo::defaultInputDevice ()), // start with default
|
||||||
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
m_modulator (TX_SAMPLE_RATE, NTMAX / 2),
|
||||||
m_audioOutputDevice (QAudioDeviceInfo::defaultOutputDevice ()), // start with default
|
m_audioOutputDevice (QAudioDeviceInfo::defaultOutputDevice ()), // start with default
|
||||||
@ -58,15 +58,17 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
|
|
||||||
connect (this, &MainWindow::finished, this, &MainWindow::close);
|
connect (this, &MainWindow::finished, this, &MainWindow::close);
|
||||||
|
|
||||||
// start sound out thread and hook up slots & signals for shutdown management
|
// start audio thread and hook up slots & signals for shutdown management
|
||||||
|
|
||||||
// these two objects need to be in the other thread so that invoking
|
// these objects need to be in the audio thread so that invoking
|
||||||
// their slots is done in a thread safe way
|
// their slots is done in a thread safe way
|
||||||
m_soundOutput.moveToThread (&m_soundOutputThread);
|
m_soundOutput.moveToThread (&m_audioThread);
|
||||||
m_modulator.moveToThread (&m_soundOutputThread);
|
m_modulator.moveToThread (&m_audioThread);
|
||||||
|
m_soundInput.moveToThread (&m_audioThread);
|
||||||
|
m_detector.moveToThread (&m_audioThread);
|
||||||
|
|
||||||
connect (this, &MainWindow::finished, &m_soundOutputThread, &QThread::quit); // quit thread event loop
|
connect (this, &MainWindow::finished, &m_audioThread, &QThread::quit); // quit thread event loop
|
||||||
connect (&m_soundOutputThread, &QThread::finished, &m_soundOutputThread, &QThread::deleteLater); // disposal
|
connect (&m_audioThread, &QThread::finished, &m_audioThread, &QThread::deleteLater); // disposal
|
||||||
|
|
||||||
// hook up sound output stream slots & signals
|
// hook up sound output stream slots & signals
|
||||||
connect (this, SIGNAL (startAudioOutputStream (QAudioDeviceInfo const&, unsigned)), &m_soundOutput, SLOT (startStream (QAudioDeviceInfo const&, unsigned)));
|
connect (this, SIGNAL (startAudioOutputStream (QAudioDeviceInfo const&, unsigned)), &m_soundOutput, SLOT (startStream (QAudioDeviceInfo const&, unsigned)));
|
||||||
@ -80,15 +82,26 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
connect (this, SIGNAL(transmitFrequency (unsigned)), &m_modulator, SLOT (setFrequency (unsigned)));
|
connect (this, SIGNAL(transmitFrequency (unsigned)), &m_modulator, SLOT (setFrequency (unsigned)));
|
||||||
connect (this, SIGNAL (endTransmitMessage ()), &m_modulator, SLOT (close ()));
|
connect (this, SIGNAL (endTransmitMessage ()), &m_modulator, SLOT (close ()));
|
||||||
connect (this, SIGNAL (tune (bool)), &m_modulator, SLOT (tune (bool)));
|
connect (this, SIGNAL (tune (bool)), &m_modulator, SLOT (tune (bool)));
|
||||||
connect (
|
connect (this, SIGNAL (sendMessage (unsigned, double, unsigned, AudioDevice::Channel, bool, double))
|
||||||
this
|
, &m_modulator, SLOT (open (unsigned, double, unsigned, AudioDevice::Channel, bool, double)));
|
||||||
, SIGNAL (sendMessage (unsigned, double, unsigned, AudioDevice::Channel, bool, double))
|
|
||||||
, &m_modulator
|
|
||||||
, SLOT (open (unsigned, double, unsigned, AudioDevice::Channel, bool, double))
|
|
||||||
);
|
|
||||||
|
|
||||||
// start the sound output thread
|
// hook up the audio input stream
|
||||||
m_soundOutputThread.start (QThread::HighPriority);
|
connect (this, SIGNAL (startAudioInputStream (QAudioDeviceInfo const&, unsigned, int, QIODevice *))
|
||||||
|
, &m_soundInput, SLOT (start (QAudioDeviceInfo const&, unsigned, int, QIODevice *)));
|
||||||
|
connect (this, SIGNAL (stopAudioInputStream ()), &m_soundInput, SLOT (stop ()));
|
||||||
|
|
||||||
|
connect(&m_soundInput, SIGNAL (error (QString)), this, SLOT (showSoundInError (QString)));
|
||||||
|
// connect(&m_soundInput, SIGNAL(status(QString)), this, SLOT(showStatusMessage(QString)));
|
||||||
|
|
||||||
|
// hook up the detector
|
||||||
|
connect (this, SIGNAL (startDetector (AudioDevice::Channel)), &m_detector, SLOT (open (AudioDevice::Channel)));
|
||||||
|
connect (this, SIGNAL (detectorSetMonitoring (bool)), &m_detector, SLOT (setMonitoring (bool)));
|
||||||
|
connect (this, SIGNAL (detectorClose ()), &m_detector, SLOT (close ()));
|
||||||
|
|
||||||
|
connect(&m_detector, SIGNAL (framesWritten (qint64)), this, SLOT (dataSink (qint64)));
|
||||||
|
|
||||||
|
// start the audio thread
|
||||||
|
m_audioThread.start (QThread::HighPriority);
|
||||||
|
|
||||||
|
|
||||||
// setup the waterfall
|
// setup the waterfall
|
||||||
@ -140,11 +153,6 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
|
|
||||||
|
|
||||||
setWindowTitle(Program_Title_Version);
|
setWindowTitle(Program_Title_Version);
|
||||||
connect(&m_detector, &Detector::framesWritten, this, &MainWindow::dataSink);
|
|
||||||
connect(&m_soundInput, SIGNAL(error(QString)), this,
|
|
||||||
SLOT(showSoundInError(QString)));
|
|
||||||
// connect(&m_soundInput, SIGNAL(status(QString)), this,
|
|
||||||
// SLOT(showStatusMessage(QString)));
|
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
|
||||||
connect(&proc_jt9, SIGNAL(readyReadStandardOutput()),
|
connect(&proc_jt9, SIGNAL(readyReadStandardOutput()),
|
||||||
@ -369,13 +377,13 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the
|
|||||||
watcher2 = new QFutureWatcher<void>;
|
watcher2 = new QFutureWatcher<void>;
|
||||||
connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished()));
|
connect(watcher2, SIGNAL(finished()),this,SLOT(diskWriteFinished()));
|
||||||
|
|
||||||
m_detector.open (m_audioInputChannel);
|
Q_EMIT startDetector (m_audioInputChannel);
|
||||||
m_soundInput.start(m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
||||||
|
|
||||||
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
Q_EMIT transmitFrequency (m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0));
|
||||||
Q_EMIT muteAudioOutput (false);
|
Q_EMIT muteAudioOutput (false);
|
||||||
m_monitoring=!m_monitorStartOFF; // Start with Monitoring ON/OFF
|
m_monitoring=!m_monitorStartOFF; // Start with Monitoring ON/OFF
|
||||||
m_detector.setMonitoring(m_monitoring);
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
||||||
m_diskData=false;
|
m_diskData=false;
|
||||||
|
|
||||||
// Create "m_worked", a dictionary of all calls in wsjtx.log
|
// Create "m_worked", a dictionary of all calls in wsjtx.log
|
||||||
@ -820,10 +828,10 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
|||||||
m_After73=dlg.m_After73;
|
m_After73=dlg.m_After73;
|
||||||
|
|
||||||
if(dlg.m_restartSoundIn) {
|
if(dlg.m_restartSoundIn) {
|
||||||
m_soundInput.stop ();
|
Q_EMIT stopAudioInputStream ();
|
||||||
m_detector.close ();
|
Q_EMIT detectorClose ();
|
||||||
m_detector.open (m_audioInputChannel);
|
Q_EMIT startDetector (m_audioInputChannel);
|
||||||
m_soundInput.start(m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dlg.m_restartSoundOut) {
|
if(dlg.m_restartSoundOut) {
|
||||||
@ -859,8 +867,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
|||||||
void MainWindow::on_monitorButton_clicked() //Monitor
|
void MainWindow::on_monitorButton_clicked() //Monitor
|
||||||
{
|
{
|
||||||
m_monitoring=true;
|
m_monitoring=true;
|
||||||
m_detector.setMonitoring(true);
|
Q_EMIT detectorSetMonitoring (true);
|
||||||
// m_soundInput.start(m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
// Q_EMIT startAudioInputStream (m_audioInputDevice, AudioDevice::Mono == m_audioInputChannel ? 1 : 2, RX_SAMPLE_RATE / 10, &m_detector);
|
||||||
m_diskData=false;
|
m_diskData=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1097,13 +1105,13 @@ void MainWindow::OnExit()
|
|||||||
quitFile.remove();
|
quitFile.remove();
|
||||||
|
|
||||||
Q_EMIT finished ();
|
Q_EMIT finished ();
|
||||||
m_soundOutputThread.wait ();
|
m_audioThread.wait ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_stopButton_clicked() //stopButton
|
void MainWindow::on_stopButton_clicked() //stopButton
|
||||||
{
|
{
|
||||||
m_monitoring=false;
|
m_monitoring=false;
|
||||||
m_detector.setMonitoring(m_monitoring);
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
||||||
m_loopall=false;
|
m_loopall=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1128,7 +1136,7 @@ void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls
|
|||||||
void MainWindow::on_actionOpen_triggered() //Open File
|
void MainWindow::on_actionOpen_triggered() //Open File
|
||||||
{
|
{
|
||||||
m_monitoring=false;
|
m_monitoring=false;
|
||||||
m_detector.setMonitoring(m_monitoring);
|
Q_EMIT detectorSetMonitoring (m_monitoring);
|
||||||
QString fname;
|
QString fname;
|
||||||
fname=QFileDialog::getOpenFileName(this, "Open File", m_path,
|
fname=QFileDialog::getOpenFileName(this, "Open File", m_path,
|
||||||
"WSJT Files (*.wav)");
|
"WSJT Files (*.wav)");
|
||||||
@ -1695,7 +1703,7 @@ void MainWindow::guiUpdate()
|
|||||||
|
|
||||||
signalMeter->setValue(0);
|
signalMeter->setValue(0);
|
||||||
m_monitoring=false;
|
m_monitoring=false;
|
||||||
m_detector.setMonitoring(false);
|
Q_EMIT detectorSetMonitoring (false);
|
||||||
m_btxok=true;
|
m_btxok=true;
|
||||||
Q_EMIT muteAudioOutput (false);
|
Q_EMIT muteAudioOutput (false);
|
||||||
m_transmitting=true;
|
m_transmitting=true;
|
||||||
@ -1823,7 +1831,7 @@ void MainWindow::startTx2()
|
|||||||
transmit (snr);
|
transmit (snr);
|
||||||
signalMeter->setValue(0);
|
signalMeter->setValue(0);
|
||||||
m_monitoring=false;
|
m_monitoring=false;
|
||||||
m_detector.setMonitoring(false);
|
Q_EMIT detectorSetMonitoring (false);
|
||||||
m_btxok=true;
|
m_btxok=true;
|
||||||
Q_EMIT muteAudioOutput (false);
|
Q_EMIT muteAudioOutput (false);
|
||||||
m_transmitting=true;
|
m_transmitting=true;
|
||||||
@ -1842,7 +1850,7 @@ void MainWindow::stopTx()
|
|||||||
lab1->setText("");
|
lab1->setText("");
|
||||||
ptt0Timer->start(200); //Sequencer delay
|
ptt0Timer->start(200); //Sequencer delay
|
||||||
m_monitoring=true;
|
m_monitoring=true;
|
||||||
m_detector.setMonitoring(true);
|
Q_EMIT detectorSetMonitoring (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::stopTx2()
|
void MainWindow::stopTx2()
|
||||||
|
10
mainwindow.h
10
mainwindow.h
@ -181,6 +181,14 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Q_SIGNAL void startAudioOutputStream (QAudioDeviceInfo, unsigned channels);
|
Q_SIGNAL void startAudioOutputStream (QAudioDeviceInfo, unsigned channels);
|
||||||
Q_SIGNAL void stopAudioOutputStream ();
|
Q_SIGNAL void stopAudioOutputStream ();
|
||||||
|
|
||||||
|
Q_SIGNAL void startAudioInputStream (QAudioDeviceInfo const&, unsigned channels, int framesPerBuffer, QIODevice * sink);
|
||||||
|
Q_SIGNAL void stopAudioInputStream ();
|
||||||
|
|
||||||
|
Q_SIGNAL void startDetector (AudioDevice::Channel);
|
||||||
|
Q_SIGNAL void detectorSetMonitoring (bool);
|
||||||
|
Q_SIGNAL void detectorClose ();
|
||||||
|
|
||||||
Q_SIGNAL void finished ();
|
Q_SIGNAL void finished ();
|
||||||
Q_SIGNAL void muteAudioOutput (bool = true);
|
Q_SIGNAL void muteAudioOutput (bool = true);
|
||||||
Q_SIGNAL void transmitFrequency (unsigned);
|
Q_SIGNAL void transmitFrequency (unsigned);
|
||||||
@ -228,7 +236,7 @@ private:
|
|||||||
QAudioDeviceInfo m_audioOutputDevice;
|
QAudioDeviceInfo m_audioOutputDevice;
|
||||||
AudioDevice::Channel m_audioOutputChannel;
|
AudioDevice::Channel m_audioOutputChannel;
|
||||||
SoundOutput m_soundOutput;
|
SoundOutput m_soundOutput;
|
||||||
QThread m_soundOutputThread;
|
QThread m_audioThread;
|
||||||
|
|
||||||
qint32 m_TRperiod;
|
qint32 m_TRperiod;
|
||||||
qint32 m_nsps;
|
qint32 m_nsps;
|
||||||
|
10
soundin.cpp
10
soundin.cpp
@ -38,7 +38,7 @@ bool SoundInput::audioError () const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundInput::start(QAudioDeviceInfo const& device, unsigned channels, int framesPerBuffer, QIODevice * sink)
|
void SoundInput::start(QAudioDeviceInfo const& device, unsigned channels, int framesPerBuffer, QIODevice * sink)
|
||||||
{
|
{
|
||||||
Q_ASSERT (0 < channels && channels < 3);
|
Q_ASSERT (0 < channels && channels < 3);
|
||||||
Q_ASSERT (sink);
|
Q_ASSERT (sink);
|
||||||
@ -55,26 +55,26 @@ bool SoundInput::start(QAudioDeviceInfo const& device, unsigned channels, int fr
|
|||||||
if (!format.isValid ())
|
if (!format.isValid ())
|
||||||
{
|
{
|
||||||
Q_EMIT error (tr ("Requested input audio format is not valid."));
|
Q_EMIT error (tr ("Requested input audio format is not valid."));
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function lies!
|
// this function lies!
|
||||||
// if (!device.isFormatSupported (format))
|
// if (!device.isFormatSupported (format))
|
||||||
// {
|
// {
|
||||||
// Q_EMIT error (tr ("Requested input audio format is not supported on device."));
|
// Q_EMIT error (tr ("Requested input audio format is not supported on device."));
|
||||||
// return false;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
m_stream.reset (new QAudioInput (device, format, this));
|
m_stream.reset (new QAudioInput (device, format, this));
|
||||||
if (audioError ())
|
if (audioError ())
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect (m_stream.data(), &QAudioInput::stateChanged, this, &SoundInput::handleStateChanged);
|
connect (m_stream.data(), &QAudioInput::stateChanged, this, &SoundInput::handleStateChanged);
|
||||||
m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer));
|
m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer));
|
||||||
m_stream->start (sink);
|
m_stream->start (sink);
|
||||||
return audioError () ? false : true;
|
audioError ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundInput::handleStateChanged (QAudio::State newState) const
|
void SoundInput::handleStateChanged (QAudio::State newState) const
|
||||||
|
22
soundin.h
22
soundin.h
@ -26,22 +26,20 @@ class SoundInput : public QObject
|
|||||||
|
|
||||||
~SoundInput ();
|
~SoundInput ();
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void error (QString message) const;
|
|
||||||
void status (QString message) const;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
// sink must exist from the start call to any following stop () call
|
|
||||||
bool start(QAudioDeviceInfo const&, unsigned channels, int framesPerBuffer, QIODevice * sink);
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_SIGNAL void error (QString message) const;
|
||||||
|
Q_SIGNAL void status (QString message) const;
|
||||||
|
|
||||||
|
// sink must exist from the start call to any following stop () call
|
||||||
|
Q_SLOT void start(QAudioDeviceInfo const&, unsigned channels, int framesPerBuffer, QIODevice * sink);
|
||||||
|
Q_SLOT void stop();
|
||||||
|
|
||||||
|
// used internally
|
||||||
|
Q_SLOT void handleStateChanged (QAudio::State) const;
|
||||||
|
|
||||||
bool audioError () const;
|
bool audioError () const;
|
||||||
|
|
||||||
QScopedPointer<QAudioInput> m_stream;
|
QScopedPointer<QAudioInput> m_stream;
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void handleStateChanged (QAudio::State) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user