diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-04-11 18:57:06 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-04-11 19:00:23 -0400 |
commit | 2dd1f37a109792b262a4000c050f7a48a145f1c4 (patch) | |
tree | c76ac85fd65972956ffe994158cc5ae9b43c99ca | |
parent | f5a5b946867677de76c405ee72e2ea47e36e4c83 (diff) | |
download | rockbox-2dd1f37a109792b262a4000c050f7a48a145f1c4.tar.gz rockbox-2dd1f37a109792b262a4000c050f7a48a145f1c4.zip |
Fix f5a5b94 errors. Employ SW volume for select targets on SIM.
Onda VX747 sim was missing a limits #define; #include limits.h in
pcm_sw_volume.h.
Simply use the software volume control for the SIM volume control
rather than the SDL volume control when the target would have it
natively.
Change-Id: I8e924a2ff1b410f602452d2ea9b691efb82c931e
-rw-r--r-- | firmware/drivers/audio/sdl.c | 17 | ||||
-rw-r--r-- | firmware/export/pcm_sw_volume.h | 1 | ||||
-rw-r--r-- | firmware/sound.c | 6 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/pcm-sdl.c | 6 |
4 files changed, 27 insertions, 3 deletions
diff --git a/firmware/drivers/audio/sdl.c b/firmware/drivers/audio/sdl.c index b9df35b852..3c7cc55ce9 100644 --- a/firmware/drivers/audio/sdl.c +++ b/firmware/drivers/audio/sdl.c | |||
@@ -29,6 +29,14 @@ | |||
29 | * SDL. if we used DSP we would run code that doesn't actually run on the target | 29 | * SDL. if we used DSP we would run code that doesn't actually run on the target |
30 | **/ | 30 | **/ |
31 | 31 | ||
32 | #ifdef HAVE_SW_VOLUME_CONTROL | ||
33 | #include "pcm_sw_volume.h" | ||
34 | |||
35 | void audiohw_set_master_vol(int vol_l, int vol_r) | ||
36 | { | ||
37 | pcm_set_master_volume(vol_l, vol_r); | ||
38 | } | ||
39 | #else /* ndef HAVE_SW_VOLUME_CONTROL */ | ||
32 | extern void pcm_set_mixer_volume(int); | 40 | extern void pcm_set_mixer_volume(int); |
33 | 41 | ||
34 | void audiohw_set_volume(int volume) | 42 | void audiohw_set_volume(int volume) |
@@ -44,6 +52,7 @@ void audiohw_set_volume(int volume) | |||
44 | (void)volume; | 52 | (void)volume; |
45 | #endif /* CONFIG_CODEC == SWCODEC */ | 53 | #endif /* CONFIG_CODEC == SWCODEC */ |
46 | } | 54 | } |
55 | #endif /* HAVE_SW_VOLUME_CONTROL */ | ||
47 | 56 | ||
48 | const struct sound_settings_info audiohw_settings[] = { | 57 | const struct sound_settings_info audiohw_settings[] = { |
49 | [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25}, | 58 | [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25}, |
@@ -129,7 +138,13 @@ const struct sound_settings_info audiohw_settings[] = { | |||
129 | **/ | 138 | **/ |
130 | 139 | ||
131 | #if defined(AUDIOHW_HAVE_PRESCALER) | 140 | #if defined(AUDIOHW_HAVE_PRESCALER) |
132 | void audiohw_set_prescaler(int value) { (void)value; } | 141 | void audiohw_set_prescaler(int value) |
142 | { | ||
143 | #ifdef HAVE_SW_VOLUME_CONTROL | ||
144 | pcm_set_prescaler(value); | ||
145 | #endif | ||
146 | (void)value; | ||
147 | } | ||
133 | #endif | 148 | #endif |
134 | #if defined(AUDIOHW_HAVE_BALANCE) | 149 | #if defined(AUDIOHW_HAVE_BALANCE) |
135 | void audiohw_set_balance(int value) { (void)value; } | 150 | void audiohw_set_balance(int value) { (void)value; } |
diff --git a/firmware/export/pcm_sw_volume.h b/firmware/export/pcm_sw_volume.h index b86e78f500..b5d70654a1 100644 --- a/firmware/export/pcm_sw_volume.h +++ b/firmware/export/pcm_sw_volume.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #ifdef HAVE_SW_VOLUME_CONTROL | 24 | #ifdef HAVE_SW_VOLUME_CONTROL |
25 | 25 | ||
26 | #include <audiohw.h> | 26 | #include <audiohw.h> |
27 | #include <limits.h> | ||
27 | 28 | ||
28 | #define PCM_MUTE_LEVEL INT_MIN | 29 | #define PCM_MUTE_LEVEL INT_MIN |
29 | 30 | ||
diff --git a/firmware/sound.c b/firmware/sound.c index 2ffef0e72b..7c86b0bf05 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -235,8 +235,10 @@ static void set_prescaled_volume(void) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /* ypr0 with sdl has separate volume controls */ | 237 | /* ypr0 with sdl has separate volume controls */ |
238 | #if !defined(HAVE_SDL_AUDIO) || defined(SAMSUNG_YPR0) | 238 | #if defined(HAVE_SW_VOLUME_CONTROL) |
239 | #if defined(HAVE_SW_VOLUME_CONTROL) || defined(HAVE_JZ4740_CODEC) | 239 | audiohw_set_master_vol(l, r); |
240 | #elif !defined(HAVE_SDL_AUDIO) || defined(SAMSUNG_YPR0) | ||
241 | #if defined(HAVE_JZ4740_CODEC) | ||
240 | audiohw_set_master_vol(l, r); | 242 | audiohw_set_master_vol(l, r); |
241 | #elif CONFIG_CODEC == MAS3507D | 243 | #elif CONFIG_CODEC == MAS3507D |
242 | dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); | 244 | dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); |
diff --git a/firmware/target/hosted/sdl/pcm-sdl.c b/firmware/target/hosted/sdl/pcm-sdl.c index bd56189f02..812211288e 100644 --- a/firmware/target/hosted/sdl/pcm-sdl.c +++ b/firmware/target/hosted/sdl/pcm-sdl.c | |||
@@ -51,7 +51,11 @@ | |||
51 | extern bool debug_audio; | 51 | extern bool debug_audio; |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef HAVE_SW_VOLUME_CONTROL | ||
55 | static int sim_volume = SDL_MIX_MAXVOLUME; | ||
56 | #else | ||
54 | static int sim_volume = 0; | 57 | static int sim_volume = 0; |
58 | #endif | ||
55 | 59 | ||
56 | #if CONFIG_CODEC == SWCODEC | 60 | #if CONFIG_CODEC == SWCODEC |
57 | static int cvt_status = -1; | 61 | static int cvt_status = -1; |
@@ -414,9 +418,11 @@ void pcm_play_dma_postinit(void) | |||
414 | { | 418 | { |
415 | } | 419 | } |
416 | 420 | ||
421 | #ifndef HAVE_SW_VOLUME_CONTROL | ||
417 | void pcm_set_mixer_volume(int volume) | 422 | void pcm_set_mixer_volume(int volume) |
418 | { | 423 | { |
419 | sim_volume = volume; | 424 | sim_volume = volume; |
420 | } | 425 | } |
426 | #endif /* HAVE_SW_VOLUME_CONTROL */ | ||
421 | 427 | ||
422 | #endif /* CONFIG_CODEC == SWCODEC */ | 428 | #endif /* CONFIG_CODEC == SWCODEC */ |