kopia lustrzana https://github.com/f4exb/sdrangel
UDP source: new icons. Implemented audio on/off button with icon
rodzic
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");
|
||||
|
@ -382,24 +383,49 @@ void UDPSrc::audioReadyRead()
|
|||
|
||||
if (m_audioActive)
|
||||
{
|
||||
for (int i = 0; i < buffer.size() - 3; i += 4)
|
||||
if (m_audioStereo)
|
||||
{
|
||||
qint16 l_sample = (qint16) *(&buffer.data()[i]);
|
||||
qint16 r_sample = (qint16) *(&buffer.data()[i+2]);
|
||||
m_audioBuffer[m_audioBufferFill].l = l_sample * 10 * m_volume;
|
||||
m_audioBuffer[m_audioBufferFill].r = r_sample * 10 * m_volume;
|
||||
++m_audioBufferFill;
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
for (int i = 0; i < buffer.size() - 3; i += 4)
|
||||
{
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1);
|
||||
qint16 l_sample = (qint16) *(&buffer.data()[i]);
|
||||
qint16 r_sample = (qint16) *(&buffer.data()[i+2]);
|
||||
m_audioBuffer[m_audioBufferFill].l = l_sample * 10 * m_volume;
|
||||
m_audioBuffer[m_audioBufferFill].r = r_sample * 10 * m_volume;
|
||||
++m_audioBufferFill;
|
||||
|
||||
if (res != m_audioBufferFill)
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
qDebug("UDPSrc::audioReadyRead: lost %u samples", m_audioBufferFill - res);
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1);
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 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>
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 528 B |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 890 B |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 804 B |
Ładowanie…
Reference in New Issue