Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2005 by Linus Nielsen Feltzing |
Christian Gmeiner | cdbf33a | 2007-05-22 15:56:05 +0000 | [diff] [blame] | 11 | * Copyright (C) 2007 by Christian Gmeiner |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 12 | * Copyright (C) 2013 by Michael Sevakis |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 13 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 14 | * This program is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU General Public License |
| 16 | * as published by the Free Software Foundation; either version 2 |
| 17 | * of the License, or (at your option) any later version. |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 18 | * |
| 19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 20 | * KIND, either express or implied. |
| 21 | * |
| 22 | ****************************************************************************/ |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 23 | /* Indicate it's the sound.c file which affects compilation of audiohw.h */ |
| 24 | #define AUDIOHW_IS_SOUND_C |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 25 | #include "config.h" |
Nils Wallménius | 74e245b | 2009-01-02 11:21:58 +0000 | [diff] [blame] | 26 | #include "system.h" |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 27 | #include "sound.h" |
Michael Sevakis | f5a5b94 | 2013-04-05 04:36:05 -0400 | [diff] [blame] | 28 | #ifdef HAVE_SW_VOLUME_CONTROL |
| 29 | #include "pcm_sw_volume.h" |
| 30 | #endif /* HAVE_SW_VOLUME_CONTROL */ |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 31 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 32 | /* Define sound_setting_entries table */ |
| 33 | #define AUDIOHW_SOUND_SETTINGS_ENTRIES |
| 34 | #include "audiohw_settings.h" |
| 35 | |
| 36 | /* Implements sound_val2phys */ |
| 37 | #define AUDIOHW_SOUND_SETTINGS_VAL2PHYS |
| 38 | #include "audiohw_settings.h" |
Christian Gmeiner | a6100fb | 2008-04-28 22:15:52 +0000 | [diff] [blame] | 39 | |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 40 | extern bool audio_is_initialized; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 41 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 42 | static const struct sound_setting_entry * get_setting_entry(int setting) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 43 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 44 | static const struct sound_settings_info default_info = |
| 45 | { "", 0, 0, 0, 0, 0 }; |
| 46 | |
| 47 | static const struct sound_setting_entry default_entry = |
| 48 | { &default_info, NULL }; |
| 49 | |
| 50 | if ((unsigned)setting >= ARRAYLEN(sound_setting_entries)) |
| 51 | return &default_entry; |
| 52 | |
| 53 | const struct sound_setting_entry *e = &sound_setting_entries[setting]; |
| 54 | return e->info ? e : &default_entry; /* setting valid but not in table? */ |
| 55 | } |
| 56 | |
| 57 | static const struct sound_settings_info * get_settings_info(int setting) |
| 58 | { |
| 59 | return get_setting_entry(setting)->info; |
| 60 | } |
| 61 | |
| 62 | const char * sound_unit(int setting) |
| 63 | { |
| 64 | return get_settings_info(setting)->unit; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | int sound_numdecimals(int setting) |
| 68 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 69 | return get_settings_info(setting)->numdecimals; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | int sound_steps(int setting) |
| 73 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 74 | return get_settings_info(setting)->steps; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | int sound_min(int setting) |
| 78 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 79 | return get_settings_info(setting)->minval; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | int sound_max(int setting) |
| 83 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 84 | return get_settings_info(setting)->maxval; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | int sound_default(int setting) |
| 88 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 89 | return get_settings_info(setting)->defaultval; |
Jens Arnold | 8051a0b | 2005-11-06 23:12:11 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 92 | sound_set_type * sound_get_fn(int setting) |
Nils Wallménius | 74e245b | 2009-01-02 11:21:58 +0000 | [diff] [blame] | 93 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 94 | return get_setting_entry(setting)->function; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 95 | } |
| 96 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 97 | void sound_set(int setting, int value) |
Thom Johansen | a7fabf0 | 2007-02-26 00:41:26 +0000 | [diff] [blame] | 98 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 99 | sound_set_type *sound_set_val = sound_get_fn(setting); |
| 100 | |
| 101 | if (sound_set_val) |
| 102 | sound_set_val(value); |
Thom Johansen | a7fabf0 | 2007-02-26 00:41:26 +0000 | [diff] [blame] | 103 | } |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 104 | |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 105 | #if !defined(AUDIOHW_HAVE_CLIPPING) |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 106 | /* |
| 107 | * The prescaler compensates for any kind of boosts, to prevent clipping. |
| 108 | * |
| 109 | * It's basically just a measure to make sure that audio does not clip during |
| 110 | * tone controls processing, like if i want to boost bass 12 dB, i can decrease |
| 111 | * the audio amplitude by -12 dB before processing, then increase master gain |
| 112 | * by 12 dB after processing. |
| 113 | */ |
Jens Arnold | 12a0e22 | 2005-06-19 23:33:23 +0000 | [diff] [blame] | 114 | |
Michael Sevakis | bbd991a | 2013-04-15 13:24:29 -0400 | [diff] [blame] | 115 | /* Return the sound value scaled to centibels (tenth-decibels) */ |
| 116 | static int sound_value_to_cb(int setting, int value) |
| 117 | { |
Michael Sevakis | 540e5d1 | 2013-04-15 16:11:28 -0400 | [diff] [blame] | 118 | int shift = 1 - sound_numdecimals(setting); |
| 119 | if (shift < 0) do { value /= 10; } while (++shift); |
| 120 | if (shift > 0) do { value *= 10; } while (--shift); |
| 121 | return value; |
Michael Sevakis | bbd991a | 2013-04-15 13:24:29 -0400 | [diff] [blame] | 122 | } |
| 123 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 124 | static struct |
| 125 | { |
| 126 | int volume; /* tenth dB */ |
| 127 | int balance; /* percent */ |
| 128 | #if defined(AUDIOHW_HAVE_BASS) |
| 129 | int bass; /* tenth dB */ |
| 130 | #endif |
| 131 | #if defined(AUDIOHW_HAVE_TREBLE) |
| 132 | int treble; /* tenth dB */ |
| 133 | #endif |
| 134 | #if defined(AUDIOHW_HAVE_EQ) |
| 135 | int eq_gain[AUDIOHW_EQ_BAND_NUM]; /* tenth dB */ |
| 136 | #endif |
| 137 | } sound_prescaler; |
| 138 | |
| 139 | #if defined(AUDIOHW_HAVE_BASS) || defined (AUDIOHW_HAVE_TREBLE) \ |
| 140 | || defined(AUDIOHW_HAVE_EQ) |
| 141 | #define TONE_PRESCALER |
| 142 | #endif |
| 143 | |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 144 | static void set_prescaled_volume(void) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 145 | { |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 146 | #if defined(TONE_PRESCALER) || !defined(AUDIOHW_HAVE_MONO_VOLUME) |
| 147 | const int minvol = sound_value_to_cb(SOUND_VOLUME, sound_min(SOUND_VOLUME)); |
| 148 | #endif |
| 149 | int volume = sound_prescaler.volume; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 150 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 151 | #if defined(TONE_PRESCALER) |
| 152 | int prescale = 0; |
Thom Johansen | 2d7bb99c | 2007-03-07 15:00:29 +0000 | [diff] [blame] | 153 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 154 | /* Note: Having Tone + EQ isn't prohibited */ |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 155 | #if defined(AUDIOHW_HAVE_BASS) && defined(AUDIOHW_HAVE_TREBLE) |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 156 | prescale = MAX(sound_prescaler.bass, sound_prescaler.treble); |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 157 | #endif |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 158 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 159 | #if defined(AUDIOHW_HAVE_EQ) |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 160 | for (int i = 0; i < AUDIOHW_EQ_BAND_NUM; i++) |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 161 | prescale = MAX(sound_prescaler.eq_gain[i], prescale); |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 162 | #endif |
| 163 | |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 164 | if (prescale < 0) |
| 165 | prescale = 0; /* no need to prescale if we don't boost |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 166 | bass, treble or eq band */ |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 167 | |
Jens Arnold | 2993ae6 | 2005-12-07 23:07:07 +0000 | [diff] [blame] | 168 | /* Gain up the analog volume to compensate the prescale gain reduction, |
| 169 | * but if this would push the volume over the top, reduce prescaling |
| 170 | * instead (might cause clipping). */ |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 171 | const int maxvol = sound_value_to_cb(SOUND_VOLUME, sound_max(SOUND_VOLUME)); |
| 172 | |
| 173 | if (volume + prescale > maxvol) |
| 174 | prescale = maxvol - volume; |
Thom Johansen | 2d7bb99c | 2007-03-07 15:00:29 +0000 | [diff] [blame] | 175 | |
Christian Gmeiner | 05e8488 | 2008-05-14 21:35:19 +0000 | [diff] [blame] | 176 | audiohw_set_prescaler(prescale); |
Jens Arnold | 2993ae6 | 2005-12-07 23:07:07 +0000 | [diff] [blame] | 177 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 178 | if (volume <= minvol) |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 179 | prescale = 0; /* Make sure the audio gets muted */ |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 180 | |
| 181 | #ifndef AUDIOHW_HAVE_MONO_VOLUME |
| 182 | /* At the moment, such targets have lousy volume resolution and so minute |
| 183 | boost won't work how we'd like */ |
| 184 | volume += prescale; |
| 185 | #endif |
| 186 | #endif /* TONE_PRESCALER */ |
Jens Arnold | 2993ae6 | 2005-12-07 23:07:07 +0000 | [diff] [blame] | 187 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 188 | #if defined(AUDIOHW_HAVE_MONO_VOLUME) |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 189 | audiohw_set_volume(volume); |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 190 | #else /* Stereo volume */ |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 191 | int l = volume, r = volume; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 192 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 193 | /* Balance the channels scaled by the current volume and min volume */ |
| 194 | int balance = sound_prescaler.balance; /* percent */ |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 195 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 196 | if (balance > 0) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 197 | { |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 198 | l -= (l - minvol) * balance / 100; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 199 | } |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 200 | else if (balance < 0) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 201 | { |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 202 | r += (r - minvol) * balance / 100; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 203 | } |
| 204 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 205 | audiohw_set_volume(l, r); |
| 206 | #endif /* AUDIOHW_HAVE_MONO_VOLUME */ |
Thom Johansen | 473fc2b | 2006-03-22 13:04:49 +0000 | [diff] [blame] | 207 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 208 | #if defined(AUDIOHW_HAVE_LINEOUT) |
| 209 | /* For now, lineout stays at unity */ |
| 210 | audiohw_set_lineout_volume(0, 0); |
| 211 | #endif /* AUDIOHW_HAVE_LINEOUT */ |
Anton Oleynikov | 2654d91 | 2005-12-04 14:33:10 +0000 | [diff] [blame] | 212 | } |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 213 | #endif /* AUDIOIHW_HAVE_CLIPPING */ |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 214 | |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 215 | void sound_set_volume(int value) |
| 216 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 217 | if (!audio_is_initialized) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 218 | return; |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 219 | |
| 220 | #if defined(AUDIOHW_HAVE_CLIPPING) |
| 221 | audiohw_set_volume(value); |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 222 | #else |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 223 | sound_prescaler.volume = sound_value_to_cb(SOUND_VOLUME, value); |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 224 | set_prescaled_volume(); |
Jens Arnold | 2993ae6 | 2005-12-07 23:07:07 +0000 | [diff] [blame] | 225 | #endif |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | void sound_set_balance(int value) |
| 229 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 230 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 231 | return; |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 232 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 233 | #if defined(AUDIOHW_HAVE_BALANCE) |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 234 | audiohw_set_balance(value); |
| 235 | #else |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 236 | sound_prescaler.balance = value; |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 237 | set_prescaled_volume(); |
Jens Arnold | 2993ae6 | 2005-12-07 23:07:07 +0000 | [diff] [blame] | 238 | #endif |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 239 | } |
| 240 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 241 | #if defined(AUDIOHW_HAVE_BASS) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 242 | void sound_set_bass(int value) |
| 243 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 244 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 245 | return; |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 246 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 247 | audiohw_set_bass(value); |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 248 | |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 249 | #if !defined(AUDIOHW_HAVE_CLIPPING) |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 250 | sound_prescaler.bass = sound_value_to_cb(SOUND_BASS, value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 251 | set_prescaled_volume(); |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 252 | #endif |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 253 | } |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 254 | #endif /* AUDIOHW_HAVE_BASS */ |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 255 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 256 | #if defined(AUDIOHW_HAVE_TREBLE) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 257 | void sound_set_treble(int value) |
| 258 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 259 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 260 | return; |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 261 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 262 | audiohw_set_treble(value); |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 263 | |
Christian Gmeiner | 785e776 | 2008-05-13 06:19:16 +0000 | [diff] [blame] | 264 | #if !defined(AUDIOHW_HAVE_CLIPPING) |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 265 | sound_prescaler.treble = sound_value_to_cb(SOUND_TREBLE, value); |
Christian Gmeiner | 8391526 | 2008-04-28 08:37:18 +0000 | [diff] [blame] | 266 | set_prescaled_volume(); |
| 267 | #endif |
Jens Arnold | 8051a0b | 2005-11-06 23:12:11 +0000 | [diff] [blame] | 268 | } |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 269 | #endif /* AUDIOHW_HAVE_TREBLE */ |
| 270 | |
| 271 | #if defined(AUDIOHW_HAVE_BASS_CUTOFF) |
| 272 | void sound_set_bass_cutoff(int value) |
| 273 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 274 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 275 | return; |
| 276 | |
| 277 | audiohw_set_bass_cutoff(value); |
| 278 | } |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 279 | #endif /* AUDIOHW_HAVE_BASS_CUTOFF */ |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 280 | |
| 281 | #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF) |
| 282 | void sound_set_treble_cutoff(int value) |
| 283 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 284 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 285 | return; |
| 286 | |
| 287 | audiohw_set_treble_cutoff(value); |
| 288 | } |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 289 | #endif /* AUDIOHW_HAVE_TREBLE_CUTOFF */ |
Jens Arnold | 8051a0b | 2005-11-06 23:12:11 +0000 | [diff] [blame] | 290 | |
| 291 | void sound_set_channels(int value) |
| 292 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 293 | if (!audio_is_initialized) |
Christian Gmeiner | b1806b2 | 2008-04-22 13:43:01 +0000 | [diff] [blame] | 294 | return; |
| 295 | |
Christian Gmeiner | b1806b2 | 2008-04-22 13:43:01 +0000 | [diff] [blame] | 296 | audiohw_set_channel(value); |
Jens Arnold | 8051a0b | 2005-11-06 23:12:11 +0000 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | void sound_set_stereo_width(int value) |
| 300 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 301 | if (!audio_is_initialized) |
Christian Gmeiner | b1806b2 | 2008-04-22 13:43:01 +0000 | [diff] [blame] | 302 | return; |
| 303 | |
Christian Gmeiner | b1806b2 | 2008-04-22 13:43:01 +0000 | [diff] [blame] | 304 | audiohw_set_stereo_width(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 305 | } |
| 306 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 307 | #if defined(AUDIOHW_HAVE_DEPTH_3D) |
| 308 | void sound_set_depth_3d(int value) |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 309 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 310 | if (!audio_is_initialized) |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 311 | return; |
| 312 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 313 | audiohw_set_depth_3d(value); |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 314 | } |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 315 | #endif /* AUDIOHW_HAVE_DEPTH_3D */ |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 316 | |
Andrew Ryabinin | 0519f7e | 2013-05-12 23:23:45 +0400 | [diff] [blame] | 317 | #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) |
| 318 | void sound_set_filter_roll_off(int value) |
| 319 | { |
| 320 | if (!audio_is_initialized) |
| 321 | return; |
| 322 | |
| 323 | audiohw_set_filter_roll_off(value); |
| 324 | } |
| 325 | #endif |
| 326 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 327 | #if defined(AUDIOHW_HAVE_EQ) |
| 328 | int sound_enum_hw_eq_band_setting(unsigned int band, |
| 329 | unsigned int band_setting) |
| 330 | { |
| 331 | static const int8_t |
| 332 | sound_hw_eq_band_setting[AUDIOHW_EQ_SETTING_NUM][AUDIOHW_EQ_BAND_NUM] = |
| 333 | { |
| 334 | [AUDIOHW_EQ_GAIN] = |
| 335 | { |
| 336 | [0 ... AUDIOHW_EQ_BAND_NUM-1] = -1, |
| 337 | [AUDIOHW_EQ_BAND1] = SOUND_EQ_BAND1_GAIN, |
| 338 | #ifdef AUDIOHW_HAVE_EQ_BAND2 |
| 339 | [AUDIOHW_EQ_BAND2] = SOUND_EQ_BAND2_GAIN, |
| 340 | #endif |
| 341 | #ifdef AUDIOHW_HAVE_EQ_BAND3 |
| 342 | [AUDIOHW_EQ_BAND3] = SOUND_EQ_BAND3_GAIN, |
| 343 | #endif |
| 344 | #ifdef AUDIOHW_HAVE_EQ_BAND4 |
| 345 | [AUDIOHW_EQ_BAND4] = SOUND_EQ_BAND4_GAIN, |
| 346 | #endif |
| 347 | #ifdef AUDIOHW_HAVE_EQ_BAND5 |
| 348 | [AUDIOHW_EQ_BAND5] = SOUND_EQ_BAND5_GAIN, |
| 349 | #endif |
| 350 | }, |
| 351 | #ifdef AUDIOHW_HAVE_EQ_FREQUENCY |
| 352 | [AUDIOHW_EQ_FREQUENCY] = |
| 353 | { |
| 354 | [0 ... AUDIOHW_EQ_BAND_NUM-1] = -1, |
| 355 | #ifdef AUDIOHW_HAVE_EQ_BAND1_FREQUENCY |
| 356 | [AUDIOHW_EQ_BAND1] = SOUND_EQ_BAND1_FREQUENCY, |
| 357 | #endif |
| 358 | #ifdef AUDIOHW_HAVE_EQ_BAND2_FREQUENCY |
| 359 | [AUDIOHW_EQ_BAND2] = SOUND_EQ_BAND2_FREQUENCY, |
| 360 | #endif |
| 361 | #ifdef AUDIOHW_HAVE_EQ_BAND3_FREQUENCY |
| 362 | [AUDIOHW_EQ_BAND3] = SOUND_EQ_BAND3_FREQUENCY, |
| 363 | #endif |
| 364 | #ifdef AUDIOHW_HAVE_EQ_BAND4_FREQUENCY |
| 365 | [AUDIOHW_EQ_BAND4] = SOUND_EQ_BAND4_FREQUENCY, |
| 366 | #endif |
| 367 | #ifdef AUDIOHW_HAVE_EQ_BAND5_FREQUENCY |
| 368 | [AUDIOHW_EQ_BAND5] = SOUND_EQ_BAND5_FREQUENCY, |
| 369 | #endif |
| 370 | }, |
| 371 | #endif /* AUDIOHW_HAVE_EQ_FREQUENCY */ |
| 372 | #ifdef AUDIOHW_HAVE_EQ_WIDTH |
| 373 | [AUDIOHW_EQ_WIDTH] = |
| 374 | { |
| 375 | [0 ... AUDIOHW_EQ_BAND_NUM-1] = -1, |
| 376 | #ifdef AUDIOHW_HAVE_EQ_BAND2_WIDTH |
| 377 | [AUDIOHW_EQ_BAND2] = SOUND_EQ_BAND2_WIDTH, |
| 378 | #endif |
| 379 | #ifdef AUDIOHW_HAVE_EQ_BAND3_WIDTH |
| 380 | [AUDIOHW_EQ_BAND3] = SOUND_EQ_BAND3_WIDTH, |
| 381 | #endif |
| 382 | #ifdef AUDIOHW_HAVE_EQ_BAND4_WIDTH |
| 383 | [AUDIOHW_EQ_BAND4] = SOUND_EQ_BAND4_WIDTH, |
| 384 | #endif |
| 385 | }, |
| 386 | #endif /* AUDIOHW_HAVE_EQ_WIDTH */ |
| 387 | }; |
| 388 | |
| 389 | if (band < AUDIOHW_EQ_BAND_NUM && band_setting < AUDIOHW_EQ_SETTING_NUM) |
| 390 | return sound_hw_eq_band_setting[band_setting][band]; |
| 391 | |
| 392 | return -1; |
| 393 | } |
| 394 | |
| 395 | static void sound_set_hw_eq_band_gain(unsigned int band, int value) |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 396 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 397 | if (!audio_is_initialized) |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 398 | return; |
| 399 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 400 | audiohw_set_eq_band_gain(band, value); |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 401 | |
| 402 | #if !defined (AUDIOHW_HAVE_CLIPPING) |
| 403 | int setting = sound_enum_hw_eq_band_setting(band, AUDIOHW_EQ_GAIN); |
| 404 | sound_prescaler.eq_gain[band] = sound_value_to_cb(setting, value); |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 405 | set_prescaled_volume(); |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 406 | #endif /* AUDIOHW_HAVE_CLIPPING */ |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | void sound_set_hw_eq_band1_gain(int value) |
| 410 | { |
| 411 | sound_set_hw_eq_band_gain(AUDIOHW_EQ_BAND1, value); |
| 412 | } |
| 413 | |
| 414 | #if defined(AUDIOHW_HAVE_EQ_BAND2) |
| 415 | void sound_set_hw_eq_band2_gain(int value) |
| 416 | { |
| 417 | sound_set_hw_eq_band_gain(AUDIOHW_EQ_BAND2, value); |
Dan Everton | d7e1f77 | 2007-11-24 07:51:00 +0000 | [diff] [blame] | 418 | } |
| 419 | #endif |
| 420 | |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 421 | #if defined(AUDIOHW_HAVE_EQ_BAND3) |
| 422 | void sound_set_hw_eq_band3_gain(int value) |
| 423 | { |
| 424 | sound_set_hw_eq_band_gain(AUDIOHW_EQ_BAND3, value); |
| 425 | } |
| 426 | #endif |
| 427 | |
| 428 | #if defined(AUDIOHW_HAVE_EQ_BAND4) |
| 429 | void sound_set_hw_eq_band4_gain(int value) |
| 430 | { |
| 431 | sound_set_hw_eq_band_gain(AUDIOHW_EQ_BAND4, value); |
| 432 | } |
| 433 | #endif |
| 434 | |
| 435 | #if defined(AUDIOHW_HAVE_EQ_BAND5) |
| 436 | void sound_set_hw_eq_band5_gain(int value) |
| 437 | { |
| 438 | sound_set_hw_eq_band_gain(AUDIOHW_EQ_BAND5, value); |
| 439 | } |
| 440 | #endif |
| 441 | |
| 442 | #if defined(AUDIOHW_HAVE_EQ_BAND1_FREQUENCY) |
| 443 | void sound_set_hw_eq_band1_frequency(int value) |
| 444 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 445 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 446 | return; |
| 447 | |
| 448 | audiohw_set_eq_band_frequency(AUDIOHW_EQ_BAND1, value); |
| 449 | } |
| 450 | #endif |
| 451 | |
| 452 | #if defined(AUDIOHW_HAVE_EQ_BAND2_FREQUENCY) |
| 453 | void sound_set_hw_eq_band2_frequency(int value) |
| 454 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 455 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 456 | return; |
| 457 | |
| 458 | audiohw_set_eq_band_frequency(AUDIOHW_EQ_BAND2, value); |
| 459 | } |
| 460 | #endif |
| 461 | |
| 462 | #if defined(AUDIOHW_HAVE_EQ_BAND3_FREQUENCY) |
| 463 | void sound_set_hw_eq_band3_frequency(int value) |
| 464 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 465 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 466 | return; |
| 467 | |
| 468 | audiohw_set_eq_band_frequency(AUDIOHW_EQ_BAND3, value); |
| 469 | } |
| 470 | #endif |
| 471 | |
| 472 | #if defined(AUDIOHW_HAVE_EQ_BAND4_FREQUENCY) |
| 473 | void sound_set_hw_eq_band4_frequency(int value) |
| 474 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 475 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 476 | return; |
| 477 | |
| 478 | audiohw_set_eq_band_frequency(AUDIOHW_EQ_BAND4, value); |
| 479 | } |
| 480 | #endif |
| 481 | |
| 482 | #if defined(AUDIOHW_HAVE_EQ_BAND5_FREQUENCY) |
| 483 | void sound_set_hw_eq_band5_frequency(int value) |
| 484 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 485 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 486 | return; |
| 487 | |
| 488 | audiohw_set_eq_band_frequency(AUDIOHW_EQ_BAND5, value); |
| 489 | } |
| 490 | #endif |
| 491 | |
| 492 | #if defined(AUDIOHW_HAVE_EQ_BAND2_WIDTH) |
| 493 | void sound_set_hw_eq_band2_width(int value) |
| 494 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 495 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 496 | return; |
| 497 | |
| 498 | audiohw_set_eq_band_width(AUDIOHW_EQ_BAND2, value); |
| 499 | } |
| 500 | #endif |
| 501 | |
| 502 | #if defined(AUDIOHW_HAVE_EQ_BAND3_WIDTH) |
| 503 | void sound_set_hw_eq_band3_width(int value) |
| 504 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 505 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 506 | return; |
| 507 | |
| 508 | audiohw_set_eq_band_width(AUDIOHW_EQ_BAND3, value); |
| 509 | } |
| 510 | #endif |
| 511 | |
| 512 | #if defined(AUDIOHW_HAVE_EQ_BAND4_WIDTH) |
| 513 | void sound_set_hw_eq_band4_width(int value) |
| 514 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 515 | if (!audio_is_initialized) |
Michael Sevakis | 80d0d15 | 2010-05-15 13:09:45 +0000 | [diff] [blame] | 516 | return; |
| 517 | |
| 518 | audiohw_set_eq_band_width(AUDIOHW_EQ_BAND4, value); |
| 519 | } |
| 520 | #endif |
| 521 | #endif /* AUDIOHW_HAVE_EQ */ |
| 522 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 523 | #if CONFIG_CODEC == MAS3587F || CONFIG_CODEC == MAS3539F |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 524 | void sound_set_loudness(int value) |
| 525 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 526 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 527 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 528 | |
| 529 | audiohw_set_loudness(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | void sound_set_avc(int value) |
| 533 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 534 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 535 | return; |
Nils Wallménius | 74e245b | 2009-01-02 11:21:58 +0000 | [diff] [blame] | 536 | |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 537 | audiohw_set_avc(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | void sound_set_mdb_strength(int value) |
| 541 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 542 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 543 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 544 | |
| 545 | audiohw_set_mdb_strength(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | void sound_set_mdb_harmonics(int value) |
| 549 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 550 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 551 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 552 | |
| 553 | audiohw_set_mdb_harmonics(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | void sound_set_mdb_center(int value) |
| 557 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 558 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 559 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 560 | |
| 561 | audiohw_set_mdb_center(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | void sound_set_mdb_shape(int value) |
| 565 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 566 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 567 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 568 | |
| 569 | audiohw_set_mdb_shape(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | void sound_set_mdb_enable(int value) |
| 573 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 574 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 575 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 576 | |
| 577 | audiohw_set_mdb_enable(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | void sound_set_superbass(int value) |
| 581 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 582 | if (!audio_is_initialized) |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 583 | return; |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 584 | |
| 585 | audiohw_set_superbass(value); |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 586 | } |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 587 | #endif /* CONFIG_CODEC == MAS3587F || CONFIG_CODEC == MAS3539F */ |
Kevin Ferrare | 9b5264d | 2005-11-06 03:18:34 +0000 | [diff] [blame] | 588 | |
Michael Sevakis | e61e9c6 | 2013-04-20 04:06:13 -0400 | [diff] [blame] | 589 | #if defined(HAVE_PITCHCONTROL) |
Alexander Levin | cc7c665 | 2009-07-11 16:46:19 +0000 | [diff] [blame] | 590 | void sound_set_pitch(int32_t pitch) |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 591 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 592 | if (!audio_is_initialized) |
| 593 | return; |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 594 | |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 595 | audiohw_set_pitch(pitch); |
Jens Arnold | b9ebe6a | 2005-05-22 12:45:35 +0000 | [diff] [blame] | 596 | } |
| 597 | |
Alexander Levin | cc7c665 | 2009-07-11 16:46:19 +0000 | [diff] [blame] | 598 | int32_t sound_get_pitch(void) |
Jens Arnold | b9ebe6a | 2005-05-22 12:45:35 +0000 | [diff] [blame] | 599 | { |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 600 | if (!audio_is_initialized) |
| 601 | return PITCH_SPEED_100; |
| 602 | |
| 603 | return audiohw_get_pitch(); |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 604 | } |
Michael Sevakis | 0c7b787 | 2013-04-12 23:35:47 -0400 | [diff] [blame] | 605 | #endif /* HAVE_PITCHCONTROL */ |