diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | dxr3device.c | 11 | ||||
-rw-r--r-- | dxr3device.h | 2 | ||||
-rw-r--r-- | dxr3interface.c | 17 | ||||
-rw-r--r-- | dxr3interface.h | 9 |
6 files changed, 39 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 33c8ce1..0da75f0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,6 +3,7 @@ one way or the another. Without their help, the plugin would not be as good as it is now. Jon Burgess +Malcolm Caldwell Martin Cap Stuart Daines Martin Dauskardt @@ -287,3 +287,4 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - use VDR's facilities for logging (no more dxr3plugin.log), make it less noisy (Ville Skyttä, Christian Gmeiner) - add setup option for hiding the main menu entry (Ville Skyttä) +- implement stereo/left/right audio channel switching (Malcolm Caldwell) diff --git a/dxr3device.c b/dxr3device.c index 939fe57..6f32923 100644 --- a/dxr3device.c +++ b/dxr3device.c @@ -438,6 +438,17 @@ void cDxr3Device::SetVolumeDevice(int Volume) } // ================================== +//! sets audio channel for audio output (stero, mono left, mono right) +void cDxr3Device::SetAudioChannelDevice(int AudioChannel) +{ + cDxr3Interface::Instance().SetAudioChannel(AudioChannel); +} +int cDxr3Device::GetAudioChannelDevice(void) +{ + return cDxr3Interface::Instance().GetAudioChannel(); +} + +// ================================== // get spudecoder cSpuDecoder *cDxr3Device::GetSpuDecoder(void) { diff --git a/dxr3device.h b/dxr3device.h index 7c3f742..39b7d4d 100644 --- a/dxr3device.h +++ b/dxr3device.h @@ -67,6 +67,8 @@ public: int Quality = -1, int SizeX = -1, int SizeY = -1); virtual void SetVideoFormat(bool VideoFormat16_9); virtual void SetVolumeDevice(int Volume); + virtual void SetAudioChannelDevice(int AudioChannel); + virtual int GetAudioChannelDevice(void); // osd virtual cSpuDecoder *GetSpuDecoder(); diff --git a/dxr3interface.c b/dxr3interface.c index 39faadd..a5a3274 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -23,6 +23,7 @@ #include <assert.h> #include <math.h> #include <sys/soundcard.h> +#include <linux/dvb/audio.h> #include "dxr3interface.h" #include "dxr3syncbuffer.h" @@ -106,6 +107,7 @@ cDxr3Interface::cDxr3Interface() : m_OverlayActive = false; m_ExternalReleased = false; m_volume = 255; + m_audioChannel = AUDIO_STEREO; m_horizontal = 720; m_vertical = 576; m_audioChannelCount = UNKNOWN_CHANNEL_COUNT; @@ -1028,13 +1030,24 @@ void cDxr3Interface::ResampleVolume(short* pcmbuf, int size) { memset(pcmbuf, 0, size); } - else if (m_volume != 255) + if (m_volume < 255 || m_audioChannel != AUDIO_STEREO) { int factor = (int)pow (2.0, (double)m_volume/32 + 8.0) - 1; //int factor = (int)pow (2.0, (double)m_volume/16) - 1; for (int i = 0; i < size / (int)sizeof(short); i++) { - pcmbuf[i] = (((int)pcmbuf[i]) * factor) / 65536; + if (m_audioChannel == AUDIO_MONO_RIGHT && !(i & 0x1)) + { + pcmbuf[i] = pcmbuf[i+1]; + } + if (m_audioChannel == AUDIO_MONO_LEFT && (i & 0x1)) + { + pcmbuf[i] = pcmbuf[i-1]; + } + else if (m_volume < 255) + { + pcmbuf[i] = (((int)pcmbuf[i]) * factor) / 65536; + } } } } diff --git a/dxr3interface.h b/dxr3interface.h index 3ac942d..7f429d6 100644 --- a/dxr3interface.h +++ b/dxr3interface.h @@ -61,6 +61,14 @@ public: { m_volume = volume; } + void SetAudioChannel(int audiochannel) + { + m_audioChannel = audiochannel; + } + int GetAudioChannel(void) + { + return m_audioChannel; + } void SetAudioSpeed(uint32_t speed); void SetChannelCount(uint32_t count); void SetAudioSampleSize(uint32_t sampleSize); @@ -174,6 +182,7 @@ private: uint32_t m_spuMode; bool m_ExternalReleased; ///< is dxr3 used by e.g. mplayer? int m_volume; ///< volumevalue (0...255) + int m_audioChannel; ///> 0=stereo, 1=left, 2=right audio channel bool m_AudioActive; ///< is audio active? bool m_VideoActive; ///< is video active? bool m_OverlayActive; ///< is overlay active? |