1 /*
2  * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  * @file picodefs.h
18  *
19  * SVOX Pico definitions
20  * (SVOX Pico version 1.0 and later)
21  *
22  * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
23  * All rights reserved.
24  *
25  * History:
26  * - 2009-04-20 -- initial version
27  */
28 
29 
30 #ifndef PICODEFS_H_
31 #define PICODEFS_H_
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /* ********************************************************************/
39 /* SVOX Pico limits                                                   */
40 /* ********************************************************************/
41 /* maximum size of a voice name, including the terminating null
42    character */
43 #define PICO_MAX_VOICE_NAME_SIZE        32
44 
45 /* maximum size of a resource name, incl. the terminating null
46    character */
47 #define PICO_MAX_RESOURCE_NAME_SIZE     32
48 
49 /* maximum size of a data path name, incl. the terminating null
50    character */
51 #define PICO_MAX_DATAPATH_NAME_SIZE    128
52 
53 /* maximum size of a file name, incl. the terminating null
54    character */
55 #define PICO_MAX_FILE_NAME_SIZE         64
56 
57 /* maximum number of resources */
58 #define PICO_MAX_NUM_RESOURCES          64
59 
60 /* maximum number of voice definitions */
61 #define PICO_MAX_NUM_VOICE_DEFINITIONS  64
62 
63 /* maximum number of resources per voice */
64 #define PICO_MAX_NUM_RSRC_PER_VOICE     16
65 
66 /* maximum length of foreign header prepended to PICO resource files
67    (header length must be a multiple of 4 bytes) */
68 #define PICO_MAX_FOREIGN_HEADER_LEN     64
69 
70 
71 
72 /* ********************************************************************/
73 /* SVOX PICO status codes                                             */
74 /* ********************************************************************/
75 
76 typedef signed int pico_Status;
77 
78 
79 /* Okay ***************************************************************/
80 /* functions return PICO_OK if all is okay */
81 
82 #define PICO_OK                         (pico_Status)     0
83 
84 
85 /* Exceptions and error codes *****************************************/
86 
87 /* in case of exceptional events and errors (e.g. unexpected user
88    input) that disrupt the normal flow of operation, PICO_EXC_* or
89    PICO_ERR_* are returned. */
90 
91 #define PICO_EXC_NUMBER_FORMAT          (pico_Status)   -10
92 #define PICO_EXC_MAX_NUM_EXCEED         (pico_Status)   -11
93 #define PICO_EXC_NAME_CONFLICT          (pico_Status)   -12
94 #define PICO_EXC_NAME_UNDEFINED         (pico_Status)   -13
95 #define PICO_EXC_NAME_ILLEGAL           (pico_Status)   -14
96 
97 /* buffer interaction */
98 #define PICO_EXC_BUF_OVERFLOW           (pico_Status)   -20
99 #define PICO_EXC_BUF_UNDERFLOW          (pico_Status)   -21
100 #define PICO_EXC_BUF_IGNORE             (pico_Status)   -22
101 
102 /* internal memory handling */
103 #define PICO_EXC_OUT_OF_MEM             (pico_Status)   -30
104 
105 /* files */
106 #define PICO_EXC_CANT_OPEN_FILE         (pico_Status)   -40
107 #define PICO_EXC_UNEXPECTED_FILE_TYPE   (pico_Status)   -41
108 #define PICO_EXC_FILE_CORRUPT           (pico_Status)   -42
109 #define PICO_EXC_FILE_NOT_FOUND         (pico_Status)   -43
110 
111 /* resources */
112 #define PICO_EXC_RESOURCE_BUSY          (pico_Status)   -50
113 #define PICO_EXC_RESOURCE_MISSING       (pico_Status)   -51
114 
115 /* knowledge bases */
116 #define PICO_EXC_KB_MISSING             (pico_Status)   -60
117 
118 /* runtime exceptions */
119 #define PICO_ERR_NULLPTR_ACCESS         (pico_Status)  -100
120 #define PICO_ERR_INVALID_HANDLE         (pico_Status)  -101
121 #define PICO_ERR_INVALID_ARGUMENT       (pico_Status)  -102
122 #define PICO_ERR_INDEX_OUT_OF_RANGE     (pico_Status)  -103
123 
124 /* other errors ("external" errors, e.g. hardware failure). */
125 #define PICO_ERR_OTHER                  (pico_Status)  -999
126 
127 
128 /* Warnings ***********************************************************/
129 
130 /* general */
131 #define PICO_WARN_INCOMPLETE            (pico_Status)    10
132 #define PICO_WARN_FALLBACK              (pico_Status)    11
133 #define PICO_WARN_OTHER                 (pico_Status)    19
134 
135 /* resources */
136 #define PICO_WARN_KB_OVERWRITE          (pico_Status)    50
137 #define PICO_WARN_RESOURCE_DOUBLE_LOAD  (pico_Status)    51
138 
139 /* classifiers */
140 #define PICO_WARN_INVECTOR              (pico_Status)    60
141 #define PICO_WARN_CLASSIFICATION        (pico_Status)    61
142 #define PICO_WARN_OUTVECTOR             (pico_Status)    62
143 
144 /* processing units */
145 #define PICO_WARN_PU_IRREG_ITEM         (pico_Status)    70
146 #define PICO_WARN_PU_DISCARD_BUF        (pico_Status)    71
147 
148 
149 
150 /* ********************************************************************/
151 /* Engine getData return values                                       */
152 /* ********************************************************************/
153 
154 #define PICO_STEP_IDLE                  (pico_Status)   200
155 #define PICO_STEP_BUSY                  (pico_Status)   201
156 
157 #define PICO_STEP_ERROR                 (pico_Status)  -200
158 
159 /* ********************************************************************/
160 /* resetEngine reset modes                                            */
161 /* ********************************************************************/
162 
163 #define PICO_RESET_FULL                                 0
164 #define PICO_RESET_SOFT                                 0x10
165 
166 
167 /* ********************************************************************/
168 /* Engine getData outDataType values                                  */
169 /* ********************************************************************/
170 
171 /* 16 bit PCM samples, native endianness of platform */
172 #define PICO_DATA_PCM_16BIT             (pico_Int16)  1
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 
179 #endif /*PICODEFS_H_*/
180