mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 13:21:50 -05:00
UDP source: new icons. Implemented audio on/off button with icon
This commit is contained in:
parent
74f1f4e675
commit
08a3bc9097
@ -31,6 +31,7 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
||||
m_settingsMutex(QMutex::Recursive),
|
||||
m_audioFifo(4, 24000),
|
||||
m_audioActive(false),
|
||||
m_audioStereo(false),
|
||||
m_volume(20)
|
||||
{
|
||||
setObjectName("UDPSrc");
|
||||
@ -381,6 +382,8 @@ void UDPSrc::audioReadyRead()
|
||||
//qDebug("UDPSrc::audioReadyRead: %d", buffer.size());
|
||||
|
||||
if (m_audioActive)
|
||||
{
|
||||
if (m_audioStereo)
|
||||
{
|
||||
for (int i = 0; i < buffer.size() - 3; i += 4)
|
||||
{
|
||||
@ -396,12 +399,35 @@ void UDPSrc::audioReadyRead()
|
||||
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("UDPSrc::audioReadyRead: lost %u samples", m_audioBufferFill - res);
|
||||
qDebug("UDPSrc::audioReadyRead: (stereo) lost %u samples", m_audioBufferFill - res);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < buffer.size() - 1; i += 2)
|
||||
{
|
||||
qint16 sample = (qint16) *(&buffer.data()[i]);
|
||||
m_audioBuffer[m_audioBufferFill].l = sample * 10 * m_volume;
|
||||
m_audioBuffer[m_audioBufferFill].r = sample * 10 * m_volume;
|
||||
++m_audioBufferFill;
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1);
|
||||
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("UDPSrc::audioReadyRead: (mono) lost %u samples", m_audioBufferFill - res);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 0) != m_audioBufferFill)
|
||||
{
|
||||
|
@ -181,6 +181,7 @@ protected:
|
||||
quint16 m_audioPort;
|
||||
int m_boost;
|
||||
bool m_audioActive;
|
||||
bool m_audioStereo;
|
||||
int m_volume;
|
||||
Real m_magsq;
|
||||
|
||||
|
@ -402,7 +402,7 @@ void UDPSrcGUI::on_applyBtn_clicked()
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_audioActive_toggled(bool checked)
|
||||
void UDPSrcGUI::on_audioActive_toggled(bool active)
|
||||
{
|
||||
ui->applyBtn->setEnabled(true);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ private slots:
|
||||
void on_udpAddress_textEdited(const QString& arg1);
|
||||
void on_udpPort_textEdited(const QString& arg1);
|
||||
void on_audioPort_textEdited(const QString& arg1);
|
||||
void on_audioActive_toggled(bool checked);
|
||||
void on_audioActive_toggled(bool active);
|
||||
void on_applyBtn_clicked();
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDoubleClicked();
|
||||
|
@ -167,6 +167,9 @@
|
||||
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="deltaMinus">
|
||||
<property name="toolTip">
|
||||
<string>Frequency shift direction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -323,16 +326,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="audioActive">
|
||||
<property name="toolTip">
|
||||
<string>Activate audio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="audioPort">
|
||||
<property name="toolTip">
|
||||
@ -343,6 +336,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="audioActive">
|
||||
<property name="toolTip">
|
||||
<string>Toggle audio input</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/sound_off.png</normaloff>
|
||||
<normalon>:/sound_on.png</normalon>:/sound_off.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
|
BIN
sdrbase/resources/mono.png
Normal file
BIN
sdrbase/resources/mono.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 523 B |
@ -37,5 +37,9 @@
|
||||
<file>mem.png</file>
|
||||
<file>minusw.png</file>
|
||||
<file>plusw.png</file>
|
||||
<file>mono.png</file>
|
||||
<file>stereo.png</file>
|
||||
<file>sound_off.png</file>
|
||||
<file>sound_on.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
sdrbase/resources/sound_off.png
Normal file
BIN
sdrbase/resources/sound_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 528 B |
BIN
sdrbase/resources/sound_on.png
Normal file
BIN
sdrbase/resources/sound_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 890 B |
BIN
sdrbase/resources/stereo.png
Normal file
BIN
sdrbase/resources/stereo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 804 B |
Loading…
Reference in New Issue
Block a user