1 /*---------------------------------------------------------------------------*
2 * rec_load.c *
3 * *
4 * Copyright 2007, 2008 Nuance Communciations, Inc. *
5 * *
6 * Licensed under the Apache License, Version 2.0 (the 'License'); *
7 * you may not use this file except in compliance with the License. *
8 * *
9 * You may obtain a copy of the License at *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, software *
13 * distributed under the License is distributed on an 'AS IS' BASIS, *
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 * See the License for the specific language governing permissions and *
16 * limitations under the License. *
17 * *
18 *---------------------------------------------------------------------------*/
19
20 #include <stdlib.h>
21 #include <string.h>
22 #ifndef _RTT
23 #include <stdio.h>
24 #endif
25
26 #ifdef unix
27 #include <unistd.h>
28 #endif
29 #include <assert.h>
30
31 #ifndef _RTT
32 #include "duk_io.h"
33 #endif
34
35 #include "simapi.h"
36 #include "portable.h"
37
38 #define CROSSWORD 1
39
40 static const char rec_load[] = "$Id: rec_load.c,v 1.8.6.7 2007/10/15 18:06:24 dahan Exp $";
41
42
CA_LoadModelsInAcoustic(CA_Recog * hRecog,CA_Acoustic * hAcoust,CA_AcoustInputParams * hAcoustInp)43 void CA_LoadModelsInAcoustic(CA_Recog *hRecog, CA_Acoustic *hAcoust,
44 CA_AcoustInputParams *hAcoustInp)
45 {
46 int rc;
47 TRY_CA_EXCEPT
48 ASSERT(hRecog);
49 ASSERT(hAcoust);
50 ASSERT(hAcoustInp);
51
52 if (hAcoust->is_loaded == False)
53 SERVICE_ERROR(ACOUSTIC_NOT_LOADED);
54 if (hAcoustInp->is_loaded == False)
55 SERVICE_ERROR(ACOUSTIC_INPUT_NOT_LOADED);
56 // returns 1 for OK, 0 if not OK
57 rc = add_acoustic_model_for_recognition(hRecog->recm, hAcoust->swimodel);
58 return;
59
60 BEG_CATCH_CA_EXCEPT
61 END_CATCH_CA_EXCEPT(hRecog)
62 }
63
64
CA_UnloadRecognitionModels(CA_Recog * hRecog)65 void CA_UnloadRecognitionModels(CA_Recog *hRecog)
66 {
67 TRY_CA_EXCEPT
68 int rc;
69 rc = clear_acoustic_models_for_recognition(hRecog->recm);
70 BEG_CATCH_CA_EXCEPT
71 END_CATCH_CA_EXCEPT(hRecog)
72 }
73