annotate chipsetsw/layer1/audio_cfile/l1audio_back.c @ 349:ed3e588600c1 default tip

README update for the successful completion of the L1 reconstruction project
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 30 Oct 2017 18:03:24 +0000
parents dab163da789a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
260
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1 /************* Revision Controle System Header *************
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2 * GSM Layer 1 software
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
3 * L1AUDIO_SRBACK.C
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
4 *
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
5 * Filename l1audio_back.c
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
6 * Copyright 2003 (C) Texas Instruments
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 *
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
8 ************* Revision Controle System Header *************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
9
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10 /************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11 /* Include files... */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
12 /************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
13
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
14 #define L1_SRBACK_COM // switch to define the l1_srback_com variable
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
15 #define L1_AUDIOBACK_MELODYE2 // switch to define the audio background variable
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
16
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
17 #include "l1_macro.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
18 #include "l1_confg.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
19
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
20 #if (AUDIO_TASK == 1) && (L1_AUDIO_BACKGROUND_TASK)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
21
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
22 #include "l1_types.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
23 #include "sys_types.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
24
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
25 #if (CODE_VERSION == SIMULATION) && (AUDIO_SIMULATION)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
26
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
27
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
28 #include <stdlib.h>
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
29 #include <string.h>
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 #include "iq.h" // Debug / Init hardware ("eva3.lib")
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
32 #include "l1_ver.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
33 #include "l1_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
34 #include "l1_signa.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
35
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
36 #if TESTMODE
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
37 #include "l1tm_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
38 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
39
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
40 #include "l1audio_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
41 #include "l1audio_cust.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
42 #include "l1audio_signa.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
43 #include "l1audio_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
44 #include "l1audio_msgty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
45 #include "l1audio_varex.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
46
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
47 #if (L1_GTT == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
48 #include "l1gtt_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
49 #include "l1gtt_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
50 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
51 //added form e-sample for AAC
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
52 #if (L1_DYN_DSP_DWNLD == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
53 #include "l1_dyn_dwl_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
54 #include "l1_dyn_dwl_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
55 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
56 #if (L1_MP3 == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
57 #include "l1mp3_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
58 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
59
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
60 #if (L1_MIDI == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
61 #include "l1midi_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
62 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
63 //added form e-sample for AAC
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
64 #if (L1_AAC == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
65 #include "l1aac_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
66 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
67
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
68 #include "l1_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
69 #include "cust_os.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
70 #include "l1_msgty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
71 #include "l1_varex.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
72
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
73 #include "l1_mftab.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
74 #include "l1_tabs.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
75 #include "l1_ctl.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
76
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
77
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
78 #include "l1_time.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
79 #include "l1_scen.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
80
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
81 #else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
82 // Layer1 and debug include files.
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
83
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
84 #include <ctype.h>
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
85 #include <math.h>
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
86 #include "l1_ver.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
87 #include "l1_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
88 #include "l1_signa.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
89
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
90 #if TESTMODE
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
91 #include "l1tm_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
92 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
93
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
94 #include "l1audio_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
95 #include "l1audio_cust.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
96 #include "l1audio_signa.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
97 #include "l1audio_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
98 #include "l1audio_msgty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
99 #include "l1audio_varex.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
100
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
101 #if (L1_GTT == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
102 #include "l1gtt_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
103 #include "l1gtt_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
104 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
105 //added form e-sample for AAC
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
106 #if (L1_DYN_DSP_DWNLD == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
107 #include "l1_dyn_dwl_const.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
108 #include "l1_dyn_dwl_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
109 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
110 #if (L1_MP3 == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
111 #include "l1mp3_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
112 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
113
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
114 #if (L1_MIDI == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
115 #include "l1midi_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
116 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
117 //added form e-sample for AAC
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
118 #if (L1_AAC == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
119 #include "l1aac_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
120 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
121
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
122 #include "l1_defty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
123 #include "cust_os.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
124 #include "l1_msgty.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
125 #include "tpudrv.h" // TPU drivers. ("eva3.lib")
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
126 #include "l1_varex.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
127
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
128 #include "l1_proto.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
129 #include "l1_mftab.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
130 #include "l1_tabs.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
131 #include "mem.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
132 #include "armio.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
133 #include "timer.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
134 #include "timer1.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
135 #include "dma.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
136 #include "inth.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
137 #include "ulpd.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
138 #include "rhea_arm.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
139 #include "clkm.h" // Clockm ("eva3.lib")
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
140 #include "l1_ctl.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
141
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
142 #include "l1_time.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
143 #if L2_L3_SIMUL
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
144 #include "l1_scen.h"
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
145 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
146 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
147
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
148 /****************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
149 /* Prototypes for audio background task */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
150 /****************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
151 void l1_audio_background_task (UWORD32 argc, void *argv);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
152 #if (SPEECH_RECO)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
153 void srback_CTO_algorithm (API *RAM_address);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
154 void srback_save_model_temp (API *RAM_address_input, UWORD16 *RAM_address_output);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
155 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
156 #if (MELODY_E2 && FIR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
157 void audio_background_melody_e2_download_instrument_manager(xSignalHeaderRec *msg);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
158 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
159 /**************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
160 /* External prototypes */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
161 /**************************************/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
162 #if (SPEECH_RECO)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
163 extern void Cust_srback_save_model (UWORD8 database, UWORD8 index, API *RAM_address);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
164 extern void Cust_srback_save_speech (UWORD8 database, UWORD8 index, UWORD16 *start_buffer, UWORD16 *stop_buffer, UWORD16 *start_speech, UWORD16 *stop_speech);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
165 extern void Cust_srback_load_model (UWORD8 database, UWORD8 index, API *RAM_address);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
166 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
167 #if (MELODY_E2 && FIR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
168 extern UWORD16 Cust_audio_melody_E2_load_instrument (UWORD8 customer_instrument_id,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
169 API *API_address,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
170 UWORD16 allowed_size);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
171 #endif
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
172
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
173 #if (OP_RIV_AUDIO == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
174 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
175 /* l1_audio_background_task() */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
176 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
177 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
178 /* Description: */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
179 /* ------------ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
180 /* This function is a state machine which handles the */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
181 /* audio background feature. */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
182 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
183 /* Starting messages: L1_SRBACK_SAVE_DATA_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
184 /* L1_SRBACK_TEMP_SAVE_DATA_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
185 /* L1_SRBACK_LOAD_MODEL_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
186 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
187 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
188 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
189 /* Result messages (input): none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
190 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
191 /* Result messages (output): L1_SRBACK_SAVE_DATA_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
192 /* L1_SRBACK_TEMP_SAVE_DATA_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
193 /* L1_SRBACK_LOAD_MODEL_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
194 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
195 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
196 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
197 /* Reset messages (input): none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
198 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
199 /* Stop message (input): non */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
200 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
201 /* Stop message (output): L1_SRBACK_SAVE_DATA_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
202 /* L1_SRBACK_TEMP_SAVE_DATA_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
203 /* L1_SRBACK_LOAD_MODEL_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
204 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
205 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
206 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
207 /* Rem: to stop immeditly the speech reco feature a flag */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
208 /* ---- is created: l1_srback_com.emergency_stop */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
209 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
210 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
211 void l1_audio_background_task(UWORD32 argc, void *argv)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
212 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
213 xSignalHeaderRec *receive_msg, *confirm_msg;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
214 UWORD8 index;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
215
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
216 while(1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
217 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
218 // Wait until a message is receive
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
219 receive_msg = os_receive_sig(SRBACK_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
220
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
221 #if (SPEECH_RECO)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
222 if (receive_msg->SignalCode == L1_SRBACK_SAVE_DATA_REQ)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
223 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
224 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
225 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
226 // Call the customer function to save the model
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
227 Cust_srback_save_model( ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->database_id,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
228 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->model_index,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
229 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->model_RAM_address );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
230 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
231 if ( ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->speech )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
232 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
233 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
234 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
235 // Call the customer function to save the speech from a circular buffer to the database
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
236 Cust_srback_save_speech( ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->database_id,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
237 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->model_index,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
238 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->start_buffer,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
239 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->stop_buffer,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
240 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->start_address,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
241 ((T_L1_SRBACK_SAVE_DATA_REQ *)(receive_msg->SigP))->stop_address);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
242 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
243 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
244
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
245 // Send the stop confirmation message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
246 confirm_msg = os_alloc_sig(0);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
247 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
248 confirm_msg->SignalCode = L1_SRBACK_SAVE_DATA_CON;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
249 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
250 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
251 } // L1_SRBACK_SAVE_DATA_REQ
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
252 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
253 if (receive_msg->SignalCode == L1_SRBACK_LOAD_MODEL_REQ)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
254 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
255 if ( ( ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->CTO_enable ) == FALSE )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
256 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
257 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
258 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
259 // Call the function to load a model
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
260 Cust_srback_load_model( ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->database_id,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
261 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_index,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
262 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_RAM_address );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
263 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
264 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
265 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
266 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
267 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
268 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
269 // Calculate the good index
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
270 index = ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_index>>1;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
271
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
272 // Call the function to load a model with the good index
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
273 Cust_srback_load_model( ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->database_id,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
274 index,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
275 ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_RAM_address );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
276 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
277
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
278 // The CTO algorithm is used and the model index is odd
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
279 if ( ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_index & 0x01 )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
280 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
281 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
282 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
283 // Call the function to apply the CTO algorithm to the loaded model
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
284 srback_CTO_algorithm( ((T_L1_SRBACK_LOAD_MODEL_REQ *)(receive_msg->SigP))->model_RAM_address );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
285 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
286 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
287 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
288
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
289 // Send the stop confirmation message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
290 confirm_msg = os_alloc_sig(0);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
291 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
292 confirm_msg->SignalCode = L1_SRBACK_LOAD_MODEL_CON;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
293 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
294 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
295 } // L1_SRBACK_LOAD_MODEL_REQ
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
296 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
297 if (receive_msg->SignalCode == L1_SRBACK_TEMP_SAVE_DATA_REQ)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
298 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
299 if (l1_srback_com.emergency_stop == FALSE)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
300 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
301 // Call the function to save the model in a temporary buffer
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
302 srback_save_model_temp( ((T_L1_SRBACK_TEMP_SAVE_DATA_REQ *)(receive_msg->SigP))->model_RAM_address_input,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
303 ((T_L1_SRBACK_TEMP_SAVE_DATA_REQ *)(receive_msg->SigP))->model_RAM_address_output );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
304 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
305
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
306 // Send the stop confirmation message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
307 confirm_msg = os_alloc_sig(0);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
308 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
309 confirm_msg->SignalCode = L1_SRBACK_TEMP_SAVE_DATA_CON;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
310 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
311 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
312 } // L1_SRBACK_TEMP_SAVE_DATA_REQ
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
313 #endif // SPEECH_RECO
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
314 #if (MELODY_E2 && FIR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
315 if ( (receive_msg->SignalCode == L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ) ||
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
316 (receive_msg->SignalCode == L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
317 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
318 audio_background_melody_e2_download_instrument_manager(receive_msg);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
319 } // L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
320 #endif // MELODY_E2
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
321
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
322 // Deallocate the received message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
323 os_free_sig(receive_msg);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
324 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
325 } // while(1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
326 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
327 #endif // OP_RIV_AUDIO
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
328
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
329 #if (SPEECH_RECO)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
330 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
331 /* srback_CTO_algorithm() */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
332 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
333 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
334 /* Parameters : RAM_address */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
335 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
336 /* Return : none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
337 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
338 /* Description : apply the CTO algorithm to the model. */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
339 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
340 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
341 void srback_CTO_algorithm (API *RAM_address)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
342 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
343 UWORD16 model_size, frame;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
344 UWORD8 frame_size;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
345
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
346 // This alogrithm changes the model:
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
347 // |frame 0|frame 1|frame 2|frame 3|frame 4|frame 5|frame 6|frame 7|...
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
348 // into a garbage model:
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
349 // |0000000|frame 1|0000000|0000000|frame 4|0000000|0000000|frame 7|...
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
350
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
351 // look the size of the model in model frame unit (16 words unit)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
352 model_size = *RAM_address++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
353
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
354 frame = 0;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
355
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
356 while( (frame <= model_size) &&
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
357 (l1_srback_com.emergency_stop == FALSE) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
358 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
359 if ((frame % 3) == 1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
360 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
361 // This frame is kept
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
362 RAM_address += SC_SR_MODEL_FRAME_SIZE;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
363 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
364 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
365 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
366 // This frame is set to 0
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
367 frame_size = SC_SR_MODEL_FRAME_SIZE;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
368 while ( (frame_size != 0) &&
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
369 (l1_srback_com.emergency_stop == FALSE) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
370 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
371 *RAM_address++ = 0;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
372 frame_size--;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
373 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
374 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
375
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
376 frame++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
377 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
378 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
379
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
380 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
381 /* srback_CTO_algorithm() */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
382 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
383 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
384 /* Parameters : RAM_address_input */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
385 /* RAM_address_output */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
386 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
387 /* Return : none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
388 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
389 /* Description : apply the CTO algorithm to the model. */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
390 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
391 /*-------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
392 void srback_save_model_temp (API *RAM_address_input, UWORD16 *RAM_address_output)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
393 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
394 UWORD16 model_size;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
395 UWORD8 frame_size;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
396
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
397 // look the size of the model in model frame unit (16 words unit)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
398 model_size = *RAM_address_input;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
399
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
400 // save the header of the model
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
401 *RAM_address_output++ = *RAM_address_input++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
402
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
403 while( (model_size != 0) &&
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
404 (l1_srback_com.emergency_stop == FALSE) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
405 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
406 frame_size = SC_SR_MODEL_FRAME_SIZE;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
407 while ( (frame_size != 0) &&
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
408 (l1_srback_com.emergency_stop == FALSE) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
409 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
410 *RAM_address_output++ = *RAM_address_input++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
411 frame_size--;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
412 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
413 model_size--;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
414 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
415 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
416 #endif // SPEECH_RECO
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
417
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
418 #if (OP_RIV_AUDIO == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
419 #if (MELODY_E2 && FIR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
420 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
421 /*audio_background_melody_e2_download_instrument_manager()*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
422 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
423 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
424 /* Description: */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
425 /* ------------ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
426 /* This function is used to load/unload the instrument of */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
427 /* the melodies E2. */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
428 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
429 /* Starting messages: */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
430 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
431 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
432 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
433 /* Result messages (input): none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
434 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
435 /* Result messages (output): */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
436 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
437 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
438 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
439 /* Reset messages (input): none */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
440 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
441 /* Stop message (input): none. */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
442 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
443 /* Stop message (output): */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
444 /* L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
445 /* L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
446 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
447 /* Rem: to stop immediatly the instrument download flags */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
448 /* ---- is created: */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
449 /* l1a_l1s_com.melody0_e2_task.parameters.emergency_stop */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
450 /* l1a_l1s_com.melody1_e2_task.parameters.emergency_stop */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
451 /* */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
452 /*--------------------------------------------------------*/
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
453 void audio_background_melody_e2_download_instrument_manager(xSignalHeaderRec *msg)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
454 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
455 xSignalHeaderRec *confirm_msg;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
456 UWORD8 instrument_number, max_number_of_instrument, instrument_id, id;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
457 UWORD16 size;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
458 UWORD32 address;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
459
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
460 if (msg->SignalCode == L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
461 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
462 // Load the instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
463
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
464 // Init the first address
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
465 address = ( ((UWORD32)(l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_wave))
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
466 - SC_AUDIO_MCU_API_BEGIN_ADDRESS );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
467 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[0] =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
468 (API)( (address>>1) + SC_AUDIO_DSP_API_BEGIN_ADDRESS );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
469
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
470 // Download the instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
471 max_number_of_instrument = ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(msg->SigP))->number_of_instrument;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
472 for(instrument_number=0; instrument_number < max_number_of_instrument ; instrument_number++)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
473 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
474 // No instrument was previously download
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
475 if (audioback_melody_e2.number_of_user[instrument_number] == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
476 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
477 // load the insturment ID
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
478 instrument_id =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
479 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(msg->SigP))->waves_table_id[instrument_number];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
480
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
481 // Find if this instrument was already downloaded
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
482 id = 0;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
483 while ( (id < SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT) &&
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
484 ((instrument_id != audioback_melody_e2.instrument_id[id]) ||
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
485 (audioback_melody_e2.number_of_user[id] == 0)) )
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
486 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
487 id++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
488 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
489
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
490 if (id < SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
491 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
492 // This insturment was already downloaded
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
493 // copy the address of this instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
494 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[instrument_number] =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
495 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[id];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
496
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
497 // The size of this instrument is 0
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
498 audioback_melody_e2.instrument_size[instrument_number] = 0;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
499 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
500 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
501 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
502 // Load the customer instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
503 size = Cust_audio_melody_E2_load_instrument (
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
504 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(msg->SigP))->waves_table_id[instrument_number],
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
505 audioback_melody_e2.API_address,
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
506 audioback_melody_e2.allowed_size);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
507
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
508 // Added to stop the L1 in case of download error
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
509 if (size == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
510 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
511 // Send a message to stop the L1
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
512 /* send the stop command to the audio L1 */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
513 /* allocate the buffer for the message to the L1 */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
514 confirm_msg = os_alloc_sig(0);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
515 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
516
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
517 if (confirm_msg != NULL)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
518 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
519 /* send the stop command to the audio L1 */
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
520 if ( ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(confirm_msg->SigP))->melody_id == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
521 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
522 confirm_msg->SignalCode = MMI_MELODY0_E2_STOP_REQ;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
523 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
524 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
525 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
526 confirm_msg->SignalCode = MMI_MELODY1_E2_STOP_REQ;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
527 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
528 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
529 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
530 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
531 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
532
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
533 // Save the size of this instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
534 audioback_melody_e2.instrument_size[instrument_number] = size;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
535 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
536
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
537 // Update the Cust_audio_melody_E2_load_instrument argument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
538 audioback_melody_e2.API_address += audioback_melody_e2.instrument_size[instrument_number];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
539 audioback_melody_e2.allowed_size -= audioback_melody_e2.instrument_size[instrument_number];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
540
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
541 // Put the DSP address to the NDB API for the next instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
542 if (instrument_number < SC_AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT-1)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
543 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
544 address = ( ((UWORD32)(audioback_melody_e2.API_address))
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
545 - SC_AUDIO_MCU_API_BEGIN_ADDRESS );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
546
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
547 l1s_dsp_com.dsp_ndb_ptr->a_melody_e2_instrument_ptr[instrument_number + 1] =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
548 (API)( (address>>1) + SC_AUDIO_DSP_API_BEGIN_ADDRESS );
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
549 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
550
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
551 // Save the instrument ID
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
552 audioback_melody_e2.instrument_id[instrument_number] = instrument_id;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
553 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
554
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
555 // Increase the number of user of this instrument number
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
556 audioback_melody_e2.number_of_user[instrument_number]++;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
557 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
558
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
559 // Send the load confirmation message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
560 confirm_msg = os_alloc_sig(sizeof(T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON));
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
561 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
562
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
563 // Fill the parameter
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
564 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON *)(confirm_msg->SigP))->melody_id =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
565 ((T_L1_BACK_MELODY_E2_LOAD_INSTRUMENT_REQ *)(msg->SigP))->melody_id;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
566
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
567 confirm_msg->SignalCode = L1_BACK_MELODY_E2_LOAD_INSTRUMENT_CON;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
568
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
569 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
570 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
571 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
572 else
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
573 if (msg->SignalCode == L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
574 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
575 // Unload the instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
576 max_number_of_instrument = ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ *)(msg->SigP))->number_of_instrument;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
577 for(instrument_number = max_number_of_instrument; instrument_number > 0 ; instrument_number--)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
578 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
579 // Decrease the number of user of this instrument number
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
580 audioback_melody_e2.number_of_user[instrument_number-1]--;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
581
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
582 // Check if the instrument must be removed
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
583 if (audioback_melody_e2.number_of_user[instrument_number-1] == 0)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
584 {
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
585 // Increase the size and decrease the pointer to the API with the size
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
586 // of the removed instrument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
587 // Update the Cust_audio_melody_E2_load_instrument argument
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
588 audioback_melody_e2.API_address -= audioback_melody_e2.instrument_size[instrument_number-1];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
589 audioback_melody_e2.allowed_size += audioback_melody_e2.instrument_size[instrument_number-1];
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
590 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
591 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
592
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
593 // Send the unload confirmation message
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
594 confirm_msg = os_alloc_sig(sizeof(T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON));
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
595 DEBUGMSG(status,NU_ALLOC_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
596
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
597 // Fill the paramter
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
598 ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON *)(confirm_msg->SigP))->melody_id =
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
599 ((T_L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_REQ *)(msg->SigP))->melody_id;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
600
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
601 confirm_msg->SignalCode = L1_BACK_MELODY_E2_UNLOAD_INSTRUMENT_CON;
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
602
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
603 os_send_sig(confirm_msg, L1C1_QUEUE);
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
604 DEBUGMSG(status,NU_SEND_QUEUE_ERR)
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
605 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
606 }
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
607 #endif // MELODY_E2
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
608 #endif // OP_RIV_AUDIO
dab163da789a l1audio_back.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
609 #endif // AUDIO_TASK == 1 && L1_AUDIO_BACKGROUND_TASK