Move the PCM/audio playback part of SDL into the target tree.
[kugel-rb.git] / firmware / drivers / audio / sdl.c
blob193029100a00267a6aaba5b566e917c81fdad2d5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 "config.h"
23 #include "audiohw.h"
25 /**
26 * Audio Hardware api. Make them do nothing as we cannot properly simulate with
27 * SDL. if we used DSP we would run code that doesn't actually run on the target
28 **/
30 extern void pcm_set_mixer_volume(int);
32 void audiohw_set_volume(int volume)
34 pcm_set_mixer_volume(
35 SDL_MIX_MAXVOLUME * ((volume - VOLUME_MIN) / 10) / (VOLUME_RANGE / 10));
38 /* values for SDL playback/dummies for sim */
39 const struct sound_settings_info audiohw_settings[] = {
40 [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25},
41 [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0},
42 [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0},
43 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
44 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
45 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
46 #if defined(HAVE_RECORDING)
47 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0},
48 [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0},
49 [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16},
50 #endif
51 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
52 [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
53 #endif
54 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
55 [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
56 #endif
57 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
58 [SOUND_LOUDNESS] = {"dB", 0, 1, 0, 17, 0},
59 [SOUND_AVC] = {"", 0, 1, -1, 4, 0},
60 [SOUND_MDB_STRENGTH] = {"dB", 0, 1, 0, 127, 48},
61 [SOUND_MDB_HARMONICS] = {"%", 0, 1, 0, 100, 50},
62 [SOUND_MDB_CENTER] = {"Hz", 0, 10, 20, 300, 60},
63 [SOUND_MDB_SHAPE] = {"Hz", 0, 10, 50, 300, 90},
64 [SOUND_MDB_ENABLE] = {"", 0, 1, 0, 1, 0},
65 [SOUND_SUPERBASS] = {"", 0, 1, 0, 1, 0},
66 #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
69 /**
70 * stubs here, for the simulator
71 **/
73 #if defined(AUDIOHW_HAVE_PRESCALER)
74 void audiohw_set_prescaler(int value) { (void)value; }
75 #endif
76 #if defined(AUDIOHW_HAVE_BALANCE)
77 void audiohw_set_balance(int value) { (void)value; }
78 #endif
79 #if defined(AUDIOHW_HAVE_BASS)
80 void audiohw_set_bass(int value) { (void)value; }
81 #endif
82 #if defined(AUDIOHW_HAVE_TREBLE)
83 void audiohw_set_treble(int value) { (void)value; }
84 #endif
85 #if CONFIG_CODEC != SWCODEC
86 void audiohw_set_channel(int value) { (void)value; }
87 void audiohw_set_stereo_width(int value){ (void)value; }
88 #endif
89 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
90 void audiohw_set_bass_cutoff(int value) { (void)value; }
91 #endif
92 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
93 void audiohw_set_treble_cutoff(int value){ (void)value; }
94 #endif
95 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
96 int mas_codec_readreg(int reg)
98 (void)reg;
99 return 0;
102 int mas_codec_writereg(int reg, unsigned int val)
104 (void)reg;
105 (void)val;
106 return 0;
108 int mas_writemem(int bank, int addr, const unsigned long* src, int len)
110 (void)bank;
111 (void)addr;
112 (void)src;
113 (void)len;
114 return 0;
116 #endif