[Julius-cvs 477] CVS update: julius4/msvc/SampleApp

Zurück zum Archiv-Index

sumom****@users***** sumom****@users*****
2009年 10月 23日 (金) 09:29:00 JST


Index: julius4/msvc/SampleApp/Julius.cpp
diff -u julius4/msvc/SampleApp/Julius.cpp:1.2 julius4/msvc/SampleApp/Julius.cpp:1.3
--- julius4/msvc/SampleApp/Julius.cpp:1.2	Thu Oct 22 20:02:41 2009
+++ julius4/msvc/SampleApp/Julius.cpp	Fri Oct 23 09:29:00 2009
@@ -336,6 +336,9 @@
 //==================================================
 void cJulius::stopProcess( void )
 {
+
+	if ( ! m_recog ) return;
+
 	if (m_opened) {
 		// recognition thread will exit when audio input is closed
 		j_close_stream(m_recog);
@@ -348,6 +351,7 @@
 //===================
 void cJulius::pause( void )
 {
+	if ( ! m_recog ) return;
 	// request library to pause
 	// After pause, the recognition thread will issue pause event
 	// and then enter callback_wait_for_resume(), where thread will pause.
@@ -359,6 +363,7 @@
 //====================
 void cJulius::resume( void )
 {
+	if ( ! m_recog ) return;
 	// request library to resume
 	j_request_resume(m_recog);
 	// resume the recognition thread
@@ -372,6 +377,8 @@
 {
 	boolean ret;
 
+	if ( ! m_recog ) return false;
+
 	// load grammar
 	switch( r->lmvar ) {
 	case LM_DFA_WORD:
@@ -406,9 +413,13 @@
 {
 	WORD_INFO *winfo;
 	DFA_INFO *dfa;
-	RecogProcess *r = m_recog->process_list;
+	RecogProcess *r;
 	boolean ret;
 
+	if ( ! m_recog ) return false;
+
+	r = m_recog->process_list;
+
 	// load grammar
 	switch( r->lmvar ) {
 	case LM_DFA_WORD:
@@ -452,6 +463,7 @@
 //==============
 bool cJulius::changeGrammar( char *name, char *dictfile, char *dfafile )
 {
+	if ( ! m_recog ) return false;
 	return addGrammar(name, dictfile, dfafile, true);
 }
 
@@ -460,9 +472,13 @@
 //============================
 bool cJulius::deleteGrammar( char *name )
 {
-	RecogProcess *r = m_recog->process_list;
+	RecogProcess *r;
 	int gid;
 
+	if ( ! m_recog ) return false;
+
+	r = m_recog->process_list;
+
 	gid = multigram_get_id_by_name(r->lm, name);
 	if (gid == -1) return false;
 
@@ -483,10 +499,14 @@
 //================================
 bool cJulius::deactivateGrammar( char *name )
 {
-	RecogProcess *r = m_recog->process_list;
+	RecogProcess *r;
 	int gid;
 	int ret;
 
+	if ( ! m_recog ) return false;
+
+	r = m_recog->process_list;
+
 	gid = multigram_get_id_by_name(r->lm, name);
 	if (gid == -1) return false;
 
@@ -510,10 +530,14 @@
 //=================================
 bool cJulius::activateGrammar( char *name )
 {
-	RecogProcess *r = m_recog->process_list;
+	RecogProcess *r;
 	int gid;
 	int ret;
 
+	if ( ! m_recog ) return false;
+
+	r = m_recog->process_list;
+
 	gid = multigram_get_id_by_name(r->lm, name);
 	if (gid == -1) return false;
 
@@ -537,6 +561,9 @@
 //=====================================
 void cJulius::release( void )
 {
+
+	if ( ! m_recog ) return;
+
 	stopProcess();
 
 	if (m_threadHandle) {



Julius-cvs メーリングリストの案内
Zurück zum Archiv-Index