1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright © 2010 Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <SDL_audio.h>
27 * Audio Hardware api. Make them do nothing as we cannot properly simulate with
28 * SDL. if we used DSP we would run code that doesn't actually run on the target
31 extern void pcm_set_mixer_volume(int);
33 void audiohw_set_volume(int volume
)
36 SDL_MIX_MAXVOLUME
* ((volume
- VOLUME_MIN
) / 10) / (VOLUME_RANGE
/ 10));
39 /* values for SDL playback/dummies for sim */
40 const struct sound_settings_info audiohw_settings
[] = {
41 [SOUND_VOLUME
] = {"dB", 0, 1, VOLUME_MIN
/ 10, VOLUME_MAX
/ 10, -25},
42 [SOUND_BASS
] = {"dB", 0, 1, -24, 24, 0},
43 [SOUND_TREBLE
] = {"dB", 0, 1, -24, 24, 0},
44 [SOUND_BALANCE
] = {"%", 0, 1,-100, 100, 0},
45 [SOUND_CHANNELS
] = {"", 0, 1, 0, 5, 0},
46 [SOUND_STEREO_WIDTH
] = {"%", 0, 5, 0, 250, 100},
47 #if defined(HAVE_RECORDING)
48 [SOUND_LEFT_GAIN
] = {"dB", 1, 1,-128, 96, 0},
49 [SOUND_RIGHT_GAIN
] = {"dB", 1, 1,-128, 96, 0},
50 [SOUND_MIC_GAIN
] = {"dB", 1, 1,-128, 108, 16},
52 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
53 [SOUND_BASS_CUTOFF
] = {"", 0, 1, 1, 4, 1},
55 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
56 [SOUND_TREBLE_CUTOFF
] = {"", 0, 1, 1, 4, 1},
58 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
59 [SOUND_LOUDNESS
] = {"dB", 0, 1, 0, 17, 0},
60 [SOUND_AVC
] = {"", 0, 1, -1, 4, 0},
61 [SOUND_MDB_STRENGTH
] = {"dB", 0, 1, 0, 127, 48},
62 [SOUND_MDB_HARMONICS
] = {"%", 0, 1, 0, 100, 50},
63 [SOUND_MDB_CENTER
] = {"Hz", 0, 10, 20, 300, 60},
64 [SOUND_MDB_SHAPE
] = {"Hz", 0, 10, 50, 300, 90},
65 [SOUND_MDB_ENABLE
] = {"", 0, 1, 0, 1, 0},
66 [SOUND_SUPERBASS
] = {"", 0, 1, 0, 1, 0},
67 #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
71 * stubs here, for the simulator
74 #if defined(AUDIOHW_HAVE_PRESCALER)
75 void audiohw_set_prescaler(int value
) { (void)value
; }
77 #if defined(AUDIOHW_HAVE_BALANCE)
78 void audiohw_set_balance(int value
) { (void)value
; }
80 #if defined(AUDIOHW_HAVE_BASS)
81 void audiohw_set_bass(int value
) { (void)value
; }
83 #if defined(AUDIOHW_HAVE_TREBLE)
84 void audiohw_set_treble(int value
) { (void)value
; }
86 #if CONFIG_CODEC != SWCODEC
87 void audiohw_set_channel(int value
) { (void)value
; }
88 void audiohw_set_stereo_width(int value
){ (void)value
; }
90 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
91 void audiohw_set_bass_cutoff(int value
) { (void)value
; }
93 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
94 void audiohw_set_treble_cutoff(int value
){ (void)value
; }
96 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
97 int mas_codec_readreg(int reg
)
103 int mas_codec_writereg(int reg
, unsigned int val
)
109 int mas_writemem(int bank
, int addr
, const unsigned long* src
, int len
)