summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/audiohw-swcodec.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-04-12 23:35:47 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-04-15 12:02:05 -0400
commit0c7b7873984e04941c9f21fa272638018fdb9a16 (patch)
treefb6afca45d2bef0a2c91732a39ffc0b965f5c557 /firmware/drivers/audio/audiohw-swcodec.c
parentfd9e2568908f91b5bcf7378dc28f6ec070d6027a (diff)
downloadrockbox-0c7b7873984e04941c9f21fa272638018fdb9a16.tar.gz
rockbox-0c7b7873984e04941c9f21fa272638018fdb9a16.zip
Straighten out the mad twisted state of sound.c and related areas.
This is going right in since it's long overdue. If anything is goofed, drop me a line or just tweak it yourself if you know what's wrong. :-) Make HW/SW codec interface more uniform when emulating HW functionality on SWCODEC for functions such as "audiohw_set_pitch". The firmware-to- DSP plumbing is in firmware/drivers/audiohw-swcodec.c. "sound_XXX" APIs are all in sound.c with none in DSP code any longer. Reduce number of settings definitions needed by each codec by providing defaults for common ones like balance, channels and SW tone controls. Remove need for separate SIM code and tables and add virtual codec header for hosted targets. Change-Id: I3f23702bca054fc9bda40f49824ce681bb7f777b
Diffstat (limited to 'firmware/drivers/audio/audiohw-swcodec.c')
-rw-r--r--firmware/drivers/audio/audiohw-swcodec.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/firmware/drivers/audio/audiohw-swcodec.c b/firmware/drivers/audio/audiohw-swcodec.c
new file mode 100644
index 0000000000..45b21183ad
--- /dev/null
+++ b/firmware/drivers/audio/audiohw-swcodec.c
@@ -0,0 +1,76 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Thom Johansen
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "system.h"
23#include "sound.h"
24#include "dsp_misc.h"
25
26/* Linking audio hardware calls to SWCODEC DSP emulation */
27
28static audiohw_swcodec_cb_type callback = NULL;
29
30void audiohw_swcodec_set_callback(audiohw_swcodec_cb_type func)
31{
32 callback = func;
33}
34
35/** Functions exported by audiohw.h **/
36
37void audiohw_set_channel(int value)
38{
39 callback(DSP_CALLBACK_SET_CHANNEL_CONFIG, value);
40}
41
42void audiohw_set_stereo_width(int value)
43{
44 callback(DSP_CALLBACK_SET_STEREO_WIDTH, value);
45}
46
47#ifdef HAVE_SW_TONE_CONTROLS
48void audiohw_set_bass(int value)
49{
50 callback(DSP_CALLBACK_SET_BASS, value);
51}
52
53void audiohw_set_treble(int value)
54{
55 callback(DSP_CALLBACK_SET_TREBLE, value);
56}
57#endif /* HAVE_SW_TONE_CONTROLS */
58
59#ifndef AUDIOHW_HAVE_PRESCALER
60void audiohw_set_prescaler(int value)
61{
62 callback(DSP_CALLBACK_SET_PRESCALE, value);
63}
64#endif /* AUDIOHW_HAVE_PRESCALER */
65
66#ifdef HAVE_PITCHCONTROL
67void audiohw_set_pitch(int32_t value)
68{
69 callback(DSP_CALLBACK_SET_PITCH, value);
70}
71
72int32_t audiohw_get_pitch(void)
73{
74 return callback(DSP_CALLBACK_GET_PITCH, 0);
75}
76#endif /* HAVE_PITCHCONTROL */