annotate gsm-fw/L1/audio_cfile/l1audio_back.c @ 1034:405b5469abc4 default tip

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