1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Fixed AudioNetSink stereo handling

This commit is contained in:
f4exb 2023-12-09 12:52:56 +01:00
parent 609fff1bd6
commit d97f92dcc3
2 changed files with 11 additions and 7 deletions

View File

@ -194,16 +194,19 @@ void AudioNetSink::setDecimationFilters()
{ {
case CodecPCMA: case CodecPCMA:
case CodecPCMU: case CodecPCMU:
m_audioFilter.setDecimFilters(m_sampleRate, decimatedSampleRate, 3300.0, 300.0); m_audioFilterR.setDecimFilters(m_sampleRate, decimatedSampleRate, 3300.0, 300.0);
m_audioFilterL.setDecimFilters(m_sampleRate, decimatedSampleRate, 3300.0, 300.0);
break; break;
case CodecG722: case CodecG722:
m_audioFilter.setDecimFilters(m_sampleRate, decimatedSampleRate, 7000.0, 50.0); m_audioFilterR.setDecimFilters(m_sampleRate, decimatedSampleRate, 7000.0, 50.0);
m_audioFilterL.setDecimFilters(m_sampleRate, decimatedSampleRate, 7000.0, 50.0);
break; break;
case CodecOpus: case CodecOpus:
case CodecL8: case CodecL8:
case CodecL16: case CodecL16:
default: default:
m_audioFilter.setDecimFilters(m_sampleRate, decimatedSampleRate, 0.45*decimatedSampleRate, 50.0); m_audioFilterR.setDecimFilters(m_sampleRate, decimatedSampleRate, 0.45*decimatedSampleRate, 50.0);
m_audioFilterL.setDecimFilters(m_sampleRate, decimatedSampleRate, 0.45*decimatedSampleRate, 50.0);
break; break;
} }
} }
@ -214,7 +217,7 @@ void AudioNetSink::write(qint16 isample)
if (m_decimation > 1) if (m_decimation > 1)
{ {
float lpSample = m_audioFilter.run(sample / 32768.0f); float lpSample = m_audioFilterR.run(sample / 32768.0f);
if (m_decimationCount >= m_decimation - 1) if (m_decimationCount >= m_decimation - 1)
{ {
@ -367,8 +370,8 @@ void AudioNetSink::write(qint16 ilSample, qint16 irSample)
if (m_decimation > 1) if (m_decimation > 1)
{ {
float lpLSample = m_audioFilter.runLP(lSample / 32768.0f); float lpLSample = m_audioFilterL.runLP(lSample / 32768.0f);
float lpRSample = m_audioFilter.runLP(rSample / 32768.0f); float lpRSample = m_audioFilterR.runLP(rSample / 32768.0f);
if (m_decimationCount >= m_decimation - 1) if (m_decimationCount >= m_decimation - 1)
{ {

View File

@ -88,7 +88,8 @@ protected:
AudioCompressor m_audioCompressor; AudioCompressor m_audioCompressor;
AudioG722 m_g722; AudioG722 m_g722;
AudioOpus m_opus; AudioOpus m_opus;
AudioFilter m_audioFilter; AudioFilter m_audioFilterR;
AudioFilter m_audioFilterL;
int m_sampleRate; int m_sampleRate;
bool m_stereo; bool m_stereo;
uint32_t m_decimation; uint32_t m_decimation;