mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Audio UDP/RTP: implemented decimation GUI
This commit is contained in:
parent
ef564cdb4f
commit
c0a86b3077
@ -107,8 +107,7 @@ int16_t AudioCompressor::compress(int16_t sample)
|
||||
|
||||
int8_t AudioCompressor::compress8(int16_t sample)
|
||||
{
|
||||
return ALaw_Encode(sample);
|
||||
//return m_lut[sample/2 + 16384];
|
||||
return m_lut[sample/2 + 16384];
|
||||
}
|
||||
|
||||
/* http://dystopiancode.blogspot.com/2012/02/pcm-law-and-u-law-companding-algorithms.html
|
||||
|
@ -48,7 +48,8 @@ QDataStream& operator<<(QDataStream& ds, const AudioDeviceManager::OutputDeviceI
|
||||
<< info.copyToUDP
|
||||
<< info.udpUseRTP
|
||||
<< (int) info.udpChannelMode
|
||||
<< (int) info.udpChannelCodec;
|
||||
<< (int) info.udpChannelCodec
|
||||
<< info.decimationFactor;
|
||||
return ds;
|
||||
}
|
||||
|
||||
@ -63,7 +64,8 @@ QDataStream& operator>>(QDataStream& ds, AudioDeviceManager::OutputDeviceInfo& i
|
||||
>> info.copyToUDP
|
||||
>> info.udpUseRTP
|
||||
>> intChannelMode
|
||||
>> intChannelCodec;
|
||||
>> intChannelCodec
|
||||
>> info.decimationFactor;
|
||||
info.udpChannelMode = (AudioOutput::UDPChannelMode) intChannelMode;
|
||||
info.udpChannelCodec = (AudioOutput::UDPChannelCodec) intChannelCodec;
|
||||
return ds;
|
||||
@ -362,6 +364,7 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
bool udpUseRTP;
|
||||
AudioOutput::UDPChannelMode udpChannelMode;
|
||||
AudioOutput::UDPChannelCodec udpChannelCodec;
|
||||
uint32_t decimationFactor;
|
||||
QString deviceName;
|
||||
|
||||
if (getOutputDeviceName(outputDeviceIndex, deviceName))
|
||||
@ -375,6 +378,7 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
udpUseRTP = false;
|
||||
udpChannelMode = AudioOutput::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutput::UDPCodecL16;
|
||||
decimationFactor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -385,6 +389,7 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
udpUseRTP = m_audioOutputInfos[deviceName].udpUseRTP;
|
||||
udpChannelMode = m_audioOutputInfos[deviceName].udpChannelMode;
|
||||
udpChannelCodec = m_audioOutputInfos[deviceName].udpChannelCodec;
|
||||
decimationFactor = m_audioOutputInfos[deviceName].decimationFactor;
|
||||
}
|
||||
|
||||
m_audioOutputs[outputDeviceIndex]->start(outputDeviceIndex, sampleRate);
|
||||
@ -395,6 +400,7 @@ void AudioDeviceManager::startAudioOutput(int outputDeviceIndex)
|
||||
m_audioOutputInfos[deviceName].udpUseRTP = udpUseRTP;
|
||||
m_audioOutputInfos[deviceName].udpChannelMode = udpChannelMode;
|
||||
m_audioOutputInfos[deviceName].udpChannelCodec = udpChannelCodec;
|
||||
m_audioOutputInfos[deviceName].decimationFactor = decimationFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -776,6 +782,7 @@ void AudioDeviceManager::debugAudioOutputInfos() const
|
||||
<< " copyToUDP: " << it.value().copyToUDP
|
||||
<< " udpUseRTP: " << it.value().udpUseRTP
|
||||
<< " udpChannelMode: " << (int) it.value().udpChannelMode
|
||||
<< " udpChannelCodec: " << (int) it.value().udpChannelCodec;
|
||||
<< " udpChannelCodec: " << (int) it.value().udpChannelCodec
|
||||
<< " decimationFactor: " << it.value().decimationFactor;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,9 @@ public:
|
||||
udpPort(m_defaultUDPPort),
|
||||
copyToUDP(false),
|
||||
udpUseRTP(false),
|
||||
udpChannelMode(AudioOutput::UDPChannelLeft)
|
||||
udpChannelMode(AudioOutput::UDPChannelLeft),
|
||||
udpChannelCodec(AudioOutput::UDPCodecL16),
|
||||
decimationFactor(1)
|
||||
{}
|
||||
void resetToDefaults() {
|
||||
sampleRate = m_defaultAudioSampleRate;
|
||||
@ -68,6 +70,8 @@ public:
|
||||
copyToUDP = false;
|
||||
udpUseRTP = false;
|
||||
udpChannelMode = AudioOutput::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutput::UDPCodecL16;
|
||||
decimationFactor = 1;
|
||||
}
|
||||
unsigned int sampleRate;
|
||||
QString udpAddress;
|
||||
@ -76,6 +80,7 @@ public:
|
||||
bool udpUseRTP;
|
||||
AudioOutput::UDPChannelMode udpChannelMode;
|
||||
AudioOutput::UDPChannelCodec udpChannelCodec;
|
||||
uint32_t decimationFactor;
|
||||
friend QDataStream& operator<<(QDataStream& ds, const OutputDeviceInfo& info);
|
||||
friend QDataStream& operator>>(QDataStream& ds, OutputDeviceInfo& info);
|
||||
};
|
||||
|
@ -211,6 +211,30 @@ void AudioDialogX::on_outputCleanup_clicked(bool checked)
|
||||
m_audioDeviceManager->outputInfosCleanup();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_outputSampleRate_valueChanged(int value)
|
||||
{
|
||||
m_outputDeviceInfo.sampleRate = value;
|
||||
updateOutputSDPString();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_decimationFactor_currentIndexChanged(int index)
|
||||
{
|
||||
m_outputDeviceInfo.decimationFactor = index + 1;
|
||||
updateOutputSDPString();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_outputUDPChannelCodec_currentIndexChanged(int index)
|
||||
{
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutput::UDPChannelCodec) index;
|
||||
updateOutputSDPString();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_outputUDPChannelMode_currentIndexChanged(int index)
|
||||
{
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutput::UDPChannelMode) index;
|
||||
updateOutputSDPString();
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputDisplay()
|
||||
{
|
||||
ui->outputSampleRate->setValue(m_outputDeviceInfo.sampleRate);
|
||||
@ -220,6 +244,8 @@ void AudioDialogX::updateOutputDisplay()
|
||||
ui->outputUDPUseRTP->setChecked(m_outputDeviceInfo.udpUseRTP);
|
||||
ui->outputUDPChannelMode->setCurrentIndex((int) m_outputDeviceInfo.udpChannelMode);
|
||||
ui->outputUDPChannelCodec->setCurrentIndex((int) m_outputDeviceInfo.udpChannelCodec);
|
||||
ui->decimationFactor->setCurrentIndex(m_outputDeviceInfo.decimationFactor - 1);
|
||||
updateOutputSDPString();
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputDeviceInfo()
|
||||
@ -231,5 +257,31 @@ void AudioDialogX::updateOutputDeviceInfo()
|
||||
m_outputDeviceInfo.udpUseRTP = ui->outputUDPUseRTP->isChecked();
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutput::UDPChannelMode) ui->outputUDPChannelMode->currentIndex();
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutput::UDPChannelCodec) ui->outputUDPChannelCodec->currentIndex();
|
||||
m_outputDeviceInfo.decimationFactor = ui->decimationFactor->currentIndex() + 1;
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputSDPString()
|
||||
{
|
||||
QString format;
|
||||
|
||||
switch(m_outputDeviceInfo.udpChannelCodec)
|
||||
{
|
||||
case AudioOutput::UDPCodecALaw:
|
||||
format = "PCMA";
|
||||
break;
|
||||
case AudioOutput::UDPCodecULaw:
|
||||
format = "PCMU";
|
||||
break;
|
||||
case AudioOutput::UDPCodecL8:
|
||||
format = "L8";
|
||||
break;
|
||||
case AudioOutput::UDPCodecL16:
|
||||
default:
|
||||
format = "L16";
|
||||
break;
|
||||
}
|
||||
|
||||
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo ? 2 : 1;
|
||||
|
||||
ui->outputSDPText->setText(tr("%1/%2/%3").arg(format).arg(m_outputDeviceInfo.sampleRate/m_outputDeviceInfo.decimationFactor).arg(nChannels));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ private:
|
||||
void updateOutputDisplay();
|
||||
void updateInputDeviceInfo();
|
||||
void updateOutputDeviceInfo();
|
||||
void updateOutputSDPString();
|
||||
|
||||
Ui::AudioDialog* ui;
|
||||
|
||||
@ -46,6 +47,10 @@ private slots:
|
||||
void on_outputUDPPort_editingFinished();
|
||||
void on_outputReset_clicked(bool checked);
|
||||
void on_outputCleanup_clicked(bool checked);
|
||||
void on_outputSampleRate_valueChanged(int value);
|
||||
void on_decimationFactor_currentIndexChanged(int index);
|
||||
void on_outputUDPChannelCodec_currentIndexChanged(int index);
|
||||
void on_outputUDPChannelMode_currentIndexChanged(int index);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_AUDIODIALOG_H
|
||||
|
@ -6,14 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>400</height>
|
||||
<width>460</width>
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>560</width>
|
||||
<height>400</height>
|
||||
<width>460</width>
|
||||
<height>460</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -124,6 +124,170 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="outputFormatLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="outputUDPChannelMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel copy mode</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mixed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stereo</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="decimationLabel">
|
||||
<property name="text">
|
||||
<string>/</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="decimationFactor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Decimation</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="outputUDPChannelCodec">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Encoding</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>L16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>L8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PCMA</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PCMU</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="outputSDPText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Encoding string in SDP format</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PCMA/48000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="outputUDPLayout">
|
||||
<item>
|
||||
@ -204,72 +368,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="outputUDPChannelMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Channel copy mode</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mixed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stereo</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="outputUDPChannelCodec">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>85</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Encoding</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>L16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>L8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PCMA/8k</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PCMU/8k</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="outputUDPUseRTP">
|
||||
<property name="toolTip">
|
||||
|
Loading…
Reference in New Issue
Block a user