Fix Stereo channel swap with HDMI (#52)

There has been a swap of the Stereo channels with HDMI. With the new
option "ChannelsSwapped=0|1" in minidexed.ini one can swap the channels
again, in case it is needed.
pull/54/head
Rene Stange 3 years ago committed by GitHub
parent 9d81a69ea9
commit 7519da5e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/config.cpp
  2. 2
      src/config.h
  3. 17
      src/minidexed.cpp
  4. 1
      src/minidexed.h
  5. 1
      src/minidexed.ini

@ -44,6 +44,7 @@ void CConfig::Load (void)
m_nChunkSize = m_Properties.GetNumber ("ChunkSize", m_SoundDevice == "hdmi" ? 384*6 : 1024);
#endif
m_nDACI2CAddress = m_Properties.GetNumber ("DACI2CAddress", 0);
m_bChannelsSwapped = m_Properties.GetNumber ("ChannelsSwapped", 0) != 0;
m_nMIDIBaudRate = m_Properties.GetNumber ("MIDIBaudRate", 31250);
@ -85,6 +86,11 @@ unsigned CConfig::GetDACI2CAddress (void) const
return m_nDACI2CAddress;
}
bool CConfig::GetChannelsSwapped (void) const
{
return m_bChannelsSwapped;
}
unsigned CConfig::GetMIDIBaudRate (void) const
{
return m_nMIDIBaudRate;

@ -67,6 +67,7 @@ public:
unsigned GetSampleRate (void) const;
unsigned GetChunkSize (void) const;
unsigned GetDACI2CAddress (void) const; // 0 for auto probing
bool GetChannelsSwapped (void) const;
// MIDI
unsigned GetMIDIBaudRate (void) const;
@ -100,6 +101,7 @@ private:
unsigned m_nSampleRate;
unsigned m_nChunkSize;
unsigned m_nDACI2CAddress;
bool m_bChannelsSwapped;
unsigned m_nMIDIBaudRate;

@ -41,6 +41,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_SerialMIDI (this, pInterrupt, pConfig),
m_bUseSerial (false),
m_pSoundDevice (0),
m_bChannelsSwapped (pConfig->GetChannelsSwapped ()),
#ifdef ARM_ALLOW_MULTI_CORE
m_nActiveTGsLog2 (0),
#endif
@ -83,6 +84,10 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_pSoundDevice = new CHDMISoundBaseDevice (pInterrupt, pConfig->GetSampleRate (),
pConfig->GetChunkSize ());
// The channels are swapped by default in the HDMI sound driver.
// TODO: Remove this line, when this has been fixed in the driver.
m_bChannelsSwapped = !m_bChannelsSwapped;
}
else
{
@ -512,8 +517,16 @@ void CMiniDexed::ProcessSound (void)
+ m_OutputLevel[7][i] * m_nPan[7];
nRight >>= m_nActiveTGsLog2 + 7;
SampleBuffer[i][0] = (int16_t) nLeft;
SampleBuffer[i][1] = (int16_t) nRight;
if (!m_bChannelsSwapped)
{
SampleBuffer[i][0] = (int16_t) nLeft;
SampleBuffer[i][1] = (int16_t) nRight;
}
else
{
SampleBuffer[i][0] = (int16_t) nRight;
SampleBuffer[i][1] = (int16_t) nLeft;
}
}
if ( m_pSoundDevice->Write (SampleBuffer, sizeof SampleBuffer)

@ -103,6 +103,7 @@ private:
bool m_bUseSerial;
CSoundBaseDevice *m_pSoundDevice;
bool m_bChannelsSwapped;
unsigned m_nQueueSizeFrames;
#ifdef ARM_ALLOW_MULTI_CORE

@ -7,6 +7,7 @@ SoundDevice=pwm
SampleRate=48000
#ChunkSize=256
DACI2CAddress=0
ChannelsSwapped=0
# MIDI
MIDIBaudRate=31250

Loading…
Cancel
Save