From d8e3c187e29eedf49426b4a35e3338a7a9076632 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 7 Mar 2012 20:06:25 +0100 Subject: [PATCH] spark: compensate for differing AC3/MPEG volume Maybe the 30/53 formula neeeds some tuning, we'll find out... Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/3d9b659f175e857e65d32b0a6959e2e3f5800f4e Author: Stefan Seyfried Date: 2012-03-07 (Wed, 07 Mar 2012) ------------------ This commit was generated by Migit --- libspark/audio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libspark/audio.cpp b/libspark/audio.cpp index e7a5930..5256c38 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -111,6 +111,12 @@ int cAudio::setVolume(unsigned int left, unsigned int right) lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); return ret; } + /* compensate for different decoding volume of mpeg and ac3 streams + * TODO: check if this is correct for all channels + * and if we need to do something with DTS? */ + if (StreamType == AUDIO_FMT_MPEG) + v = map_volume(volume * 30 / 53); + char str[4]; sprintf(str, "%d", v); @@ -155,6 +161,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) void cAudio::SetStreamType(AUDIO_FORMAT type) { int bypass = AUDIO_STREAMTYPE_MPEG; + bool update_volume = (StreamType != type); lt_debug("%s %d\n", __FUNCTION__, type); StreamType = type; @@ -175,6 +182,8 @@ void cAudio::SetStreamType(AUDIO_FORMAT type) // But as we implemented the behavior to bypass (cause of e2) this is correct here if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__); + if (update_volume) + setVolume(volume, volume); }; int cAudio::setChannel(int channel)