mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
spark: compensate for differing AC3/MPEG volume
Maybe the 30/53 formula neeeds some tuning, we'll find out...
This commit is contained in:
@@ -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);
|
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp);
|
||||||
return ret;
|
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];
|
char str[4];
|
||||||
sprintf(str, "%d", v);
|
sprintf(str, "%d", v);
|
||||||
|
|
||||||
@@ -155,6 +161,7 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
|
|||||||
void cAudio::SetStreamType(AUDIO_FORMAT type)
|
void cAudio::SetStreamType(AUDIO_FORMAT type)
|
||||||
{
|
{
|
||||||
int bypass = AUDIO_STREAMTYPE_MPEG;
|
int bypass = AUDIO_STREAMTYPE_MPEG;
|
||||||
|
bool update_volume = (StreamType != type);
|
||||||
lt_debug("%s %d\n", __FUNCTION__, type);
|
lt_debug("%s %d\n", __FUNCTION__, type);
|
||||||
StreamType = 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
|
// But as we implemented the behavior to bypass (cause of e2) this is correct here
|
||||||
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
|
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0)
|
||||||
lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
|
||||||
|
if (update_volume)
|
||||||
|
setVolume(volume, volume);
|
||||||
};
|
};
|
||||||
|
|
||||||
int cAudio::setChannel(int channel)
|
int cAudio::setChannel(int channel)
|
||||||
|
Reference in New Issue
Block a user