Home | History | Annotate | Download | only in src
      1 /*---------------------------------------------------------------------------*
      2  *  AcousticState.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 "SR_Recognizer.h"
     21 #include "SR_RecognizerImpl.h"
     22 #include "plog.h"
     23 #include "pmemory.h"
     24 
     25 SREC_ACOUSTICSTATE_API ESR_ReturnCode SR_AcousticStateReset(SR_Recognizer* recognizer)
     26 {
     27   SR_RecognizerImpl* impl;
     28 
     29   if (recognizer == NULL)
     30   {
     31     PLogError(L("ESR_INVALID_ARGUMENT"));
     32     return ESR_INVALID_ARGUMENT;
     33   }
     34   impl = (SR_RecognizerImpl*) recognizer;
     35 
     36   return impl->acousticState->reset(recognizer);
     37 }
     38 
     39 SREC_ACOUSTICSTATE_API ESR_ReturnCode SR_AcousticStateLoad(SR_Recognizer* recognizer, const LCHAR* filename)
     40 {
     41   SR_RecognizerImpl* impl;
     42 
     43   if (recognizer == NULL)
     44   {
     45     PLogError(L("ESR_INVALID_ARGUMENT"));
     46     return ESR_INVALID_ARGUMENT;
     47   }
     48   impl = (SR_RecognizerImpl*) recognizer;
     49 
     50   return impl->acousticState->load(recognizer, filename);
     51 }
     52 
     53 SREC_ACOUSTICSTATE_API ESR_ReturnCode SR_AcousticStateSave(SR_Recognizer* recognizer, const LCHAR* filename)
     54 {
     55   SR_RecognizerImpl* impl;
     56 
     57   if (recognizer == NULL)
     58   {
     59     PLogError(L("ESR_INVALID_ARGUMENT"));
     60     return ESR_INVALID_ARGUMENT;
     61   }
     62   impl = (SR_RecognizerImpl*) recognizer;
     63 
     64   return impl->acousticState->save(recognizer, filename);
     65 }
     66 
     67 
     68 SREC_ACOUSTICSTATE_API ESR_ReturnCode SR_AcousticStateSet ( SR_Recognizer* recognizer, const LCHAR *param_string )
     69 {
     70   SR_RecognizerImpl* impl;
     71 
     72   if (recognizer == NULL)
     73   {
     74     PLogError(L("ESR_INVALID_ARGUMENT"));
     75     return ESR_INVALID_ARGUMENT;
     76   }
     77   impl = (SR_RecognizerImpl*) recognizer;
     78 
     79   return impl->acousticState->set ( recognizer, param_string );
     80 }
     81 
     82 
     83 SREC_ACOUSTICSTATE_API ESR_ReturnCode SR_AcousticStateGet ( SR_Recognizer* recognizer, LCHAR *param_string, size_t* len )
     84 {
     85   SR_RecognizerImpl* impl;
     86 
     87   if (recognizer == NULL)
     88   {
     89     PLogError(L("ESR_INVALID_ARGUMENT"));
     90     return ESR_INVALID_ARGUMENT;
     91   }
     92   impl = (SR_RecognizerImpl*) recognizer;
     93 
     94   return impl->acousticState->get ( recognizer, param_string, len );
     95 }
     96 
     97 
     98