diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/hosted/maemo/pcm-gstreamer.c | 6 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/pcm-sdl.c | 4 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/codec-jz4740.c | 6 |
3 files changed, 9 insertions, 7 deletions
diff --git a/firmware/target/hosted/maemo/pcm-gstreamer.c b/firmware/target/hosted/maemo/pcm-gstreamer.c index 10a9d77880..5bca6f2d92 100644 --- a/firmware/target/hosted/maemo/pcm-gstreamer.c +++ b/firmware/target/hosted/maemo/pcm-gstreamer.c | |||
@@ -427,9 +427,9 @@ void pcm_play_dma_postinit(void) | |||
427 | 427 | ||
428 | void pcm_set_mixer_volume(int volume) | 428 | void pcm_set_mixer_volume(int volume) |
429 | { | 429 | { |
430 | /* gstreamer volume range is from 0.00 to 1.00 */ | 430 | /* gstreamer volume range is from 0.00 to 1.00 |
431 | gdouble gst_vol = (gdouble)(volume - VOLUME_MIN) / (gdouble)VOLUME_RANGE; | 431 | * input is -990..0 */ |
432 | 432 | gdouble gst_vol = 1.0f - (gdouble)volume / -990.0f; | |
433 | g_object_set (G_OBJECT(gst_volume), "volume", gst_vol, NULL); | 433 | g_object_set (G_OBJECT(gst_volume), "volume", gst_vol, NULL); |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/firmware/target/hosted/sdl/pcm-sdl.c b/firmware/target/hosted/sdl/pcm-sdl.c index 812211288e..beefc7818c 100644 --- a/firmware/target/hosted/sdl/pcm-sdl.c +++ b/firmware/target/hosted/sdl/pcm-sdl.c | |||
@@ -421,7 +421,9 @@ void pcm_play_dma_postinit(void) | |||
421 | #ifndef HAVE_SW_VOLUME_CONTROL | 421 | #ifndef HAVE_SW_VOLUME_CONTROL |
422 | void pcm_set_mixer_volume(int volume) | 422 | void pcm_set_mixer_volume(int volume) |
423 | { | 423 | { |
424 | sim_volume = volume; | 424 | int minvol = sound_min(SOUND_VOLUME); |
425 | int volrange = sound_max(SOUND_VOLUME) - minvol; | ||
426 | sim_volume = SDL_MIX_MAXVOLUME * (volume / 10 - minvol) / volrange; | ||
425 | } | 427 | } |
426 | #endif /* HAVE_SW_VOLUME_CONTROL */ | 428 | #endif /* HAVE_SW_VOLUME_CONTROL */ |
427 | 429 | ||
diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c index ee15b27fae..702f3bb50e 100644 --- a/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4740.c | |||
@@ -273,9 +273,9 @@ void audiohw_init(void) | |||
273 | void audiohw_set_volume(int vol_l, int vol_r) | 273 | void audiohw_set_volume(int vol_l, int vol_r) |
274 | { | 274 | { |
275 | #ifdef HAVE_SW_VOLUME_CONTROL | 275 | #ifdef HAVE_SW_VOLUME_CONTROL |
276 | /* SW volume for <= 1.0 gain, HW at unity, < VOLUME_MIN == MUTE */ | 276 | /* SW volume for <= 1.0 gain, HW at unity, < -740 == MUTE */ |
277 | int sw_volume_l = vol_l < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_l, 0); | 277 | int sw_volume_l = vol_l <= -740 ? PCM_MUTE_LEVEL : MIN(vol_l, 0); |
278 | int sw_volume_r = vol_r < VOLUME_MIN ? PCM_MUTE_LEVEL : MIN(vol_r, 0); | 278 | int sw_volume_r = vol_r <= -740 ? PCM_MUTE_LEVEL : MIN(vol_r, 0); |
279 | pcm_set_master_volume(sw_volume_l, sw_volume_r); | 279 | pcm_set_master_volume(sw_volume_l, sw_volume_r); |
280 | #endif /* HAVE_SW_VOLUME_CONTROL */ | 280 | #endif /* HAVE_SW_VOLUME_CONTROL */ |
281 | 281 | ||