Julius 4.2
msvc/SampleApp/Julius.h
00001 
00011 #ifndef         _JULIUSCLASS_H_
00012 #define         _JULIUSCLASS_H_
00013 
00014 #include        "julius/juliuslib.h"
00015 #include        "locale.h"
00016 
00017 // for development codes: do not define this
00018 #undef APP_ADIN
00019 
00020 // Julius event identifier
00021 #define WM_JULIUS                       (WM_USER + 1)
00022 
00023 // Event ID
00024 enum {
00025         JEVENT_ENGINE_ACTIVE,
00026         JEVENT_ENGINE_INACTIVE,
00027         JEVENT_ENGINE_PAUSE,
00028         JEVENT_ENGINE_RESUME,
00029         JEVENT_AUDIO_READY,
00030         JEVENT_AUDIO_BEGIN,
00031         JEVENT_AUDIO_END,
00032         JEVENT_RECOG_BEGIN,
00033         JEVENT_RECOG_END,
00034         JEVENT_RECOG_FRAME,
00035         JEVENT_RESULT_FRAME,
00036         JEVENT_RESULT_PASS1,
00037         JEVENT_RESULT_FINAL,
00038         JEVENT_GRAM_UPDATE,
00039 };
00040 
00041 
00042 class cJulius
00043 {
00044         private :
00045                 Jconf                   *m_jconf;                       // Configuration parameter data
00046                 Recog                   *m_recog;                       // Engine instance
00047                 bool                    m_opened;
00048                 FILE                    *m_fpLogFile;
00049                 HANDLE                  m_threadHandle;
00050                 HWND                    m_hWnd;
00051                 _locale_t               m_modelLocale;
00052 #ifdef APP_ADIN
00053                 int                             m_appsource
00054 #endif
00055 
00056         public :
00057                 cJulius( void );
00058                 ~cJulius( void );
00059 
00060                 void setLogFile( const char *filename );
00061 
00062                 void setModelLocale( const char *locale );
00063                 _locale_t getModelLocale( void );
00064 
00065                 bool initialize( int argnum, char *argarray[] );
00066                 bool initialize( char *jconffile );
00067                 bool loadJconf( char *jconffile );
00068                 bool createEngine( void );
00069 
00070                 bool startProcess( HWND hWnd );
00071                 void stopProcess( void );
00072 
00073                 void pause( void );
00074                 void resume( void );
00075 
00076                 bool loadGrammar( WORD_INFO *winfo, DFA_INFO *dfa, char *dictfile, char *dfafile, RecogProcess *r );
00077                 bool addGrammar( char *name, char *dictfile, char *dfafile, bool deleteAll = false );
00078                 bool changeGrammar( char *name, char *dictfile, char *dfafile );
00079                 bool deleteGrammar( char *name );
00080                 bool deactivateGrammar( char *name );
00081                 bool activateGrammar( char *name );
00082 
00083                 inline HWND getWindow( void ) { return m_hWnd; };
00084                 inline Recog *getRecog( void ) { return m_recog; };
00085                 inline HANDLE getThreadHandle( void ) { return m_threadHandle; };
00086 
00087                 void release( void );
00088 };
00089 
00090 #endif