summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/events.hcc
blob: 2e8c27216e49c185fa6aa70cb2923ec9f230aabc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*! \file events.hcc
 *
 * \section generic	This module contains the various actions and events
 *			that need to be performed.
 *
 * \section project Project information.
 * Project Graphic Equalizer\n
 * \author O.M. Schinagl
 * \date 20041710
 * \version 0.1
 *
 * \section copyright Copyright
 * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
 *
 * \section history Change history
 * 20041710: O.M. Schinagl\n	Initial version
 *
 *****************************************************************************/



/******** System Includes *************/
#include <stdlib.hch>

#include "pal_master.hch"

/******** Application Includes ********/
#include "configuration.hch"
#include "eventhandler_shared.hch"
#include "events.hch"

#if HAVE_DEBUG
	#include "debug.hch"
#endif


ram unsigned 8 presets_default_values[768] = {
#include "presets_hardcoded.txt"
};



/*! \fn		void load_preset(unsigned 10 preset, unsigned 4 *equalizer_levels_ptr);
 * \brief	This function loads 768 4bits presets into the equalizer_levels
 *		array pointed to by equalizer_levels.
 *
 * \param	*equalizer_levels	Location where to store presets loaded
 *					from blockram.
 *
 * \return	void
 * \retval	void
 */
void load_preset(unsigned 10 preset, unsigned 4 *equalizer_levels_ptr) {
	unsigned 10 equalizer_index;
	unsigned 4 temp;

	equalizer_index = 0;
	while (equalizer_index != 768) {
		temp = presets_default_values[preset +(0 @ (equalizer_index \\ 1))][7:4];
		equalizer_levels_ptr[equalizer_index] = temp;
		temp = presets_default_values[preset +(0 @ (equalizer_index \\ 1))][3:0];
		equalizer_levels_ptr[equalizer_index +1] = temp;

		equalizer_index += 2;
	}
} /* --- load_preset() --- */



/*
 * Equalizer lookuptabes.
 * TODO: This table is now hardcoded. To ensure full skinability this table
 * should be dynamically loaded.
 */
ram unsigned 4 equalizer_table[640] = {15, 15, 15, 15, 15, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0};
ram unsigned 10 equalizer_table_inv[16] = {446, 444, 440, 436, 432, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 384};