diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-17 14:20:48 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-17 14:20:48 -0700 |
commit | 7bc39b0d41efe0d8733490d54e14bc392d9f0b6d (patch) | |
tree | db46c91063b1d9ca27c4618c9262a1fd09014c94 /pico | |
parent | a2301be089f8ed570c5bb755ff7c82b130959851 (diff) | |
download | external_svox-7bc39b0d41efe0d8733490d54e14bc392d9f0b6d.zip external_svox-7bc39b0d41efe0d8733490d54e14bc392d9f0b6d.tar.gz external_svox-7bc39b0d41efe0d8733490d54e14bc392d9f0b6d.tar.bz2 |
Integrate SVOX update that offers two modes to reset the engine: soft
and full. Soft reset is lighter-weight than the previous pico_resetEngine()
function as it only clears the input (text) and output (audio data)
buffers of the synthesis engine.
The synthesis loop is now taking advantage of the soft reset whenever
it is interrupted, rather than performing a full engine reset after
each call to stop().
Diffstat (limited to 'pico')
-rw-r--r-- | pico/lib/picoacph.c | 9 | ||||
-rw-r--r-- | pico/lib/picoapi.c | 10 | ||||
-rw-r--r-- | pico/lib/picoapi.h | 5 | ||||
-rw-r--r-- | pico/lib/picocep.c | 50 | ||||
-rw-r--r-- | pico/lib/picoctrl.c | 8 | ||||
-rw-r--r-- | pico/lib/picoctrl.h | 4 | ||||
-rw-r--r-- | pico/lib/picodata.c | 2 | ||||
-rw-r--r-- | pico/lib/picodata.h | 2 | ||||
-rw-r--r-- | pico/lib/picodefs.h | 5 | ||||
-rw-r--r-- | pico/lib/picopam.c | 13 | ||||
-rw-r--r-- | pico/lib/picopr.c | 13 | ||||
-rw-r--r-- | pico/lib/picosa.c | 9 | ||||
-rw-r--r-- | pico/lib/picosig.c | 63 | ||||
-rw-r--r-- | pico/lib/picosig2.c | 21 | ||||
-rw-r--r-- | pico/lib/picosig2.h | 2 | ||||
-rw-r--r-- | pico/lib/picospho.c | 4 | ||||
-rw-r--r-- | pico/lib/picotok.c | 8 | ||||
-rw-r--r-- | pico/lib/picowa.c | 8 | ||||
-rw-r--r-- | pico/tts/com_svox_picottsengine.cpp | 8 |
19 files changed, 155 insertions, 89 deletions
diff --git a/pico/lib/picoacph.c b/pico/lib/picoacph.c index 98feb6e..c06e860 100644 --- a/pico/lib/picoacph.c +++ b/pico/lib/picoacph.c @@ -157,7 +157,7 @@ typedef struct acph_subobj { } acph_subobj_t; -static pico_status_t acphInitialize(register picodata_ProcessingUnit this) { +static pico_status_t acphInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { acph_subobj_t * acph; picoos_uint16 i; @@ -193,6 +193,11 @@ static pico_status_t acphInitialize(register picodata_ProcessingUnit this) { acph->cbuf[i] = 0; } + if (r_mode == PICO_RESET_SOFT) { + /*following initializations needed only at startup or after a full reset*/ + return PICO_OK; + } + /* kb tabphones */ acph->tabphones = picoktab_getPhones(this->voice->kbArray[PICOKNOW_KBID_TAB_PHONES]); @@ -310,7 +315,7 @@ picodata_ProcessingUnit picoacph_newAccPhrUnit(picoos_MemoryManager mm, return NULL; } - acphInitialize(this); + acphInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/lib/picoapi.c b/pico/lib/picoapi.c index c4ef8bf..affd780 100644 --- a/pico/lib/picoapi.c +++ b/pico/lib/picoapi.c @@ -660,13 +660,15 @@ PICO_FUNC pico_getData( /** * pico_resetEngine : Resets the engine * @param engine : pointer to a Pico engine handle + * @param r_mode : reset mode * @return PICO_OK : successful * @return PICO_ERR_INVALID_HANDLE, PICO_ERR_NULLPTR_ACCESS : errors * @callgraph * @callergraph */ PICO_FUNC pico_resetEngine( - pico_Engine engine) + pico_Engine engine, + pico_Status r_mode) { pico_Status status = PICO_OK; @@ -674,7 +676,11 @@ PICO_FUNC pico_resetEngine( status = PICO_ERR_INVALID_HANDLE; } else { picoctrl_engResetExceptionManager((picoctrl_Engine) engine); - status = picoctrl_engReset((picoctrl_Engine) engine); + + if (r_mode<PICO_RESET_FULL) r_mode = PICO_RESET_FULL; + if (r_mode>PICO_RESET_SOFT) r_mode = PICO_RESET_FULL; + + status = picoctrl_engReset((picoctrl_Engine) engine, (picoos_int32)r_mode); } return status; diff --git a/pico/lib/picoapi.h b/pico/lib/picoapi.h index 0dad702..8a5725b 100644 --- a/pico/lib/picoapi.h +++ b/pico/lib/picoapi.h @@ -422,8 +422,9 @@ PICO_FUNC pico_getData( particular text input and signal data output buffers. */ PICO_FUNC pico_resetEngine( - pico_Engine engine - ); + pico_Engine engine, + pico_Status r_mode +); /* Engine status and error/warning message retrieval ******************/ diff --git a/pico/lib/picocep.c b/pico/lib/picocep.c index 2510c13..bb80c3d 100644 --- a/pico/lib/picocep.c +++ b/pico/lib/picocep.c @@ -285,7 +285,7 @@ static picodata_step_result_t cepStep(register picodata_ProcessingUnit this, * @callgraph * @callergraph */ -static pico_status_t cepInitialize(register picodata_ProcessingUnit this) +static pico_status_t cepInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { /*pico_status_t nRes;*/ cep_subobj_t * cep; @@ -328,35 +328,37 @@ static pico_status_t cepInitialize(register picodata_ProcessingUnit this) ------------------------------------------------------------------*/ cep->activeEndPos = PICOCEP_MAXWINLEN; - /* kb pdflfz */ - cep->pdflfz = picokpdf_getPdfMUL( - this->voice->kbArray[PICOKNOW_KBID_PDF_LFZ]); + if (r_mode == PICO_RESET_FULL) { + /* kb pdflfz */ + cep->pdflfz = picokpdf_getPdfMUL( + this->voice->kbArray[PICOKNOW_KBID_PDF_LFZ]); - /* kb pdfmgc */ - cep->pdfmgc = picokpdf_getPdfMUL( - this->voice->kbArray[PICOKNOW_KBID_PDF_MGC]); + /* kb pdfmgc */ + cep->pdfmgc = picokpdf_getPdfMUL( + this->voice->kbArray[PICOKNOW_KBID_PDF_MGC]); - /* kb tab phones */ - /* cep->phones = - picoktab_getPhones(this->voice->kbArray[PICOKNOW_KBID_TAB_PHONES]); */ + /* kb tab phones */ + /* cep->phones = + picoktab_getPhones(this->voice->kbArray[PICOKNOW_KBID_TAB_PHONES]); */ - /*---------------------- other working variables ---------------------------*/ - /* define the (constant) FRAME_PAR item header */ - cep->framehead.type = PICODATA_ITEM_FRAME_PAR; - cep->framehead.info1 = PICOCEP_OUT_DATA_FORMAT; - cep->framehead.info2 = cep->pdfmgc->ceporder; - cep->framehead.len = sizeof(picoos_uint16) + (cep->framehead.info2 + 4) - * sizeof(picoos_uint16); + /*---------------------- other working variables ---------------------------*/ + /* define the (constant) FRAME_PAR item header */ + cep->framehead.type = PICODATA_ITEM_FRAME_PAR; + cep->framehead.info1 = PICOCEP_OUT_DATA_FORMAT; + cep->framehead.info2 = cep->pdfmgc->ceporder; + cep->framehead.len = sizeof(picoos_uint16) + (cep->framehead.info2 + 4) + * sizeof(picoos_uint16); + cep->scmeanpowLFZ = cep->pdflfz->bigpow - cep->pdflfz->meanpow; + cep->scmeanpowMGC = cep->pdfmgc->bigpow - cep->pdfmgc->meanpow; - /* constants used in makeWUWandWUm */ - initSmoothing(cep); + cep->scmeanLFZ = (1 << (picoos_uint32) cep->scmeanpowLFZ); - cep->scmeanpowLFZ = cep->pdflfz->bigpow - cep->pdflfz->meanpow; - cep->scmeanpowMGC = cep->pdfmgc->bigpow - cep->pdfmgc->meanpow; + cep->scmeanMGC = (1 << (picoos_uint32) cep->scmeanpowMGC); - cep->scmeanLFZ = (1 << (picoos_uint32) cep->scmeanpowLFZ); + } + /* constants used in makeWUWandWUm */ + initSmoothing(cep); - cep->scmeanMGC = (1 << (picoos_uint32) cep->scmeanpowMGC); return PICO_OK; }/*cepInitialize*/ @@ -461,7 +463,7 @@ picodata_ProcessingUnit picocep_newCepUnit(picoos_MemoryManager mm, picoos_deallocate(mm, (void*) &this); return NULL; } - cepInitialize(this); + cepInitialize(this, PICO_RESET_FULL); return this; }/*picocep_newCepUnit*/ diff --git a/pico/lib/picoctrl.c b/pico/lib/picoctrl.c index 5af70e3..25550f2 100644 --- a/pico/lib/picoctrl.c +++ b/pico/lib/picoctrl.c @@ -90,7 +90,7 @@ typedef struct ctrl_subobj { * @callgraph * @callergraph */ -static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this) { +static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { register ctrl_subobj_t * ctrl; pico_status_t status= PICO_OK; picoos_int8 i; @@ -104,7 +104,7 @@ static pico_status_t ctrlInitialize(register picodata_ProcessingUnit this) { status = PICO_OK; for (i = 0; i < ctrl->numProcUnits; i++) { if (PICO_OK == status) { - status = ctrl->procUnit[i]->initialize(ctrl->procUnit[i]); + status = ctrl->procUnit[i]->initialize(ctrl->procUnit[i], r_mode); PICODBG_DEBUG(("(re-)initializing procUnit[%i] returned status %i",i, status)); } if (PICO_OK == status) { @@ -521,7 +521,7 @@ typedef struct picoctrl_engine { * @callgraph * @callergraph */ -pico_status_t picoctrl_engReset(picoctrl_Engine this) +pico_status_t picoctrl_engReset(picoctrl_Engine this, picoos_int32 r_mode) { pico_status_t status; @@ -532,7 +532,7 @@ pico_status_t picoctrl_engReset(picoctrl_Engine this) status = this->control->terminate(this->control); if (PICO_OK == status) { - status = this->control->initialize(this->control); + status = this->control->initialize(this->control, r_mode); } if (PICO_OK == status) { status = picodata_cbReset(this->cbIn); diff --git a/pico/lib/picoctrl.h b/pico/lib/picoctrl.h index 1dfea54..ff85d5a 100644 --- a/pico/lib/picoctrl.h +++ b/pico/lib/picoctrl.h @@ -69,8 +69,8 @@ pico_status_t picoctrl_engFeedText( picoos_int16 * bytesPut); pico_status_t picoctrl_engReset( - picoctrl_Engine engine - ); + picoctrl_Engine engine, + picoos_int32 r_mode); picoos_Common picoctrl_engGetCommon(picoctrl_Engine this); diff --git a/pico/lib/picodata.c b/pico/lib/picodata.c index 244e4b6..b886959 100644 --- a/pico/lib/picodata.c +++ b/pico/lib/picodata.c @@ -574,7 +574,7 @@ typedef struct simple_pu_data picorsrc_Voice voice; } simple_pu_data_t; -static pico_status_t puSimpleInitialize (register picodata_ProcessingUnit this) { +static pico_status_t puSimpleInitialize (register picodata_ProcessingUnit this, picoos_int32 r_mode) { return PICO_OK; } diff --git a/pico/lib/picodata.h b/pico/lib/picodata.h index 637a3ff..2105051 100644 --- a/pico/lib/picodata.h +++ b/pico/lib/picodata.h @@ -498,7 +498,7 @@ pico_status_t picodata_setCbIn(picodata_ProcessingUnit this, picodata_CharBuffer pico_status_t picodata_setCbOut(picodata_ProcessingUnit this, picodata_CharBuffer cbOut); /* protected */ -typedef pico_status_t (* picodata_puInitializeMethod) (register picodata_ProcessingUnit this); +typedef pico_status_t (* picodata_puInitializeMethod) (register picodata_ProcessingUnit this, picoos_int32 mode); typedef pico_status_t (* picodata_puTerminateMethod) (register picodata_ProcessingUnit this); typedef picodata_step_result_t (* picodata_puStepMethod) (register picodata_ProcessingUnit this, picoos_int16 mode, picoos_uint16 * numBytesOutput); typedef pico_status_t (* picodata_puSubDeallocateMethod) (register picodata_ProcessingUnit this, picoos_MemoryManager mm); diff --git a/pico/lib/picodefs.h b/pico/lib/picodefs.h index 6613e84..8c24039 100644 --- a/pico/lib/picodefs.h +++ b/pico/lib/picodefs.h @@ -156,6 +156,11 @@ typedef signed int pico_Status; #define PICO_STEP_ERROR (pico_Status) -200 +/* Engine reset modes ***********************************************************/ + +/* general */ +#define PICO_RESET_FULL (pico_Status) 0 +#define PICO_RESET_SOFT (pico_Status) 0x10 /* ********************************************************************/ diff --git a/pico/lib/picopam.c b/pico/lib/picopam.c index 02e5cc2..f3253a6 100644 --- a/pico/lib/picopam.c +++ b/pico/lib/picopam.c @@ -386,7 +386,7 @@ typedef struct pam_subobj /*------------------------------------------------------------------ Service routines : ------------------------------------------------------------------*/ -static pico_status_t pam_initialize(register picodata_ProcessingUnit this); +static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 r_mode); static pico_status_t pam_terminate(register picodata_ProcessingUnit this); static pico_status_t pam_allocate(picoos_MemoryManager mm, pam_subobj_t *pam); static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam); @@ -556,7 +556,7 @@ static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam) * @callgraph * @callergraph */ -static pico_status_t pam_initialize(register picodata_ProcessingUnit this) +static pico_status_t pam_initialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { pico_status_t nI, nJ; pam_subobj_t *pam; @@ -599,6 +599,11 @@ static pico_status_t pam_initialize(register picodata_ProcessingUnit this) pam->nLastAttachedItemId = pam->nCurrAttachedItem = 0; pam->nAttachedItemsSize = 0; + if (r_mode == PICO_RESET_SOFT) { + /*following initializations needed only at startup or after a full reset*/ + return PICO_OK; + } + /*pitch and duration modifiers*/ pam->pMod = 1.0f; pam->dMod = 1.0f; @@ -621,6 +626,8 @@ static pico_status_t pam_initialize(register picodata_ProcessingUnit this) } } } + + /*----------------------------------------------------------------- * MANAGE LINGWARE INITIALIZATION IF NEEDED ------------------------------------------------------------------*/ @@ -813,7 +820,7 @@ picodata_ProcessingUnit picopam_newPamUnit(picoos_MemoryManager mm, /*----------------------------------------------------------------- * Initialize memory for PAM (this may be re-used elsewhere, e.g.Reset) * ------------------------------------------------------------------*/ - if (PICO_OK != pam_initialize(this)) { + if (PICO_OK != pam_initialize(this, PICO_RESET_FULL)) { PICODBG_ERROR(("problem initializing the pam sub-object")); } return this; diff --git a/pico/lib/picopr.c b/pico/lib/picopr.c index f54734a..d5371d7 100644 --- a/pico/lib/picopr.c +++ b/pico/lib/picopr.c @@ -3168,8 +3168,9 @@ extern void pr_treatItem (picodata_ProcessingUnit this, pr_subobj_t * pr, pr_ioI /* *****************************************************************************/ -pico_status_t prReset(register picodata_ProcessingUnit this) +pico_status_t prReset(register picodata_ProcessingUnit this, picoos_int32 r_mode) { + picoos_int32 i; pr_subobj_t * pr; @@ -3226,6 +3227,10 @@ pico_status_t prReset(register picodata_ProcessingUnit this) pr->forceOutput = FALSE; + if (r_mode == PICO_RESET_SOFT) { + /*following initializations needed only at startup or after a full reset*/ + return PICO_OK; + } pr->xsampa_parser = picokfst_getFST(this->voice->kbArray[PICOKNOW_KBID_FST_XSAMPA_PARSE]); @@ -3239,14 +3244,14 @@ pico_status_t prReset(register picodata_ProcessingUnit this) } -pico_status_t prInitialize(register picodata_ProcessingUnit this) +pico_status_t prInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { /* if (NULL == this || NULL == this->subObj) { return PICO_ERR_OTHER; } */ - return prReset(this); + return prReset(this, r_mode); } @@ -3314,7 +3319,7 @@ picodata_ProcessingUnit picopr_newPreprocUnit(picoos_MemoryManager mm, picoos_Co picoos_deallocate(mm, (void *)&this); return NULL; } - prInitialize(this); + prInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/lib/picosa.c b/pico/lib/picosa.c index 3147c76..ab48713 100644 --- a/pico/lib/picosa.c +++ b/pico/lib/picosa.c @@ -242,7 +242,7 @@ typedef struct sa_subobj { } sa_subobj_t; -static pico_status_t saInitialize(register picodata_ProcessingUnit this) { +static pico_status_t saInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { sa_subobj_t * sa; picoos_uint16 i; picokfst_FST fst; @@ -294,6 +294,11 @@ static pico_status_t saInitialize(register picodata_ProcessingUnit this) { sa->phonWritePos = 0; sa->nextReadPos = 0; + if (r_mode == PICO_RESET_SOFT) { + /*following initializations needed only at startup or after a full reset*/ + return PICO_OK; + } + /* kb fst[] */ sa->numFsts = 0; for (i = 0; i<PICOKNOW_MAX_NUM_WPHO_FSTS; i++) { @@ -471,7 +476,7 @@ picodata_ProcessingUnit picosa_newSentAnaUnit(picoos_MemoryManager mm, } - saInitialize(this); + saInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/lib/picosig.c b/pico/lib/picosig.c index be44b3c..4282e24 100644 --- a/pico/lib/picosig.c +++ b/pico/lib/picosig.c @@ -114,7 +114,7 @@ typedef struct sig_subobj * @callgraph * @callergraph */ -static pico_status_t sigInitialize(register picodata_ProcessingUnit this) +static pico_status_t sigInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { sig_subobj_t *sig_subObj; if (NULL == this || NULL == this->subObj) { @@ -147,33 +147,40 @@ static pico_status_t sigInitialize(register picodata_ProcessingUnit this) /*----------------------------------------------------------------- * MANAGE LINGWARE INITIALIZATION IF NEEDED ------------------------------------------------------------------*/ - sig_subObj->pdfmgc = picokpdf_getPdfMUL( - this->voice->kbArray[PICOKNOW_KBID_PDF_MGC]); - sig_subObj->pdflfz = picokpdf_getPdfMUL( - this->voice->kbArray[PICOKNOW_KBID_PDF_LFZ]); - sig_subObj->pdfphs = picokpdf_getPdfPHS( - this->voice->kbArray[PICOKNOW_KBID_PDF_PHS]); - - sig_subObj->scmeanpowLFZ = sig_subObj->pdflfz->bigpow - - sig_subObj->pdflfz->meanpow; - sig_subObj->scmeanpowMGC = sig_subObj->pdfmgc->bigpow - - sig_subObj->pdfmgc->meanpow; - sig_subObj->scmeanLFZ = (1 << (picoos_uint32) sig_subObj->scmeanpowLFZ); - sig_subObj->scmeanMGC = (1 << (picoos_uint32) sig_subObj->scmeanpowMGC); - sig_subObj->fSampNorm = PICOSIG_NORM1 * sig_subObj->pdfmgc->amplif; - - /*----------------------------------------------------------------- - * Initialize memory for DSP - * ------------------------------------------------------------------*/ - sigDspInitialize(&(sig_subObj->sig_inner)); + if (r_mode == PICO_RESET_FULL) { + /*not done when resetting SOFT*/ + sig_subObj->pdfmgc = picokpdf_getPdfMUL( + this->voice->kbArray[PICOKNOW_KBID_PDF_MGC]); + sig_subObj->pdflfz = picokpdf_getPdfMUL( + this->voice->kbArray[PICOKNOW_KBID_PDF_LFZ]); + sig_subObj->pdfphs = picokpdf_getPdfPHS( + this->voice->kbArray[PICOKNOW_KBID_PDF_PHS]); + + sig_subObj->scmeanpowLFZ = sig_subObj->pdflfz->bigpow + - sig_subObj->pdflfz->meanpow; + sig_subObj->scmeanpowMGC = sig_subObj->pdfmgc->bigpow + - sig_subObj->pdfmgc->meanpow; + sig_subObj->scmeanLFZ = (1 << (picoos_uint32) sig_subObj->scmeanpowLFZ); + sig_subObj->scmeanMGC = (1 << (picoos_uint32) sig_subObj->scmeanpowMGC); + sig_subObj->fSampNorm = PICOSIG_NORM1 * sig_subObj->pdfmgc->amplif; + /*----------------------------------------------------------------- + * Initialize memory for DSP + * ------------------------------------------------------------------*/ + sigDspInitialize(&(sig_subObj->sig_inner), r_mode); + /*----------------------------------------------------------------- + * Initialize modifiers + * ------------------------------------------------------------------*/ + /*pitch , volume , speaker modifiers*/ + sig_subObj->pMod = 1.0f; + sig_subObj->vMod = 1.0f; + sig_subObj->sMod = 1.0f; + } else { + /*----------------------------------------------------------------- + * Initialize memory for DSP + * ------------------------------------------------------------------*/ + sigDspInitialize(&(sig_subObj->sig_inner), r_mode); + } - /*----------------------------------------------------------------- - * Initialize modifiers - * ------------------------------------------------------------------*/ - /*pitch , volume , speaker modifiers*/ - sig_subObj->pMod = 1.0f; - sig_subObj->vMod = 1.0f; - sig_subObj->sMod = 1.0f; return PICO_OK; }/*sigInitialize*/ @@ -287,7 +294,7 @@ picodata_ProcessingUnit picosig_newSigUnit(picoos_MemoryManager mm, /*----------------------------------------------------------------- * Initialize memory for DSP (this may be re-used elsewhere, e.g.Reset) * ------------------------------------------------------------------*/ - if (PICO_OK != sigInitialize(this)) { + if (PICO_OK != sigInitialize(this, PICO_RESET_FULL)) { PICODBG_ERROR(("Error in iSig Sub Object initialization")); sigDeallocate(mm, &(sig_subObj->sig_inner)); picoos_deallocate(mm, (void *) &this); diff --git a/pico/lib/picosig2.c b/pico/lib/picosig2.c index e431c90..52943e6 100644 --- a/pico/lib/picosig2.c +++ b/pico/lib/picosig2.c @@ -412,11 +412,30 @@ void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj) * @callgraph * @callergraph */ -void sigDspInitialize(sig_innerobj_t *sig_inObj) +void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 r_mode) { picoos_int32 i, j; picoos_int32 *pnt; + if (r_mode == PICO_RESET_SOFT) { + /*minimal initialization when receiving a soft reset */ + return; + /* + sig_inObj->voxbnd_p = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p + / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2) + * (picoos_single) sig_inObj->VCutoff_p); + sig_inObj->voxbnd2_p + = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p + / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2) + * (picoos_single) sig_inObj->UVCutoff_p); + sig_inObj->nextPeak_p = (((int) (PICODSP_FFTSIZE)) + / ((int) PICODSP_DISPLACE) - 1) * sig_inObj->hop_p; + for (i = 0; i < 2 * PICODSP_FFTSIZE; i++) { + sig_inObj->int_vec26[i] = 0; + } + return; + */ + } /*----------------------------------------------------------------- * Initialization * ------------------------------------------------------------------*/ diff --git a/pico/lib/picosig2.h b/pico/lib/picosig2.h index f239ced..1b975db 100644 --- a/pico/lib/picosig2.h +++ b/pico/lib/picosig2.h @@ -139,7 +139,7 @@ typedef struct sig_innerobj extern pico_status_t sigAllocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj); extern void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj); -extern void sigDspInitialize(sig_innerobj_t *sig_inObj); +extern void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 r_mode); /*------------------------------------------------------------------ Exported (to picosig.c) Processing routines : diff --git a/pico/lib/picospho.c b/pico/lib/picospho.c index 0d0cdf8..bf9dd80 100644 --- a/pico/lib/picospho.c +++ b/pico/lib/picospho.c @@ -286,7 +286,7 @@ static pico_status_t sphoReset(register picodata_ProcessingUnit this) } -static pico_status_t sphoInitialize(register picodata_ProcessingUnit this) +static pico_status_t sphoInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { picoos_uint8 i; spho_subobj_t * spho; @@ -392,7 +392,7 @@ picodata_ProcessingUnit picospho_newSentPhoUnit(picoos_MemoryManager mm, return NULL; } - sphoInitialize(this); + sphoInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/lib/picotok.c b/pico/lib/picotok.c index 4488609..969e2a3 100644 --- a/pico/lib/picotok.c +++ b/pico/lib/picotok.c @@ -1385,7 +1385,7 @@ static void tok_treatSimpleToken (picodata_ProcessingUnit this, tok_subobj_t * t /* *****************************************************************************/ -static pico_status_t tokReset(register picodata_ProcessingUnit this) +static pico_status_t tokReset(register picodata_ProcessingUnit this, picoos_int32 r_mode) { tok_subobj_t * tok; MarkupId mId; @@ -1449,7 +1449,7 @@ static pico_status_t tokReset(register picodata_ProcessingUnit this) return PICO_OK; } -static pico_status_t tokInitialize(register picodata_ProcessingUnit this) +static pico_status_t tokInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { /* @@ -1460,7 +1460,7 @@ static pico_status_t tokInitialize(register picodata_ProcessingUnit this) } tok = (tok_subobj_t *) this->subObj; */ - return tokReset(this); + return tokReset(this, r_mode); } @@ -1508,7 +1508,7 @@ picodata_ProcessingUnit picotok_newTokenizeUnit(picoos_MemoryManager mm, picoos_ picoos_deallocate(mm, (void *)&this); return NULL; } - tokInitialize(this); + tokInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/lib/picowa.c b/pico/lib/picowa.c index 3e793c9..ab8ca51 100644 --- a/pico/lib/picowa.c +++ b/pico/lib/picowa.c @@ -78,7 +78,7 @@ typedef struct wa_subobj { } wa_subobj_t; -static pico_status_t waInitialize(register picodata_ProcessingUnit this) { +static pico_status_t waInitialize(register picodata_ProcessingUnit this, picoos_int32 r_mode) { picoos_uint8 i; picoklex_Lex ulex; wa_subobj_t * wa; @@ -98,6 +98,10 @@ static pico_status_t waInitialize(register picodata_ProcessingUnit this) { wa->outBufSize = PICOWA_MAXITEMSIZE; wa->outLen = 0; + if (r_mode == PICO_RESET_SOFT) { + /*following initializations needed only at startup or after a full reset*/ + return PICO_OK; + } /* kb lex */ wa->lex = picoklex_getLex(this->voice->kbArray[PICOKNOW_KBID_LEX_MAIN]); if (wa->lex == NULL) { @@ -177,7 +181,7 @@ picodata_ProcessingUnit picowa_newWordAnaUnit(picoos_MemoryManager mm, return NULL; } - waInitialize(this); + waInitialize(this, PICO_RESET_FULL); return this; } diff --git a/pico/tts/com_svox_picottsengine.cpp b/pico/tts/com_svox_picottsengine.cpp index f7df2a4..0c4b5fc 100644 --- a/pico/tts/com_svox_picottsengine.cpp +++ b/pico/tts/com_svox_picottsengine.cpp @@ -1356,7 +1356,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t while (text_remaining) { if (picoSynthAbort) { - ret = pico_resetEngine( picoEngine ); + ret = pico_resetEngine( picoEngine, PICO_RESET_SOFT ); break; } @@ -1374,7 +1374,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t inp += bytes_sent; do { if (picoSynthAbort) { - ret = pico_resetEngine( picoEngine ); + ret = pico_resetEngine( picoEngine, PICO_RESET_SOFT ); break; } /* Retrieve the samples and add them to the buffer. */ @@ -1391,7 +1391,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t if (cbret == TTS_CALLBACK_HALT) { LOGI("Halt requested by caller. Halting."); picoSynthAbort = 1; - ret = pico_resetEngine( picoEngine ); + ret = pico_resetEngine( picoEngine, PICO_RESET_SOFT ); break; } bufused = 0; @@ -1419,7 +1419,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t LOGV("Synth loop: sending TTS_SYNTH_DONE after error"); picoSynthDoneCBPtr( userdata, 16000, AudioSystem::PCM_16_BIT, 1, buffer, bufused, TTS_SYNTH_DONE); - pico_resetEngine( picoEngine ); + pico_resetEngine( picoEngine, PICO_RESET_SOFT ); return TTS_FAILURE; } } |