mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Renamed sdrbase AudioOutput to AudioOutputDevice
This commit is contained in:
parent
00b234b85c
commit
d2710806bf
@ -22,7 +22,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "device/deviceapi.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "chanalyzer.h"
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "util/stepfunctions.h"
|
||||
#include "util/db.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <complex.h>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
#include "util/db.h"
|
||||
#include "util/stepfunctions.h"
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include <stdio.h>
|
||||
#include <complex.h>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
|
||||
#include "atvdemodsink.h"
|
||||
|
||||
const int ATVDemodSink::m_ssbFftLen = 1024;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "device/deviceapi.h"
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "util/db.h"
|
||||
|
||||
#include "dsddemodsink.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "codec2/modem_stats.h"
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "util/db.h"
|
||||
|
||||
#include "freedvdemodsink.h"
|
||||
@ -569,4 +569,4 @@ void FreeDVDemodSink::getSNRLevels(double& avg, double& peak, int& nbSamples)
|
||||
void FreeDVDemodSink::resyncFreeDV()
|
||||
{
|
||||
freedv_set_sync(m_freeDV, FREEDV_SYNC_UNSYNC);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "util/stepfunctions.h"
|
||||
#include "util/db.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "SWGWFMDemodReport.h"
|
||||
|
||||
#include "device/deviceapi.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "SWGChannelReport.h"
|
||||
#include "SWGFreqTrackerReport.h"
|
||||
|
||||
#include "audio/audiooutput.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
|
@ -75,7 +75,7 @@ set(sdrbase_SOURCES
|
||||
audio/audiofilter.cpp
|
||||
audio/audiog722.cpp
|
||||
audio/audioopus.cpp
|
||||
audio/audiooutput.cpp
|
||||
audio/audiooutputdevice.cpp
|
||||
audio/audioinputdevice.cpp
|
||||
audio/audionetsink.cpp
|
||||
audio/audioresampler.cpp
|
||||
@ -214,7 +214,7 @@ set(sdrbase_HEADERS
|
||||
audio/audiofifo.h
|
||||
audio/audiofilter.h
|
||||
audio/audiog722.h
|
||||
audio/audiooutput.h
|
||||
audio/audiooutputdevice.h
|
||||
audio/audioopus.h
|
||||
audio/audioinputdevice.h
|
||||
audio/audionetsink.h
|
||||
|
@ -67,8 +67,8 @@ QDataStream& operator>>(QDataStream& ds, AudioDeviceManager::OutputDeviceInfo& i
|
||||
>> intChannelMode
|
||||
>> intChannelCodec
|
||||
>> info.udpDecimationFactor;
|
||||
info.udpChannelMode = (AudioOutput::UDPChannelMode) intChannelMode;
|
||||
info.udpChannelCodec = (AudioOutput::UDPChannelCodec) intChannelCodec;
|
||||
info.udpChannelMode = (AudioOutputDevice::UDPChannelMode) intChannelMode;
|
||||
info.udpChannelCodec = (AudioOutputDevice::UDPChannelCodec) intChannelCodec;
|
||||
return ds;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ AudioDeviceManager::AudioDeviceManager()
|
||||
|
||||
AudioDeviceManager::~AudioDeviceManager()
|
||||
{
|
||||
QMap<int, AudioOutput*>::iterator it = m_audioOutputs.begin();
|
||||
QMap<int, AudioOutputDevice*>::iterator it = m_audioOutputs.begin();
|
||||
|
||||
for (; it != m_audioOutputs.end(); ++it) {
|
||||
delete(*it);
|
||||
@ -254,7 +254,7 @@ void AudioDeviceManager::addAudioSink(AudioFifo* audioFifo, MessageQueue *sample
|
||||
qDebug("AudioDeviceManager::addAudioSink: %d: %p", outputDeviceIndex, audioFifo);
|
||||
|
||||
if (m_audioOutputs.find(outputDeviceIndex) == m_audioOutputs.end()) {
|
||||
m_audioOutputs[outputDeviceIndex] = new AudioOutput();
|
||||
m_audioOutputs[outputDeviceIndex] = new AudioOutputDevice();
|
||||
}
|
||||
|
||||
if ((m_audioOutputs[outputDeviceIndex]->getNbFifos() == 0) &&
|
||||
@ -370,8 +370,8 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
quint16 udpPort;
|
||||
bool copyAudioToUDP;
|
||||
bool udpUseRTP;
|
||||
AudioOutput::UDPChannelMode udpChannelMode;
|
||||
AudioOutput::UDPChannelCodec udpChannelCodec;
|
||||
AudioOutputDevice::UDPChannelMode udpChannelMode;
|
||||
AudioOutputDevice::UDPChannelCodec udpChannelCodec;
|
||||
uint32_t decimationFactor;
|
||||
QString deviceName;
|
||||
|
||||
@ -384,8 +384,8 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
udpPort = m_defaultUDPPort;
|
||||
copyAudioToUDP = false;
|
||||
udpUseRTP = false;
|
||||
udpChannelMode = AudioOutput::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutput::UDPCodecL16;
|
||||
udpChannelMode = AudioOutputDevice::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutputDevice::UDPCodecL16;
|
||||
decimationFactor = 1;
|
||||
}
|
||||
else
|
||||
@ -617,7 +617,7 @@ void AudioDeviceManager::setOutputDeviceInfo(int outputDeviceIndex, const Output
|
||||
return;
|
||||
}
|
||||
|
||||
AudioOutput *audioOutput = m_audioOutputs[outputDeviceIndex];
|
||||
AudioOutputDevice *audioOutput = m_audioOutputs[outputDeviceIndex];
|
||||
|
||||
if (oldDeviceInfo.sampleRate != deviceInfo.sampleRate)
|
||||
{
|
||||
@ -639,7 +639,7 @@ void AudioDeviceManager::setOutputDeviceInfo(int outputDeviceIndex, const Output
|
||||
audioOutput->setUdpDestination(deviceInfo.udpAddress, deviceInfo.udpPort);
|
||||
audioOutput->setUdpUseRTP(deviceInfo.udpUseRTP);
|
||||
audioOutput->setUdpChannelMode(deviceInfo.udpChannelMode);
|
||||
audioOutput->setUdpChannelFormat(deviceInfo.udpChannelCodec, deviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo, deviceInfo.sampleRate);
|
||||
audioOutput->setUdpChannelFormat(deviceInfo.udpChannelCodec, deviceInfo.udpChannelMode == AudioOutputDevice::UDPChannelStereo, deviceInfo.sampleRate);
|
||||
audioOutput->setUdpDecimation(deviceInfo.udpDecimationFactor);
|
||||
|
||||
qDebug("AudioDeviceManager::setOutputDeviceInfo: index: %d device: %s updated",
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QAudioDeviceInfo>
|
||||
|
||||
#include "audio/audioinputdevice.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "export.h"
|
||||
|
||||
class QDataStream;
|
||||
@ -60,8 +60,8 @@ public:
|
||||
udpPort(m_defaultUDPPort),
|
||||
copyToUDP(false),
|
||||
udpUseRTP(false),
|
||||
udpChannelMode(AudioOutput::UDPChannelLeft),
|
||||
udpChannelCodec(AudioOutput::UDPCodecL16),
|
||||
udpChannelMode(AudioOutputDevice::UDPChannelLeft),
|
||||
udpChannelCodec(AudioOutputDevice::UDPCodecL16),
|
||||
udpDecimationFactor(1)
|
||||
{}
|
||||
void resetToDefaults() {
|
||||
@ -70,8 +70,8 @@ public:
|
||||
udpPort = m_defaultUDPPort;
|
||||
copyToUDP = false;
|
||||
udpUseRTP = false;
|
||||
udpChannelMode = AudioOutput::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutput::UDPCodecL16;
|
||||
udpChannelMode = AudioOutputDevice::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutputDevice::UDPCodecL16;
|
||||
udpDecimationFactor = 1;
|
||||
}
|
||||
int sampleRate;
|
||||
@ -79,8 +79,8 @@ public:
|
||||
quint16 udpPort;
|
||||
bool copyToUDP;
|
||||
bool udpUseRTP;
|
||||
AudioOutput::UDPChannelMode udpChannelMode;
|
||||
AudioOutput::UDPChannelCodec udpChannelCodec;
|
||||
AudioOutputDevice::UDPChannelMode udpChannelMode;
|
||||
AudioOutputDevice::UDPChannelCodec udpChannelCodec;
|
||||
uint32_t udpDecimationFactor;
|
||||
friend QDataStream& operator<<(QDataStream& ds, const OutputDeviceInfo& info);
|
||||
friend QDataStream& operator>>(QDataStream& ds, OutputDeviceInfo& info);
|
||||
@ -127,7 +127,7 @@ private:
|
||||
QMap<AudioFifo*, int> m_audioSinkFifos; //< audio sink FIFO to audio output device index-1 map
|
||||
QMap<AudioFifo*, MessageQueue*> m_audioFifoToSinkMessageQueues; //!< audio sink FIFO to attached sink message queue
|
||||
QMap<int, QList<MessageQueue*> > m_outputDeviceSinkMessageQueues; //!< sink message queues attached to device
|
||||
QMap<int, AudioOutput*> m_audioOutputs; //!< audio device index to audio output map (index -1 is default device)
|
||||
QMap<int, AudioOutputDevice*> m_audioOutputs; //!< audio device index to audio output map (index -1 is default device)
|
||||
QMap<QString, OutputDeviceInfo> m_audioOutputInfos; //!< audio device name to audio output info
|
||||
|
||||
QMap<AudioFifo*, int> m_audioSourceFifos; //< audio source FIFO to audio input device index-1 map
|
||||
|
@ -20,11 +20,11 @@
|
||||
#include <QAudioFormat>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QAudioOutput>
|
||||
#include "audiooutput.h"
|
||||
#include "audiooutputdevice.h"
|
||||
#include "audiofifo.h"
|
||||
#include "audionetsink.h"
|
||||
|
||||
AudioOutput::AudioOutput() :
|
||||
AudioOutputDevice::AudioOutputDevice() :
|
||||
m_mutex(QMutex::Recursive),
|
||||
m_audioOutput(0),
|
||||
m_audioNetSink(0),
|
||||
@ -37,7 +37,7 @@ AudioOutput::AudioOutput() :
|
||||
{
|
||||
}
|
||||
|
||||
AudioOutput::~AudioOutput()
|
||||
AudioOutputDevice::~AudioOutputDevice()
|
||||
{
|
||||
// stop();
|
||||
//
|
||||
@ -51,7 +51,7 @@ AudioOutput::~AudioOutput()
|
||||
// m_audioFifos.clear();
|
||||
}
|
||||
|
||||
bool AudioOutput::start(int device, int rate)
|
||||
bool AudioOutputDevice::start(int device, int rate)
|
||||
{
|
||||
|
||||
// if (m_audioUsageCount == 0)
|
||||
@ -62,7 +62,7 @@ bool AudioOutput::start(int device, int rate)
|
||||
if (device < 0)
|
||||
{
|
||||
devInfo = QAudioDeviceInfo::defaultOutputDevice();
|
||||
qWarning("AudioOutput::start: using system default device %s", qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
qWarning("AudioOutputDevice::start: using system default device %s", qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -71,12 +71,12 @@ bool AudioOutput::start(int device, int rate)
|
||||
if (device < devicesInfo.size())
|
||||
{
|
||||
devInfo = devicesInfo[device];
|
||||
qWarning("AudioOutput::start: using audio device #%d: %s", device, qPrintable(devInfo.deviceName()));
|
||||
qWarning("AudioOutputDevice::start: using audio device #%d: %s", device, qPrintable(devInfo.deviceName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
devInfo = QAudioDeviceInfo::defaultOutputDevice();
|
||||
qWarning("AudioOutput::start: audio device #%d does not exist. Using system default device %s", device, qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
qWarning("AudioOutputDevice::start: audio device #%d does not exist. Using system default device %s", device, qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,16 +99,16 @@ bool AudioOutput::start(int device, int rate)
|
||||
<< " codec: " << m_audioFormat.codec().toStdString()
|
||||
<< " byteOrder: " << (m_audioFormat.byteOrder() == QAudioFormat::BigEndian ? "BE" : "LE")
|
||||
<< " sampleType: " << (int) m_audioFormat.sampleType();
|
||||
qWarning("AudioOutput::start: format %d Hz 2xS16LE audio/pcm not supported. Using: %s", rate, os.str().c_str());
|
||||
qWarning("AudioOutputDevice::start: format %d Hz 2xS16LE audio/pcm not supported. Using: %s", rate, os.str().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
qInfo("AudioOutput::start: audio format OK");
|
||||
qInfo("AudioOutputDevice::start: audio format OK");
|
||||
}
|
||||
|
||||
if (m_audioFormat.sampleSize() != 16)
|
||||
{
|
||||
qWarning("AudioOutput::start: Audio device '%s' failed", qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
qWarning("AudioOutputDevice::start: Audio device '%s' failed", qPrintable(devInfo.defaultOutputDevice().deviceName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ bool AudioOutput::start(int device, int rate)
|
||||
|
||||
if (m_audioOutput->state() != QAudio::ActiveState)
|
||||
{
|
||||
qWarning("AudioOutput::start: cannot start");
|
||||
qWarning("AudioOutputDevice::start: cannot start");
|
||||
}
|
||||
// }
|
||||
//
|
||||
@ -130,9 +130,9 @@ bool AudioOutput::start(int device, int rate)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioOutput::stop()
|
||||
void AudioOutputDevice::stop()
|
||||
{
|
||||
qDebug("AudioOutput::stop");
|
||||
qDebug("AudioOutputDevice::stop");
|
||||
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
m_audioOutput->stop();
|
||||
@ -157,14 +157,14 @@ void AudioOutput::stop()
|
||||
// }
|
||||
}
|
||||
|
||||
void AudioOutput::addFifo(AudioFifo* audioFifo)
|
||||
void AudioOutputDevice::addFifo(AudioFifo* audioFifo)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
m_audioFifos.push_back(audioFifo);
|
||||
}
|
||||
|
||||
void AudioOutput::removeFifo(AudioFifo* audioFifo)
|
||||
void AudioOutputDevice::removeFifo(AudioFifo* audioFifo)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
@ -172,37 +172,37 @@ void AudioOutput::removeFifo(AudioFifo* audioFifo)
|
||||
}
|
||||
|
||||
/*
|
||||
bool AudioOutput::open(OpenMode mode)
|
||||
bool AudioOutputDevice::open(OpenMode mode)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
void AudioOutput::setUdpDestination(const QString& address, uint16_t port)
|
||||
void AudioOutputDevice::setUdpDestination(const QString& address, uint16_t port)
|
||||
{
|
||||
if (m_audioNetSink) {
|
||||
m_audioNetSink->setDestination(address, port);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutput::setUdpCopyToUDP(bool copyToUDP)
|
||||
void AudioOutputDevice::setUdpCopyToUDP(bool copyToUDP)
|
||||
{
|
||||
m_copyAudioToUdp = copyToUDP;
|
||||
}
|
||||
|
||||
void AudioOutput::setUdpUseRTP(bool useRTP)
|
||||
void AudioOutputDevice::setUdpUseRTP(bool useRTP)
|
||||
{
|
||||
if (m_audioNetSink) {
|
||||
m_audioNetSink->selectType(useRTP ? AudioNetSink::SinkRTP : AudioNetSink::SinkUDP);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutput::setUdpChannelMode(UDPChannelMode udpChannelMode)
|
||||
void AudioOutputDevice::setUdpChannelMode(UDPChannelMode udpChannelMode)
|
||||
{
|
||||
m_udpChannelMode = udpChannelMode;
|
||||
}
|
||||
|
||||
void AudioOutput::setUdpChannelFormat(UDPChannelCodec udpChannelCodec, bool stereo, int sampleRate)
|
||||
void AudioOutputDevice::setUdpChannelFormat(UDPChannelCodec udpChannelCodec, bool stereo, int sampleRate)
|
||||
{
|
||||
m_udpChannelCodec = udpChannelCodec;
|
||||
|
||||
@ -211,16 +211,16 @@ void AudioOutput::setUdpChannelFormat(UDPChannelCodec udpChannelCodec, bool ster
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutput::setUdpDecimation(uint32_t decimation)
|
||||
void AudioOutputDevice::setUdpDecimation(uint32_t decimation)
|
||||
{
|
||||
if (m_audioNetSink) {
|
||||
m_audioNetSink->setDecimation(decimation);
|
||||
}
|
||||
}
|
||||
|
||||
qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
||||
qint64 AudioOutputDevice::readData(char* data, qint64 maxLen)
|
||||
{
|
||||
//qDebug("AudioOutput::readData: %lld", maxLen);
|
||||
//qDebug("AudioOutputDevice::readData: %lld", maxLen);
|
||||
|
||||
// Study this mutex on OSX, for now deadlocks possible
|
||||
// Removed as it may indeed cause lockups and is in fact useless.
|
||||
@ -258,7 +258,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
||||
|
||||
// if (samples != framesPerBuffer)
|
||||
// {
|
||||
// qDebug("AudioOutput::readData: read %d samples vs %d requested", samples, framesPerBuffer);
|
||||
// qDebug("AudioOutputDevice::readData: read %d samples vs %d requested", samples, framesPerBuffer);
|
||||
// }
|
||||
|
||||
for (unsigned int i = 0; i < samples; i++)
|
||||
@ -335,7 +335,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
|
||||
return samplesPerBuffer * 4;
|
||||
}
|
||||
|
||||
qint64 AudioOutput::writeData(const char* data, qint64 len)
|
||||
qint64 AudioOutputDevice::writeData(const char* data, qint64 len)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(len);
|
@ -16,8 +16,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_AUDIOOUTPUT_H
|
||||
#define INCLUDE_AUDIOOUTPUT_H
|
||||
#ifndef INCLUDE_AUDIOOUTPUTDEVICE_H
|
||||
#define INCLUDE_AUDIOOUTPUTDEVICE_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QIODevice>
|
||||
@ -32,7 +32,7 @@ class AudioFifo;
|
||||
class AudioOutputPipe;
|
||||
class AudioNetSink;
|
||||
|
||||
class SDRBASE_API AudioOutput : QIODevice {
|
||||
class SDRBASE_API AudioOutputDevice : QIODevice {
|
||||
public:
|
||||
enum UDPChannelMode
|
||||
{
|
||||
@ -52,8 +52,8 @@ public:
|
||||
UDPCodecOpus //!< Opus compression
|
||||
};
|
||||
|
||||
AudioOutput();
|
||||
virtual ~AudioOutput();
|
||||
AudioOutputDevice();
|
||||
virtual ~AudioOutputDevice();
|
||||
|
||||
bool start(int device, int rate);
|
||||
void stop();
|
||||
@ -94,4 +94,4 @@ private:
|
||||
friend class AudioOutputPipe;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_AUDIOOUTPUT_H
|
||||
#endif // INCLUDE_AUDIOOUTPUTDEVICE_H
|
@ -24,7 +24,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "audio/audiodevicemanager.h"
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audiooutputdevice.h"
|
||||
#include "export.h"
|
||||
#include "ambe/ambeengine.h"
|
||||
|
||||
|
@ -550,10 +550,10 @@ int WebAPIAdapter::instanceAudioOutputPatch(
|
||||
outputDeviceInfo.udpUseRTP = response.getUdpUsesRtp() == 0 ? 0 : 1;
|
||||
}
|
||||
if (audioOutputKeys.contains("udpChannelMode")) {
|
||||
outputDeviceInfo.udpChannelMode = static_cast<AudioOutput::UDPChannelMode>(response.getUdpChannelMode());
|
||||
outputDeviceInfo.udpChannelMode = static_cast<AudioOutputDevice::UDPChannelMode>(response.getUdpChannelMode());
|
||||
}
|
||||
if (audioOutputKeys.contains("udpChannelCodec")) {
|
||||
outputDeviceInfo.udpChannelCodec = static_cast<AudioOutput::UDPChannelCodec>(response.getUdpChannelCodec());
|
||||
outputDeviceInfo.udpChannelCodec = static_cast<AudioOutputDevice::UDPChannelCodec>(response.getUdpChannelCodec());
|
||||
}
|
||||
if (audioOutputKeys.contains("udpDecimationFactor")) {
|
||||
outputDeviceInfo.udpDecimationFactor = response.getUdpDecimationFactor();
|
||||
|
@ -247,14 +247,14 @@ void AudioDialogX::on_decimationFactor_currentIndexChanged(int index)
|
||||
|
||||
void AudioDialogX::on_outputUDPChannelCodec_currentIndexChanged(int index)
|
||||
{
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutput::UDPChannelCodec) index;
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutputDevice::UDPChannelCodec) index;
|
||||
updateOutputSDPString();
|
||||
check();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_outputUDPChannelMode_currentIndexChanged(int index)
|
||||
{
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutput::UDPChannelMode) index;
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutputDevice::UDPChannelMode) index;
|
||||
updateOutputSDPString();
|
||||
check();
|
||||
}
|
||||
@ -290,38 +290,38 @@ void AudioDialogX::updateOutputDeviceInfo()
|
||||
m_outputDeviceInfo.udpPort = m_outputUDPPort;
|
||||
m_outputDeviceInfo.copyToUDP = ui->outputUDPCopy->isChecked();
|
||||
m_outputDeviceInfo.udpUseRTP = ui->outputUDPUseRTP->isChecked();
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutput::UDPChannelMode) ui->outputUDPChannelMode->currentIndex();
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutput::UDPChannelCodec) ui->outputUDPChannelCodec->currentIndex();
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutputDevice::UDPChannelMode) ui->outputUDPChannelMode->currentIndex();
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutputDevice::UDPChannelCodec) ui->outputUDPChannelCodec->currentIndex();
|
||||
m_outputDeviceInfo.udpDecimationFactor = ui->decimationFactor->currentIndex() + 1;
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputSDPString()
|
||||
{
|
||||
QString format;
|
||||
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo ? 2 : 1;
|
||||
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutputDevice::UDPChannelStereo ? 2 : 1;
|
||||
uint32_t effectiveSampleRate = m_outputDeviceInfo.sampleRate / (m_outputDeviceInfo.udpDecimationFactor == 0 ? 1 : m_outputDeviceInfo.udpDecimationFactor);
|
||||
|
||||
switch (m_outputDeviceInfo.udpChannelCodec)
|
||||
{
|
||||
case AudioOutput::UDPCodecALaw:
|
||||
case AudioOutputDevice::UDPCodecALaw:
|
||||
format = "PCMA";
|
||||
break;
|
||||
case AudioOutput::UDPCodecULaw:
|
||||
case AudioOutputDevice::UDPCodecULaw:
|
||||
format = "PCMU";
|
||||
break;
|
||||
case AudioOutput::UDPCodecG722:
|
||||
case AudioOutputDevice::UDPCodecG722:
|
||||
format = "G722";
|
||||
effectiveSampleRate /= 2; // codec does a decimation by 2
|
||||
break;
|
||||
case AudioOutput::UDPCodecL8:
|
||||
case AudioOutputDevice::UDPCodecL8:
|
||||
format = "L8";
|
||||
break;
|
||||
case AudioOutput::UDPCodecOpus:
|
||||
case AudioOutputDevice::UDPCodecOpus:
|
||||
format = "opus";
|
||||
nChannels = 2; // always 2 even for mono
|
||||
effectiveSampleRate = 48000; // always 48000 regardless of input rate
|
||||
break;
|
||||
case AudioOutput::UDPCodecL16:
|
||||
case AudioOutputDevice::UDPCodecL16:
|
||||
default:
|
||||
format = "L16";
|
||||
break;
|
||||
@ -332,28 +332,28 @@ void AudioDialogX::updateOutputSDPString()
|
||||
|
||||
void AudioDialogX::check()
|
||||
{
|
||||
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo ? 2 : 1;
|
||||
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutputDevice::UDPChannelStereo ? 2 : 1;
|
||||
uint32_t decimationFactor = m_outputDeviceInfo.udpDecimationFactor == 0 ? 1 : m_outputDeviceInfo.udpDecimationFactor;
|
||||
|
||||
if (m_outputDeviceInfo.udpChannelCodec == AudioOutput::UDPCodecALaw)
|
||||
if (m_outputDeviceInfo.udpChannelCodec == AudioOutputDevice::UDPCodecALaw)
|
||||
{
|
||||
if ((nChannels != 1) || (m_outputDeviceInfo.sampleRate/decimationFactor != 8000)) {
|
||||
QMessageBox::information(this, tr("Message"), tr("PCMA must be 8000 Hz single channel"));
|
||||
}
|
||||
}
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutput::UDPCodecULaw)
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutputDevice::UDPCodecULaw)
|
||||
{
|
||||
if ((nChannels != 1) || (m_outputDeviceInfo.sampleRate/decimationFactor != 8000)) {
|
||||
QMessageBox::information(this, tr("Message"), tr("PCMU must be 8000 Hz single channel"));
|
||||
}
|
||||
}
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutput::UDPCodecG722)
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutputDevice::UDPCodecG722)
|
||||
{
|
||||
if ((nChannels != 1) || (m_outputDeviceInfo.sampleRate/decimationFactor != 16000)) {
|
||||
QMessageBox::information(this, tr("Message"), tr("G722 must be 16000 Hz single channel"));
|
||||
}
|
||||
}
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutput::UDPCodecOpus)
|
||||
else if (m_outputDeviceInfo.udpChannelCodec == AudioOutputDevice::UDPCodecOpus)
|
||||
{
|
||||
int effectiveSampleRate = m_outputDeviceInfo.sampleRate/decimationFactor;
|
||||
if ((effectiveSampleRate != 48000) && (effectiveSampleRate != 24000) && (effectiveSampleRate != 16000) && (effectiveSampleRate != 12000)) {
|
||||
|
Loading…
Reference in New Issue
Block a user