[AFV] Ref T730, renamed to COutput

This commit is contained in:
Klaus Basan
2019-10-13 02:53:00 +02:00
parent 745eb01000
commit 73f191619a
4 changed files with 15 additions and 15 deletions

View File

@@ -36,9 +36,9 @@ namespace BlackCore
qint64 CAudioOutputBuffer::readData(char *data, qint64 maxlen)
{
int sampleBytes = m_outputFormat.sampleSize() / 8;
int channelCount = m_outputFormat.channelCount();
qint64 count = maxlen / (sampleBytes * channelCount);
const int sampleBytes = m_outputFormat.sampleSize() / 8;
const int channelCount = m_outputFormat.channelCount();
const qint64 count = maxlen / (sampleBytes * channelCount);
QVector<float> buffer;
m_sampleProvider->readSamples(buffer, count);
@@ -81,17 +81,17 @@ namespace BlackCore
return -1;
}
Output::Output(QObject *parent) : QObject(parent)
COutput::COutput(QObject *parent) : QObject(parent)
{
this->setObjectName("COutput");
}
void Output::start(const CAudioDeviceInfo &outputDevice, ISampleProvider *sampleProvider)
void COutput::start(const CAudioDeviceInfo &outputDevice, ISampleProvider *sampleProvider)
{
if (m_started) { return; }
m_audioOutputBuffer = new CAudioOutputBuffer(sampleProvider, this);
connect(m_audioOutputBuffer, &CAudioOutputBuffer::outputVolumeStream, this, &Output::outputVolumeStream);
connect(m_audioOutputBuffer, &CAudioOutputBuffer::outputVolumeStream, this, &COutput::outputVolumeStream);
m_device = outputDevice;
@@ -103,7 +103,7 @@ namespace BlackCore
outputFormat.setByteOrder(QAudioFormat::LittleEndian);
outputFormat.setCodec("audio/pcm");
QAudioDeviceInfo selectedDevice = getLowestLatencyDevice(outputDevice, outputFormat);
const QAudioDeviceInfo selectedDevice = getLowestLatencyDevice(outputDevice, outputFormat);
m_audioOutputCom.reset(new QAudioOutput(selectedDevice, outputFormat));
m_audioOutputBuffer->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
m_audioOutputBuffer->setAudioFormat(outputFormat);
@@ -112,7 +112,7 @@ namespace BlackCore
m_started = true;
}
void Output::stop()
void COutput::stop()
{
if (!m_started) { return; }
m_started = false;

View File

@@ -66,16 +66,16 @@ namespace BlackCore
};
//! Output
class Output : public QObject
class COutput : public QObject
{
Q_OBJECT
public:
//! Ctor
Output(QObject *parent = nullptr);
COutput(QObject *parent = nullptr);
//! Dtor
virtual ~Output() override
virtual ~COutput() override
{
this->stop();
}

View File

@@ -46,7 +46,7 @@ namespace BlackCore
CContinuousWorker(owner, "CAfvClient"),
m_connection(new CClientConnection(apiServer, this)),
m_input(new CInput(SampleRate, this)),
m_output(new Output(this)),
m_output(new COutput(this)),
m_voiceServerPositionTimer(new QTimer(this))
{
this->setObjectName("AFV client");
@@ -55,7 +55,7 @@ namespace BlackCore
connect(m_input, &CInput::opusDataAvailable, this, &CAfvClient::opusDataAvailable);
connect(m_input, &CInput::inputVolumeStream, this, &CAfvClient::inputVolumeStream);
connect(m_output, &Output::outputVolumeStream, this, &CAfvClient::outputVolumeStream);
connect(m_output, &COutput::outputVolumeStream, this, &CAfvClient::outputVolumeStream);
connect(m_connection, &CClientConnection::audioReceived, this, &CAfvClient::audioOutDataAvailable);
connect(m_voiceServerPositionTimer, &QTimer::timeout, this, &CAfvClient::onPositionUpdateTimer);
@@ -219,8 +219,8 @@ namespace BlackCore
if (m_outputSampleProvider) { m_outputSampleProvider->deleteLater(); }
m_outputSampleProvider = new CVolumeSampleProvider(m_soundcardSampleProvider, this);
m_outputSampleProvider->setVolume(m_outputVolume);
m_output->start(outputDevice, m_outputSampleProvider);
m_input->start(inputDevice);
m_startDateTimeUtc = QDateTime::currentDateTimeUtc();

View File

@@ -287,7 +287,7 @@ namespace BlackCore
QString m_callsign;
Audio::CInput *m_input = nullptr;
Audio::Output *m_output = nullptr;
Audio::COutput *m_output = nullptr;
Audio::CSoundcardSampleProvider *m_soundcardSampleProvider = nullptr;
BlackSound::SampleProvider::CVolumeSampleProvider *m_outputSampleProvider = nullptr;