Lines Matching refs:pam
47 #define PICOPAM_IN_BUFF_SIZE PICODATA_BUFSIZE_PAM /*input buffer size for PAM */
48 #define PICOPAM_OUT_PAM_SIZE PICODATA_BUFSIZE_PAM /*output buffer size for PAM*/
76 #define PICOPAM_READY 20 /*PAM could start backward processing*/
77 #define PICOPAM_MORE 21 /*PAM has still to collect */
78 #define PICOPAM_NA 22 /*PAM has not to deal with this item*/
130 /* byte 61 : 1st attached non PAM item id(0=no item attached) */
132 /* byte 62 : last attached non PAM item id(0=no item attached)*/
143 Function: subobject definition for the pam processing
144 Shortcut: pam
336 PAM feature vector indices position changes,
391 static pico_status_t pam_allocate(picoos_MemoryManager mm, pam_subobj_t *pam);
392 static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam);
460 * allocation for PAM memory on pam PU
462 * @param pam : handle to a pam struct
468 static pico_status_t pam_allocate(picoos_MemoryManager mm, pam_subobj_t *pam)
473 pam->sSyllFeats = NULL;
474 pam->sPhIds = NULL;
475 pam->sPhFeats = NULL;
476 pam->sSyllItems = NULL;
477 pam->sSyllItemOffs = NULL;
480 * PAM Local buffers ALLOCATION
482 /*PAM Local buffers*/
487 pam->sSyllFeats = (sFtVect*) data;
492 pam_deallocate(mm, pam);
495 pam->sPhIds = (picopal_uint8*) data;
500 pam_deallocate(mm, pam);
503 pam->sPhFeats = (picopal_uint8*) data;
508 pam_deallocate(mm, pam);
511 pam->sSyllItems = (picopal_uint8*) data;
516 pam_deallocate(mm, pam);
519 pam->sSyllItemOffs = (picoos_int16*) dataI;
525 * frees allocation for DSP memory on PAM PU
527 * @param pam : pam PU internal sub-object
533 static void pam_deallocate(picoos_MemoryManager mm, pam_subobj_t *pam)
538 if (pam->sSyllFeats != NULL)
539 picoos_deallocate(mm, (void *) &pam->sSyllFeats);
540 if (pam->sPhIds != NULL)
541 picoos_deallocate(mm, (void *) &pam->sPhIds);
542 if (pam->sPhFeats != NULL)
543 picoos_deallocate(mm, (void *) &pam->sPhFeats);
544 if (pam->sSyllItems != NULL)
545 picoos_deallocate(mm, (void *) &pam->sSyllItems);
546 if (pam->sSyllItemOffs != NULL)
547 picoos_deallocate(mm, (void *) &pam->sSyllItemOffs);
552 * initialization of a pam PU
562 pam_subobj_t *pam;
567 pam = (pam_subobj_t *) this->subObj;
568 pam->inBufSize = PICOPAM_IN_BUFF_SIZE;
569 pam->outBufSize = PICOPAM_OUT_PAM_SIZE;
570 pam->inReadPos = 0;
571 pam->inWritePos = 0;
572 pam->outReadPos = 0;
573 pam->outWritePos = 0;
574 pam->needMoreInput = 0;
575 pam->procState = 0;
583 pam->sSyllFeats[nI].phoneV[nJ] = 0;
586 pam->sPhIds[nI] = 0;
589 pam->sPhFeats[nI] = 0;
592 pam->sSyllItems[nI] = 0;
595 pam->sSyllItemOffs[nI] = 0;
599 pam->nLastAttachedItemId = pam->nCurrAttachedItem = 0;
600 pam->nAttachedItemsSize = 0;
608 pam->pMod = 1.0f;
609 pam->dMod = 1.0f;
610 pam->dRest = 0.0f;
625 pam->sil_weights[j][j] = tmp_weights[i][j];
635 pam->dtdur = picokdt_getDtPAM(this->voice->kbArray[PICOKNOW_KBID_DT_DUR]);
636 if (pam->dtdur == NULL) {
643 pam->dtlfz[0] = picokdt_getDtPAM(
645 pam->dtlfz[1] = picokdt_getDtPAM(
647 pam->dtlfz[2] = picokdt_getDtPAM(
649 pam->dtlfz[3] = picokdt_getDtPAM(
651 pam->dtlfz[4] = picokdt_getDtPAM(
654 if (pam->dtlfz[nI] == NULL) {
662 pam->dtmgc[0] = picokdt_getDtPAM(
664 pam->dtmgc[1] = picokdt_getDtPAM(
666 pam->dtmgc[2] = picokdt_getDtPAM(
668 pam->dtmgc[3] = picokdt_getDtPAM(
670 pam->dtmgc[4] = picokdt_getDtPAM(
673 if (pam->dtmgc[nI] == NULL) {
681 pam->pdfdur = picokpdf_getPdfDUR(
683 if (pam->pdfdur == NULL) {
690 pam->pdflfz = picokpdf_getPdfMUL(
692 if (pam->pdflfz == NULL) {
699 pam->tabphones = picoktab_getPhones(
701 if (pam->tabphones == NULL) {
711 * termination of a pam PU
712 * @param this : handle to a pam PU struct
720 pam_subobj_t *pam;
725 pam = (pam_subobj_t *) this->subObj;
731 * deallocaton of a pam PU
732 * @param this : handle to a pam PU struct
742 pam_subobj_t* pam;
745 pam = (pam_subobj_t *) this->subObj;
750 if (pam->sSyllFeats != NULL) {
751 picoos_deallocate(this->common->mm, (void *) &pam->sSyllFeats);
753 if (pam->sPhIds != NULL) {
754 picoos_deallocate(this->common->mm, (void *) &pam->sPhIds);
756 if (pam->sPhFeats != NULL) {
757 picoos_deallocate(this->common->mm, (void *) &pam->sPhFeats);
759 if (pam->sSyllItems != NULL) {
760 picoos_deallocate(this->common->mm, (void *) &pam->sSyllItems);
762 if (pam->sSyllItemOffs != NULL) {
763 picoos_deallocate(this->common->mm, (void *) &pam->sSyllItemOffs);
772 * creates a new pam processing unit
778 * @return this : pam PU handle if success
788 register pam_subobj_t * pam;
804 PICODBG_ERROR(("Error in Pam Object allocation"));
810 * Allocate internal memory for PAM (only at PU creation time)
812 pam = (pam_subobj_t *) this->subObj;
813 if (PICO_OK != pam_allocate(mm, pam)) {
814 PICODBG_ERROR(("Error in Pam buffers Allocation"));
821 * Initialize memory for PAM (this may be re-used elsewhere, e.g.Reset)
824 PICODBG_ERROR(("problem initializing the pam sub-object"));
882 * @param pam : pam subobj
889 static pico_status_t check_phones_size(pam_subobj_t *pam,
892 if ((pam->nCurrPhoneme + neededSize) > PICOPAM_MAX_PH_PER_SENT - 1) {
900 * @param pam : pam subobj
907 static pico_status_t check_syllables_size(pam_subobj_t *pam,
910 if ((pam->nCurrSyllable + neededSize) > PICOPAM_MAX_SYLL_PER_SENT - 1) {
929 register pam_subobj_t * pam;
935 pam = (pam_subobj_t *) this->subObj;
945 if (pam->nCurrSyllable >= PICOPAM_MAX_SYLL_PER_SENT - 2) {
948 if ((pam->nCurrPhoneme + head.len) >= PICOPAM_MAX_PH_PER_SENT - 2) {
962 if (pam->nCurrSyllable >= PICOPAM_MAX_SYLL_PER_SENT - 2) {
965 if ((pam->nCurrPhoneme + 1) >= PICOPAM_MAX_PH_PER_SENT - 2) {
973 if ((pam->nAttachedItemsSize + head.len)
995 register pam_subobj_t * pam;
999 pam = (pam_subobj_t *) this->subObj;
1001 if (pam->nCurrSyllable <= -1) {
1028 register pam_subobj_t * pam;
1033 pam = (pam_subobj_t *) this->subObj;
1072 register pam_subobj_t * pam;
1079 pam = (pam_subobj_t *) this->subObj;
1087 if ((pam->nAttachedItemsSize + head.len + sizeof(picodata_itemhead_t))
1092 pam->sSyllItemOffs[pam->nLastAttachedItemId] = pam->nAttachedItemsSize;
1095 pam->sSyllItems[pam->nAttachedItemsSize + nI] = item[nI];
1098 pam->nAttachedItemsSize += nI;
1101 pam->nLastAttachedItemId++;
1103 if (pam->nCurrSyllable > -1) {
1105 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM] == 0) {
1106 pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM]
1107 = pam->nLastAttachedItemId;
1109 pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm]
1110 = pam->nLastAttachedItemId;
1115 if (pam->sSyllFeats[0].phoneV[ITM] == 0) {
1116 pam->sSyllFeats[0].phoneV[ITM] = pam->nLastAttachedItemId;
1118 pam->sSyllFeats[0].phoneV[itm] = pam->nLastAttachedItemId;
1154 * @param this : Pam object pointer
1163 register pam_subobj_t * pam;
1169 pam = (pam_subobj_t *) this->subObj;
1171 nCond1 = pam->nCurrSyllable <= -1;
1172 nCond2 = pam->nCurrSyllable >= pam->nTotalSyllables;
1173 nCond3 = pam->nSyllPhoneme
1174 >= pam->sSyllFeats[pam->nCurrSyllable].phoneV[B3];
1184 * @param this : Pam object pointer
1192 register pam_subobj_t * pam;
1197 pam = (pam_subobj_t *) this->subObj;
1199 if (pam->nCurrSyllable == -1) {
1204 if (pam->nSyllPhoneme < pam->sSyllFeats[pam->nCurrSyllable].phoneV[B3] - 1) {
1205 pam->nSyllPhoneme++;
1208 if (pam->nSyllPhoneme == pam->sSyllFeats[pam->nCurrSyllable].phoneV[B3] - 1) {
1210 pam->nSyllPhoneme++;
1213 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM] > 0) {
1215 if (pam->nCurrAttachedItem == 0) {
1217 pam->nCurrAttachedItem
1218 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM];
1222 if (pam->nCurrAttachedItem
1223 < pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm]) {
1225 pam->nCurrAttachedItem++;
1231 if (pam->nCurrSyllable < pam->nTotalSyllables - 1) {
1232 pam->nCurrSyllable++;
1233 pam->nSyllPhoneme = 0;
1234 pam->nCurrAttachedItem = 0;
1238 pam->nCurrSyllable++;
1239 pam->nSyllPhoneme = 0;
1246 * @param this : Pam object pointer
1254 register pam_subobj_t * pam;
1259 pam = (pam_subobj_t *) this->subObj;
1262 if (pam->nCurrSyllable <= -1)
1266 if (pam->nCurrSyllable >= pam->nTotalSyllables)
1270 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM] <= 0)
1271 || (pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm] <= 0))
1275 if (pam->nCurrAttachedItem
1276 > pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm])
1284 * @param this : Pam object pointer
1292 register pam_subobj_t * pam;
1297 pam = (pam_subobj_t *) this->subObj;
1300 if (pam->nCurrSyllable <= -1)
1304 if (pam->nCurrSyllable >= pam->nTotalSyllables)
1308 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM] <= 0)
1309 || (pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm] <= 0))
1313 if (pam->nCurrAttachedItem
1314 > pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm])
1317 nItem = pam->nCurrAttachedItem;
1319 return &(pam->sSyllItems[pam->sSyllItemOffs[nItem - 1]]);
1325 * @param this : Pam object pointer
1330 * @remarks AttachedItem<=pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm]-1
1336 register pam_subobj_t * pam;
1341 pam = (pam_subobj_t *) this->subObj;
1344 if (pam->nCurrSyllable != 0)
1348 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[ITM] <= 0)
1349 || (pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm] <= 0))
1353 if (pam->nCurrAttachedItem > 0) {
1355 if (pam->nCurrAttachedItem
1356 > pam->sSyllFeats[pam->nCurrSyllable].phoneV[itm] - 1)
1359 nItem = pam->nCurrAttachedItem;
1360 return &(pam->sSyllItems[pam->sSyllItemOffs[nItem]]);
1366 * @param this : Pam object pointer
1381 pam_subobj_t *pam;
1386 pam = (pam_subobj_t *) this->subObj;
1390 pdf = pam->pdfdur;
1397 PICODBG_ERROR(("PAM durPdf access error, index overflow -> index: %d , numframes: %d", durIndex, pdf->numframes));
1403 PICODBG_ERROR(("PAM durPdf access error , frame pointer = NULL"));
1417 *phonDur = (picoos_uint16) (((picoos_single) * phonDur) * pam->dMod);
1419 fValue = pam->dRest + (picoos_single) numFramesState[nI] * pam->dMod;
1421 pam->dRest = fValue - (picoos_single) numFramesState[nI];
1428 * @param this : Pam object pointer
1442 pam_subobj_t *pam;
1447 pam = (pam_subobj_t *) this->subObj;
1457 lf0IndexOffset += pam->pdflfz->stateoffset[nI];
1458 if (lf0IndexOffset > pam->pdflfz->numframes - 1) {
1459 PICODBG_ERROR(("PAM flfzPdf access error, index overflow -> index: %d , numframes: %d", lf0Index, pam->pdflfz->numframes));
1463 lf0IndexOffset *= pam->pdflfz->vecsize;
1465 lfItem = &(pam->pdflfz->content[lf0IndexOffset]);
1468 lfum = (picoos_single) (sTemp << (pam->pdflfz->meanpowUm[0]));
1471 << pam->pdflfz->ivarpow[0]);
1477 phonF0[nI] *= pam->pMod;
1510 * updates the input vector for PAM
1511 * @param this : Pam object pointer
1514 * @remarks Modifies pam->sPhFeats[]
1520 pam_subobj_t *pam;
1525 pam = (pam_subobj_t *) this->subObj;
1530 pam->sPhFeats[DUR] = 0;
1531 pam->sPhFeats[F0] = 0;
1547 f0avg += pam->phonF0[nI];
1557 if ((pam->nCurrSyllable == 0) && (pam->nSyllPhoneme == 0)) {
1558 pam->phonDur = 2 * 4;
1561 fDur = (picoos_single) pam->phonDur;
1570 pam->sPhFeats[DUR] = (picoos_uint8) (fDur / (picoos_single) 10.0f);
1571 pam->sPhFeats[F0] = (picoos_uint8) (f0avg / (picoos_single) 10.0f);
1598 * @param this : Pam object pointer
1601 * @remarks Modifies pam->sPhFeats[]
1607 pam_subobj_t *pam;
1610 pam = (pam_subobj_t *) this->subObj;
1614 inVect = &(pam->sSyllFeats[pam->nCurrSyllable].phoneV[0]);
1615 phonVect = &(pam->sPhIds[0]);
1616 outVect = &(pam->sPhFeats[0]);
1623 nOffs = nOffs + pam->nSyllPhoneme; /*offset to current phone of current syllable*/
1625 if (pam->nSyllPhoneme >= nLen) {
1646 if (nOffs1 < pam->nTotalPhonemes)
1652 if (nOffs1 < pam->nTotalPhonemes)
1657 outVect[P6] = pam->nSyllPhoneme + 1;
1659 outVect[P7] = nLen - pam->nSyllPhoneme;
1661 if (pam->nSyllPhoneme < inVect[P8])
1669 * compresses the input vector for PAM
1670 * @param this : Pam object pointer
1673 * @remarks Modifies pam->sPhFeats[]
1679 pam_subobj_t *pam;
1681 pam = (pam_subobj_t *) this->subObj;
1685 outVect = &(pam->sPhFeats[0]);
1713 * reorganizes the input vector for PAM
1714 * @param this : Pam object pointer
1717 * @remarks Modifies pam->sPhFeats[]
1723 pam_subobj_t *pam;
1725 pam = (pam_subobj_t *) this->subObj;
1729 outVect = &(pam->sPhFeats[0]);
1886 * puts a PAM item into PU output buffer
1887 * @param this : Pam object pointer
1899 pam_subobj_t *pam;
1904 pam = (pam_subobj_t *) this->subObj;
1910 sDest[1] = pam->sPhFeats[P3]; /*phonetic id*/
1915 if ((pam->nCurrSyllable == 0) && (pam->nSyllPhoneme == 0)) {
1917 pam->numFramesState[nI] = 0;
1918 pam->numFramesState[nI] = 2;
1922 picoos_read_mem_pi_uint16(pam->sSyllFeats[pam->nCurrSyllable].phoneV,
1925 picoos_read_mem_pi_uint16(pam->sSyllFeats[pam->nCurrSyllable].phoneV,
1930 nType = pam->sSyllFeats[pam->nCurrSyllable].phoneV[bnd];
1955 &(pam->numFramesState[0]), /* estimated durations */
1956 pam->sil_weights[nIdx], /* integer weights */
1967 (picoos_uint16) pam->numFramesState[nI]);
1969 (picoos_uint16) pam->lf0Index[nI]);
1971 (picoos_uint16) pam->mgcIndex[nI]);
1979 * puts a non PAM (queued) item into PU output buffer
2003 * tells if an item is a PAM command (except play)
2005 * @return TRUE : qItem is a PAM command (except play)
2006 * @return FALSE : qItem not a PAM command
2017 /* flush is for all PU's and as such it is also for PAM*/
2030 * tells if an item is a PAM PLAY command
2032 * @return TRUE : qItem is a PAM PLAY command
2033 * @return FALSE : qItem not a PAM PLAY command
2055 * command processor for PAM pu
2056 * @param this : Pam item subobject
2067 pam_subobj_t *pam;
2071 pam = (pam_subobj_t *) this->subObj;
2078 /* flush is for all PU's and as such it is also for PAM : implement the flush!!*/
2080 pam->nLastAttachedItemId = pam->nCurrAttachedItem = 0;
2081 pam->nAttachedItemsSize = 0;
2093 pam->pMod = fValue;
2095 pam->dMod = (1.0f / fValue);
2101 pam->pMod *= (1.0f / fValue);
2103 pam->dMod *= (1.0f / fValue);
2119 * @return FALSE : item has to be consumed internallz on PAM
2180 * @param this : Pam item subobject pointer
2182 * @return PICODATA_PU_ERROR : error accessing PAM object
2189 pam_subobj_t *pam;
2194 pam = (pam_subobj_t *) this->subObj;
2198 /*expands current phone in current syllable in the corresponding vector pam->sPhFeats[]*/
2204 if (!pam_do_tree(this, pam->dtdur, &(pam->sPhFeats[0]), PICOPAM_INVEC_SIZE,
2206 PICODBG_WARN(("problem using pam tree dtdur, using fallback value"));
2209 pam->durIndex = dTreeResult.class;
2210 sResult = pam_get_duration(this, pam->durIndex, &(pam->phonDur),
2211 &(pam->numFramesState[0]));
2215 if (!pam_do_tree(this, pam->dtlfz[nI], &(pam->sPhFeats[0]),
2217 PICODBG_WARN(("problem using pam tree lf0Tree, using fallback value"));
2220 pam->lf0Index[nI] = dTreeResult.class;
2225 sResult = pam_get_f0(this, &(pam->lf0Index[0]), nI, &(pam->phonF0[0]));
2233 if (!pam_do_tree(this, pam->dtmgc[nI], &(pam->sPhFeats[0]),
2235 PICODBG_WARN(("problem using pam tree lf0Tree, using fallback value"));
2238 pam->mgcIndex[nI] = dTreeResult.class;
2241 sResult = pam_put_item(this, pam->outBuf, pam->outWritePos, &bWr);
2243 pam->outWritePos += bWr;
2251 * @param this : Pam item subobject pointer
2261 pam_subobj_t *pam;
2266 pam = (pam_subobj_t *) this->subObj;
2275 pam_put_qItem(qItem, pam->outBuf, pam->outWritePos, &bWr);/*popped item has to be sent to next PU*/
2276 pam->outWritePos += bWr;
2281 nRc = pamDoCommand(this, qItem); /*popped item is a PAM command : do it NOW!!*/
2287 pam->nCurrAttachedItem++;
2296 sResult = pam_put_qItem(qItem, pam->outBuf, pam->outWritePos, &bWr);
2297 pam->outWritePos += bWr;
2298 pam->nCurrAttachedItem++;
2305 * performs a step of the pam processing
2306 * @param this : Pam item subobject pointer
2319 register pam_subobj_t * pam;
2335 pam = (pam_subobj_t *) this->subObj;
2342 PICODBG_DEBUG(("pam_step -- doing state %i",pam->procState));
2344 switch (pam->procState) {
2350 &(pam->inBuf[pam->inWritePos]), pam->inBufSize
2351 - pam->inWritePos, &blen);
2365 &(pam->inBuf[pam->inWritePos]), blen);
2368 pam->inWritePos += blen;
2369 pam->inReadPos += blen;
2370 if (pam->inReadPos >= pam->inWritePos) {
2371 pam->inReadPos = 0;
2372 pam->inWritePos = 0;
2373 }PICODBG_DEBUG(("pam_step -- item is not valid, type: %d",pam->inBuf[pam->inWritePos]));
2378 pam->inWritePos += blen;
2379 pam->procState = PICOPAM_SCHEDULE;
2384 if (pam->inReadPos >= pam->inWritePos) {
2386 pam->procState = PICOPAM_COLLECT;
2390 pam->inBuf[pam->inReadPos]; here we decide how to elaborate it */
2393 if (is_pam_play_command(&(pam->inBuf[pam->inReadPos])) == TRUE) {
2395 pam->inReadPos += pam->inBuf[pam->inReadPos + 3]
2397 if (pam->inReadPos >= pam->inWritePos) {
2398 pam->inReadPos = 0;
2399 pam->inWritePos = 0;
2405 if (pam_check_immediate(this, &(pam->inBuf[pam->inReadPos]))) {
2407 pam->procState = PICOPAM_IMMEDIATE;
2410 if (pamCheckResourceLimits(this, &(pam->inBuf[pam->inReadPos]))) {
2413 pam->procState = PICOPAM_FORWARD_FORCE_TERM;
2417 if (pam_deal_with(&(pam->inBuf[pam->inReadPos]))) {
2419 pam->procState = PICOPAM_FORWARD;
2423 if (pam_hastobe_queued(this, &(pam->inBuf[pam->inReadPos]))) {
2424 /* item is not for PAM so it has to be queued internally */
2425 pam_queue(this, &(pam->inBuf[pam->inReadPos]));
2427 pam->inReadPos += pam->inBuf[pam->inReadPos + 3]
2429 if (pam->inReadPos >= pam->inWritePos) {
2430 pam->inReadPos = 0;
2431 pam->inWritePos = 0;
2438 pam->procState = PICOPAM_IMMEDIATE;
2443 /*we have one full valid item, with len>0 starting at pam->inBuf[pam->inReadPos].
2447 &(pam->inBuf[pam->inReadPos]));
2450 if (pam_hastobe_queued(this, &(pam->inBuf[pam->inReadPos]))) {
2452 pam_queue(this, &(pam->inBuf[pam->inReadPos]));
2457 pam->needMoreInput = FALSE;
2459 pam->inReadPos += pam->inBuf[pam->inReadPos + 3]
2461 if (pam->inReadPos >= pam->inWritePos) {
2462 pam->inReadPos = 0;
2463 pam->inWritePos = 0;
2468 pam->procState = PICOPAM_PROCESS;
2473 pam->nLastAttachedItemId = pam->nCurrAttachedItem
2475 pam->nAttachedItemsSize = 0;
2477 pam->procState = PICOPAM_SCHEDULE;
2483 pam->needMoreInput = TRUE;
2485 pam->inReadPos += pam->inBuf[pam->inReadPos + 3]
2487 if (pam->inReadPos >= pam->inWritePos) {
2488 /*input is finished and PAM need more data :
2491 pam->inReadPos = 0;
2492 pam->inWritePos = 0;
2493 pam->procState = PICOPAM_SCHEDULE;
2507 pam->procState = PICOPAM_IMMEDIATE;
2515 starting at pam->inBuf[pam->inReadPos] but we decided
2527 pam->procState = PICOPAM_PROCESS;
2532 pam->nLastAttachedItemId = pam->nCurrAttachedItem
2534 pam->nAttachedItemsSize = 0;
2536 pam->procState = PICOPAM_SCHEDULE;
2544 pam->nLastAttachedItemId = pam->nCurrAttachedItem = 0;
2545 pam->nAttachedItemsSize = 0;
2547 pam->procState = PICOPAM_SCHEDULE;
2556 if ((PICOPAM_FRAME_ITEM_SIZE + 4) > (pam->outBufSize
2557 - pam->outWritePos)) {
2562 if (pam->nCurrSyllable == 0) {
2570 pam->retState = PICOPAM_PROCESS;
2571 pam->procState = PICOPAM_FEED;
2580 pam->retState = PICOPAM_PROCESS;
2581 pam->procState = PICOPAM_PROCESS;
2592 pam->retState = PICOPAM_SCHEDULE;
2593 pam->procState = PICOPAM_SCHEDULE;
2598 we get here when pam->nCurrSyllable==0 and
2608 pam->procState = PICOPAM_FEED; /*switch to feed*/
2624 sResult = pam_put_qItem(qItem, pam->outBuf,
2625 pam->outWritePos, &bWr);
2630 pam->outWritePos += bWr; /*item write ok*/
2631 pam->procState = PICOPAM_FEED; /*switch to feed*/
2637 sResult = pamDoCommand(this, qItem); /*popped item is a PAM command : do it NOW!!*/
2640 pam->retState = PICOPAM_SCHEDULE;
2641 pam->procState = PICOPAM_SCHEDULE; /*switch to schedule */
2645 /*update PAM status: if more items attached to the current syllable
2648 sResult = pamUpdateProcess(this); /*both "doCommand" or "put" : update PAM status*/
2651 pam->procState = PICOPAM_SCHEDULE; /*switch to schedule */
2659 /*context: full valid item, with len> starting at pam->inBuf[pam->inReadPos]*/
2661 + pam->inBuf[pam->inReadPos + 3];
2662 sResult = picodata_copy_item(&(pam->inBuf[pam->inReadPos]),
2663 numinb, &(pam->outBuf[pam->outWritePos]),
2664 pam->outBufSize - pam->outWritePos, &numoutb);
2667 pam->inReadPos += numinb;
2668 if (pam->inReadPos >= pam->inWritePos) {
2669 pam->inReadPos = 0;
2670 pam->inWritePos = 0;
2671 pam->needMoreInput = FALSE;
2673 pam->outWritePos += numoutb;
2674 pam->procState = PICOPAM_FEED; /*switch to FEED state*/
2675 pam->retState = PICOPAM_SCHEDULE; /*back to SCHEDULE after FEED*/
2692 &(pam->outBuf[pam->outReadPos]), pam->outWritePos
2693 - pam->outReadPos, &numoutb);
2698 (picoos_uint8 *)"pam: ",
2699 pam->outBuf + pam->outReadPos, pam->outBufSize);
2701 pam->outReadPos += numoutb;
2703 if (pam->outReadPos >= pam->outWritePos) {
2705 pam->outReadPos = 0;
2706 pam->outWritePos = 0;
2708 switch (pam->retState) {
2710 pam->procState = PICOPAM_IMMEDIATE;
2711 pam->retState = PICOPAM_SCHEDULE;
2715 pam->procState = PICOPAM_PLAY;
2716 pam->retState = PICOPAM_SCHEDULE;
2727 pam->procState = PICOPAM_PROCESS;
2729 pam->nCurrSyllable = -1;
2731 pam->nLastAttachedItemId = pam->nCurrAttachedItem
2733 pam->nAttachedItemsSize = 0;
2735 pam->nSyllPhoneme = 0;
2736 pam->procState = PICOPAM_SCHEDULE;
2750 pam->outReadPos = 0;
2751 pam->outWritePos = 0;
2752 pam->procState = PICOPAM_COLLECT;
2771 * @param this : Pam item subobject pointer
2772 * @param dtpam : the Pam decision tree
2817 * @param this : Pam item subobject pointer
2827 pam_subobj_t *pam;
2832 pam = (pam_subobj_t *) this->subObj;
2840 nCond1 = picoktab_isSyllCarrier(pam->tabphones, phon[nI]);
2851 * @param this : Pam sub object pointer
2853 * @return 0 : errors on getting the pam subobject pointer
2861 pam_subobj_t *pam;
2865 pam = (pam_subobj_t *) this->subObj;
2866 nVal1 = picoktab_getPauseID(pam->tabphones);
2871 * returns the pam sentence type (declarative, interrogative...)
2898 * returns the pam phrase type
2952 * @param this : pointer to PAM PU sub object pointer
2954 * @return PICO_ERR_OTHER : errors on getting pam sub obj pointer
2960 pam_subobj_t *pam;
2964 pam = (pam_subobj_t *) this->subObj;
2966 pam->nCurrSyllable = -1;
2967 pam->nTotalPhonemes = pam->nSyllPhoneme = pam->nCurrPhoneme
2968 = pam->nTotalSyllables = pam->sType = pam->pType = 0;
2969 pam->dRest = 0.0f;
2971 pam->a3_overall_syllable = pam->a3_primary_phrase_syllable = pam->b4_b5_syllable =
2972 pam->b6_b7_syllable = pam->b6_b7_state = pam->b8_b9_stressed_syllable =
2973 pam->b10_b11_accented_syllable = pam->b12_b13_syllable = pam->b12_b13_state =
2974 pam->b14_b15_syllable = pam->b14_b15_state = pam->b17_b19_syllable =
2975 pam->b17_b19_state = pam->b18_b20_b21_syllable = pam->b18_b20_b21_state =
2976 pam->c3_overall_syllable= pam->c3_primary_phrase_syllable = pam->d2_syllable_in_word =
2977 pam->d2_prev_syllable_in_word = pam->d2_current_primary_phrase_word = pam->e1_syllable_word_start =
2978 pam->e1_syllable_word_end= pam->e1_content = pam->e2_syllable_word_start =
2979 pam->e2_syllable_word_end= pam->e3_e4_word = pam->e3_e4_state =
2980 pam->e5_e6_content_word = pam->e5_e6_content = pam->e7_e8_word =
2981 pam->e7_e8_content = pam->e7_e8_state = pam->e9_e11_word =
2982 pam->e9_e11_saw_word = pam->e9_e11_state = pam->e10_e12_e13_word =
2983 pam->e10_e12_e13_state = pam->e10_e12_e13_saw_word = pam->f2_overall_word =
2984 pam->f2_word_syllable = pam->f2_next_word_syllable = pam->f2_current_primary_phrase_word =
2985 pam->g1_current_secondary_phrase_syllable = pam->g1_current_syllable =
2986 pam->g2_current_secondary_phrase_word = pam->g2_current_word =
2987 pam->h1_current_secondary_phrase_syll = pam->h2_current_secondary_phrase_word =
2988 pam->h3_h4_current_secondary_phrase_word = pam->h5_current_phrase_type =
2989 pam->h5_syllable = pam->h5_state = pam->i1_secondary_phrase_syllable =
2990 pam->i1_next_secondary_phrase_syllable = pam->i2_secondary_phrase_word =
2991 pam->i2_next_secondary_phrase_word = pam->j1_utterance_syllable =
2992 pam->j2_utterance_word = pam->j3_utterance_sec_phrases = 0;
2994 pam->b4_b5_syllable = pam->b17_b19_syllable = pam->b18_b20_b21_syllable =
2995 pam->e9_e11_word = pam->e10_e12_e13_word = pam->e7_e8_word =
2996 pam->h2_current_secondary_phrase_word = 1;
2998 pam->e1_syllable_word_start = pam->e1_syllable_word_end = pam->e2_syllable_word_start =
2999 pam->e2_syllable_word_end = -1;
3006 * @param this : pointer to PAM PU sub object pointer
3008 * @return PICO_ERR_OTHER : errors on getting pam sub obj pointer
3015 pam_subobj_t *pam;
3019 pam = (pam_subobj_t *) this->subObj;
3022 pam->a3_overall_syllable
3023 = pam->a3_primary_phrase_syllable
3024 = pam->b4_b5_syllable
3025 = pam->b6_b7_syllable
3026 = pam->b6_b7_state
3027 = pam->b8_b9_stressed_syllable
3028 = pam->b10_b11_accented_syllable
3029 = pam->b12_b13_syllable
3030 = pam->b12_b13_state
3031 = pam->b14_b15_syllable
3032 = pam->b14_b15_state
3033 = pam->b17_b19_syllable
3034 = pam->b17_b19_state
3035 = pam->b18_b20_b21_syllable
3036 = pam->b18_b20_b21_state
3037 = pam->c3_overall_syllable
3038 = pam->c3_primary_phrase_syllable
3039 = pam->d2_syllable_in_word
3040 = pam->d2_prev_syllable_in_word
3041 = pam->d2_current_primary_phrase_word
3042 = pam->e1_syllable_word_start
3043 = pam->e1_syllable_word_end
3044 = pam->e1_content
3045 = pam->e2_syllable_word_start
3046 = pam->e2_syllable_word_end
3047 = pam->e3_e4_word
3048 = pam->e3_e4_state
3049 = pam->e5_e6_content_word
3050 = pam->e5_e6_content
3051 = pam->e7_e8_word
3052 = pam->e7_e8_content
3053 = pam->e7_e8_state
3054 = pam->e9_e11_word
3055 = pam->e9_e11_saw_word
3056 = pam->e9_e11_state
3057 = pam->e10_e12_e13_word
3058 = pam->e10_e12_e13_state
3059 = pam->e10_e12_e13_saw_word
3060 = pam->f2_overall_word
3061 = pam->f2_word_syllable
3062 = pam->f2_next_word_syllable
3063 = pam->f2_current_primary_phrase_word
3064 = pam->g1_current_secondary_phrase_syllable
3065 = pam->g1_current_syllable
3066 = pam->g2_current_secondary_phrase_word
3067 = pam->g2_current_word
3068 = pam->h1_current_secondary_phrase_syll
3069 = pam->h2_current_secondary_phrase_word
3070 = pam->h3_h4_current_secondary_phrase_word
3071 = pam->h5_current_phrase_type
3072 = pam->h5_state
3073 = pam->i1_secondary_phrase_syllable
3074 = pam->i1_next_secondary_phrase_syllable
3075 = pam->i2_secondary_phrase_word
3076 = pam->i2_next_secondary_phrase_word
3079 pam->b4_b5_syllable = pam->b17_b19_syllable = pam->b18_b20_b21_syllable
3080 = pam->e9_e11_word = pam->e10_e12_e13_word = pam->e7_e8_word
3081 pam->h2_current_secondary_phrase_word = 1;
3083 pam->e1_syllable_word_start = pam->e1_syllable_word_end
3084 = pam->e2_syllable_word_start = pam->e2_syllable_word_end = -1;
3091 * @param this : pointer to PAM PU sub object pointer
3096 * @return PICO_ERR_OTHER : errors on getting pam sub obj pointer
3106 pam_subobj_t *pam;
3110 pam = (pam_subobj_t *) this->subObj;
3111 syllCurr = pam->nCurrSyllable;
3118 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1]
3119 == 1) || (pam->a3_primary_phrase_syllable >= 1)) {
3120 if (pam->a3_overall_syllable < 1)
3121 pam->sSyllFeats[pam->nCurrSyllable].phoneV[A3]
3124 pam->sSyllFeats[pam->nCurrSyllable].phoneV[A3]
3125 = pam->sSyllFeats[pam->nCurrSyllable
3128 pam->sSyllFeats[pam->nCurrSyllable].phoneV[A3] = 0;
3130 pam->a3_primary_phrase_syllable++;
3131 pam->a3_overall_syllable++;
3134 pam->a3_primary_phrase_syllable = 0;
3160 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1] == 0) {
3161 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3162 = pam->b4_b5_syllable;
3163 pam->b4_b5_syllable++;
3165 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest] = 0;
3171 pam->b4_b5_syllable = 1;
3188 switch (pam->b6_b7_state) {
3191 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3194 pam->b6_b7_syllable = 1;
3195 pam->b6_b7_state = 1;
3200 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3201 = pam->b6_b7_syllable;
3202 pam->b6_b7_syllable++;
3205 pam->b6_b7_syllable = 1;
3208 pam->b6_b7_state = 0;
3230 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3231 = pam->b8_b9_stressed_syllable;
3232 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B1] == 1)
3233 pam->b8_b9_stressed_syllable++;
3236 pam->b8_b9_stressed_syllable = 0;
3255 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3256 = pam->b10_b11_accented_syllable;
3257 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B2] == 1)
3258 pam->b10_b11_accented_syllable++;
3261 pam->b10_b11_accented_syllable = 0;
3278 switch (pam->b12_b13_state) {
3281 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B1] == 0)
3282 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3285 pam->b12_b13_syllable = 0;
3286 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3288 pam->b12_b13_state = 1;
3294 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3295 = pam->b12_b13_syllable;
3296 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B1] == 1)
3297 pam->b12_b13_syllable = 0;
3299 pam->b12_b13_syllable++;
3300 pam->b12_b13_state = 2;
3303 pam->b12_b13_state = 0;
3307 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3308 = pam->b12_b13_syllable;
3309 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B1] == 1)
3310 pam->b12_b13_syllable = 0;
3312 pam->b12_b13_syllable++;
3315 pam->b12_b13_state = 0;
3337 switch (pam->b14_b15_state) {
3340 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B2] == 0)
3341 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3344 pam->b14_b15_syllable = 0;
3345 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3347 pam->b14_b15_state = 1;
3353 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3354 = pam->b14_b15_syllable;
3355 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B2] == 1)
3356 pam->b14_b15_syllable = 0;
3358 pam->b14_b15_syllable++;
3359 pam->b14_b15_state = 2;
3362 pam->b14_b15_state = 0;
3367 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3368 = pam->b14_b15_syllable;
3369 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[B2] == 1)
3370 pam->b14_b15_syllable = 0;
3372 pam->b14_b15_syllable++;
3375 pam->b14_b15_state = 0;
3389 switch (pam->b17_b19_state) {
3392 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B17]
3394 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B19]
3395 = pam->b17_b19_syllable;
3396 pam->b17_b19_syllable++;
3400 && (pam->b17_b19_syllable > 1)) {
3402 pam->b17_b19_syllable = 1;
3403 pam->b17_b19_state = 1;
3408 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B17]
3409 = pam->b17_b19_syllable;
3410 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B19]
3412 pam->b17_b19_syllable++;
3415 pam->b17_b19_syllable = 1;
3432 switch (pam->b18_b20_b21_state) {
3435 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B18]
3437 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
3439 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B20]
3440 = pam->b18_b20_b21_syllable;
3441 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B21]
3444 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B20]
3446 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B21]
3447 = pam->b18_b20_b21_syllable;
3449 pam->b18_b20_b21_syllable++;
3453 && (pam->b18_b20_b21_syllable > 1)) {
3455 pam->b18_b20_b21_syllable = 1;
3456 pam->b18_b20_b21_state = 1;
3461 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B18]
3462 = pam->b18_b20_b21_syllable;
3463 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B20]
3465 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B21]
3467 pam->b18_b20_b21_syllable++;
3470 pam->b18_b20_b21_syllable = 1;
3492 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1]
3493 == 1) || (pam->c3_primary_phrase_syllable >= 1)) {
3494 if (pam->c3_overall_syllable < 1)
3495 pam->sSyllFeats[pam->nCurrSyllable].phoneV[C3]
3498 pam->sSyllFeats[pam->nCurrSyllable].phoneV[C3]
3499 = pam->sSyllFeats[pam->nCurrSyllable
3502 pam->sSyllFeats[pam->nCurrSyllable].phoneV[C3] = 0;
3504 pam->c3_primary_phrase_syllable++;
3505 pam->c3_overall_syllable++;
3508 pam->c3_primary_phrase_syllable = 0;
3517 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1]
3518 == 1) || (pam->d2_current_primary_phrase_word
3520 pam->sSyllFeats[pam->nCurrSyllable].phoneV[D2]
3521 = pam->d2_prev_syllable_in_word;
3523 pam->sSyllFeats[pam->nCurrSyllable].phoneV[D2] = 0;
3525 pam->d2_syllable_in_word++;
3530 pam->d2_current_primary_phrase_word = 1;
3531 pam->d2_prev_syllable_in_word
3532 = pam->d2_syllable_in_word;
3533 pam->d2_syllable_in_word = 0;
3534 /*pam->d2_current_primary_phrase_word++;*/
3537 pam->d2_current_primary_phrase_word = 0;
3549 if (pam->e1_syllable_word_start == -1)
3550 pam->e1_syllable_word_start
3551 = (picoos_int8) pam->nCurrSyllable;
3552 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P5] == 1)
3553 pam->e1_content = 1;
3554 pam->e1_syllable_word_end
3555 = (picoos_int8) pam->nCurrSyllable;
3560 if ((pam->e1_syllable_word_start != -1)
3561 && (pam->e1_syllable_word_end != -1)) {
3562 for (nI = pam->e1_syllable_word_start; nI
3563 <= pam->e1_syllable_word_end; nI++)
3564 pam->sSyllFeats[nI].phoneV[E1]
3565 = pam->e1_content;
3567 pam->e1_content = 0;
3568 pam->e1_syllable_word_start = -1;
3569 pam->e1_syllable_word_end = -1;
3581 if (pam->e2_syllable_word_start == -1)
3582 pam->e2_syllable_word_start
3583 = (picoos_int8) pam->nCurrSyllable;
3584 pam->e2_syllable_word_end
3585 = (picoos_int8) pam->nCurrSyllable;
3590 if ((pam->e2_syllable_word_start != -1)
3591 && (pam->e2_syllable_word_end != -1)) {
3592 for (nI = pam->e2_syllable_word_start; nI
3593 <= pam->e2_syllable_word_end; nI++)
3594 pam->sSyllFeats[nI].phoneV[E2]
3595 = pam->e2_syllable_word_end
3596 - pam->e2_syllable_word_start
3599 pam->e1_content = 0;
3600 pam->e2_syllable_word_start = -1;
3601 pam->e2_syllable_word_end = -1;
3620 switch (pam->e3_e4_state) {
3623 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3626 pam->e3_e4_word = 1;
3627 pam->e3_e4_state = 1;
3632 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3633 = pam->e3_e4_word;
3635 pam->e3_e4_word = 1;
3637 pam->e3_e4_word++;
3639 pam->e3_e4_state = 0;
3660 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3661 = pam->e5_e6_content_word;
3662 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P5] == 1)
3663 pam->e5_e6_content = 1;
3668 if (pam->e5_e6_content == 1)
3669 pam->e5_e6_content_word++;
3670 pam->e5_e6_content = 0;
3672 pam->e5_e6_content_word = 0;
3689 switch (pam->e7_e8_state) {
3692 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3694 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P5] == 1)
3695 pam->e7_e8_content = 1;
3698 pam->e7_e8_content = 0;
3703 if (pam->e7_e8_content == 1) {
3704 pam->e7_e8_word = 0;
3705 pam->e7_e8_content = 0;
3706 pam->e7_e8_state = 1;
3712 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
3713 = pam->e7_e8_word;
3714 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P5] == 1)
3715 pam->e7_e8_content = 1;
3719 if (pam->e7_e8_content == 1) {
3720 pam->e7_e8_word = 0;
3721 pam->e7_e8_content = 0;
3723 pam->e7_e8_word++;
3727 pam->e7_e8_state = 0;
3728 pam->e7_e8_content = 0; /*<<<<<< added */
3741 switch (pam->e9_e11_state) {
3744 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E9]
3746 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E11]
3747 = pam->e9_e11_word;
3748 pam->e9_e11_saw_word = 1; /*new variable, needs to be initialized to 0*/
3751 pam->e9_e11_word++;
3754 && (pam->e9_e11_saw_word == 1)) { /* modified*/
3756 pam->e9_e11_word = 1;
3758 pam->e9_e11_word++; /*modified*/
3759 pam->e9_e11_state = 1;
3764 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E9]
3765 = pam->e9_e11_word;
3766 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E11]
3771 pam->e9_e11_word++;
3773 pam->e9_e11_word = 1;
3789 switch (pam->e10_e12_e13_state) {
3792 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E10]
3794 pam->e10_e12_e13_saw_word = 1;
3795 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
3797 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E12]
3798 = pam->e10_e12_e13_word;
3799 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E13]
3802 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E12]
3804 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E13]
3805 = pam->e10_e12_e13_word;
3809 pam->e10_e12_e13_word++;
3811 /*if (((event_type==PICOPAM_EVENT_P_BOUND)||(event_type==PICOPAM_EVENT_S_BOUND))&&(pam->e10_e12_e13_word>1)) {*/
3814 && (pam->e10_e12_e13_saw_word > 0)) {
3816 pam->e10_e12_e13_word = 1;
3818 pam->e10_e12_e13_word++;
3819 pam->e10_e12_e13_state = 1;
3824 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E10]
3825 = pam->e10_e12_e13_word;
3826 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E12]
3828 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E13]
3833 pam->e10_e12_e13_word++;
3835 pam->e10_e12_e13_word = 1;
3857 if (pam->f2_current_primary_phrase_word >= 1)/*at least second word in current primary phrase*/
3858 pam->sSyllFeats[pam->nCurrSyllable].phoneV[F2]
3859 = pam->f2_next_word_syllable;
3862 pam->sSyllFeats[pam->nCurrSyllable].phoneV[F2] = 0;
3863 pam->f2_word_syllable++;
3868 pam->f2_next_word_syllable = pam->f2_word_syllable;
3869 pam->f2_word_syllable = 0;
3872 pam->f2_current_primary_phrase_word = 0;
3876 pam->f2_current_primary_phrase_word++;
3884 if (pam->g1_current_secondary_phrase_syllable > 0)
3885 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G1]
3886 = pam->g1_current_secondary_phrase_syllable;
3888 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G1] = 0;
3889 pam->g1_current_syllable++;
3892 pam->g1_current_secondary_phrase_syllable
3893 = pam->g1_current_syllable;
3894 pam->g1_current_syllable = 0;
3897 pam->g1_current_secondary_phrase_syllable = 0;
3898 pam->g1_current_syllable = 0;
3908 if (pam->g2_current_secondary_phrase_word > 0)
3909 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G2]
3910 = pam->g2_current_secondary_phrase_word;
3912 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G2] = 0;
3915 pam->g2_current_word++;
3918 pam->g2_current_secondary_phrase_word
3919 = pam->g2_current_word + 1;
3920 pam->g2_current_word = 0;
3923 pam->g2_current_secondary_phrase_word = 0;
3924 pam->g2_current_word = 0;
3935 pam->h1_current_secondary_phrase_syll++;
3936 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H1]
3937 = pam->h1_current_secondary_phrase_syll;
3941 pam->h1_current_secondary_phrase_syll = 0;
3945 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H1]
3946 = pam->h1_current_secondary_phrase_syll;
3948 pam->h1_current_secondary_phrase_syll
3949 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H1];
3951 pam->h1_current_secondary_phrase_syll
3952 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H1];
3960 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
3961 = pam->h2_current_secondary_phrase_word;
3964 pam->h2_current_secondary_phrase_word++;
3965 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
3966 = pam->h2_current_secondary_phrase_word;
3969 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
3970 = pam->h2_current_secondary_phrase_word + 1;
3971 pam->h2_current_secondary_phrase_word = 0;
3974 if (pam->nCurrSyllable > 1)
3975 pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H2]
3976 = pam->h2_current_secondary_phrase_word + 1;
3977 pam->h2_current_secondary_phrase_word = 0;
3982 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
3983 = pam->h2_current_secondary_phrase_word;
3985 pam->h2_current_secondary_phrase_word
3986 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2];
3988 pam->h2_current_secondary_phrase_word
3989 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H2];
4006 pam->sSyllFeats[pam->nCurrSyllable].phoneV[sDest]
4007 = pam->h3_h4_current_secondary_phrase_word;
4011 pam->h3_h4_current_secondary_phrase_word++;
4021 switch (pam->h5_state) {
4024 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5]
4025 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5];
4027 pam->h5_state = 1;
4032 if ((pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5]
4034 && (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1]
4036 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5]
4040 pam->h5_state = 0;
4057 pam->i1_secondary_phrase_syllable++;
4058 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I1]
4059 = pam->i1_secondary_phrase_syllable;
4063 pam->i1_secondary_phrase_syllable = 0;
4067 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I1]
4068 = pam->i1_next_secondary_phrase_syllable;
4071 pam->i1_next_secondary_phrase_syllable
4072 = pam->i1_secondary_phrase_syllable;
4073 pam->i1_secondary_phrase_syllable
4074 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[I1];
4077 pam->i1_next_secondary_phrase_syllable = 0;
4078 pam->i1_secondary_phrase_syllable
4079 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[I1];
4088 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I2]
4089 = pam->i2_secondary_phrase_word;
4092 pam->i2_secondary_phrase_word++;
4096 pam->i2_secondary_phrase_word = 1;
4101 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I2]
4102 = pam->i2_next_secondary_phrase_word;
4105 pam->i2_next_secondary_phrase_word
4106 = pam->i2_secondary_phrase_word;
4107 pam->i2_secondary_phrase_word
4108 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[I2];
4111 pam->i2_next_secondary_phrase_word = 0;
4112 pam->i2_secondary_phrase_word
4113 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[I2];
4122 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1] != 1)
4123 pam->j1_utterance_syllable++;
4127 pam->sSyllFeats[pam->nCurrSyllable].phoneV[J1]
4128 = pam->j1_utterance_syllable;
4138 pam->j2_utterance_word++;
4141 pam->sSyllFeats[pam->nCurrSyllable].phoneV[J2]
4142 = pam->j2_utterance_word - 1;
4150 pam->j3_utterance_sec_phrases++;
4154 pam
4159 pam->sSyllFeats[pam->nCurrSyllable].phoneV[J3]
4160 = pam->j3_utterance_sec_phrases - 1;
4170 * @param this : pointer to PAM PU sub object pointer
4174 * @return PICO_ERR_OTHER : errors on getting pam sub obj pointer
4184 pam_subobj_t *pam;
4188 pam = (pam_subobj_t *) this->subObj;
4193 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P2] = 1;
4196 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P3] = 1;
4199 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P4] = 1;
4211 * @param this : pointer to PAM PU sub object pointer
4228 pam_subobj_t *pam;
4237 pam = (pam_subobj_t *) this->subObj;
4240 if (check_syllables_size(pam, 1) != PICO_OK) {
4246 if (check_phones_size(pam, 1) != PICO_OK) {
4256 if (check_phones_size(pam, sContent[3]) != PICO_OK) {
4262 pam->nCurrSyllable = pam->nCurrSyllable + 1;
4265 if (pam->nCurrSyllable > 0) {
4266 pam->sSyllFeats[pam->nCurrSyllable].phoneV[nI] = 0;
4269 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[nI] > 0) {
4274 pam->sSyllFeats[pam->nCurrSyllable].phoneV[nI] = 0;
4278 pam->sSyllFeats[pam->nCurrSyllable].phoneV[nI] = 0;
4289 picoos_write_mem_pi_uint16(pam->sSyllFeats[pam->nCurrSyllable].phoneV,
4294 picoos_write_mem_pi_uint16(pam->sSyllFeats[pam->nCurrSyllable].phoneV,
4302 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
4305 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
4308 pam->sSyllFeats[pam->nCurrSyllable].phoneV[bnd] = uBoundType;
4309 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P1] = 1; /*this means the syllable contains a pause-silence*/
4310 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P8] = 1;
4314 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B3]
4315 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B4]
4316 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B5]
4317 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B6]
4318 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B7]
4321 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B16]
4324 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E2]
4325 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E3]
4326 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E4] = 1;
4328 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5] = phType;
4331 pam->sPhIds[pam->nCurrPhoneme] = pam_get_pause_id(this);
4332 picoos_mem_copy((void*) &pam->nCurrPhoneme,
4333 &(pam->sSyllFeats[pam->nCurrSyllable].phoneV[FID]),
4334 sizeof(pam->nCurrPhoneme));
4335 pam->nCurrPhoneme++;
4336 pam->nTotalPhonemes++;
4338 pam->nTotalSyllables++;
4345 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P5] = 1; /*set content syllable indicator*/
4347 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
4350 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P6]
4355 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B1] = 1;
4359 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B2] = 1;
4361 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B3] = sContent[3];/*len*/
4363 if (pam->nCurrSyllable > 30)
4364 pam->nCurrSyllable = pam->nCurrSyllable;
4366 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B16] = pam_get_vowel_name(this,
4369 pam->sSyllFeats[pam->nCurrSyllable].phoneV[P8] = pos; /*temp for storing the position of the vowel*/
4371 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5] = phType;
4374 picoos_mem_copy((void*) &pam->nCurrPhoneme,
4375 &(pam->sSyllFeats[pam->nCurrSyllable].phoneV[FID]),
4376 sizeof(pam->nCurrPhoneme));
4378 pam->sPhIds[pam->nCurrPhoneme + nI] = sContent[4 + nI];
4379 pam->nCurrPhoneme += nI;
4380 pam->nTotalPhonemes += nI;
4382 pam->nTotalSyllables++;
4390 * performs the forward step of the PAM adapter
4391 * @param this : pointer to PAM PU sub object pointer
4402 register pam_subobj_t * pam;
4410 pam = (pam_subobj_t *) this->subObj;
4437 pam->sType
4439 pam->pType = pam_map_phrase_type(itemBase[1], itemBase[2]);
4442 pam->sType, pam->pType, itemBase[1], uMinDur,
4458 pam->sType
4460 pam->pType = pam_map_phrase_type(itemBase[1], itemBase[2]);
4463 pam->sType, pam->pType, itemBase[1], uMinDur,
4483 pam->sType
4485 pam->pType = pam_map_phrase_type(itemBase[1], itemBase[2]);
4506 pam->sType, pam->pType, itemBase[1], uMinDur,
4519 if (pam->nCurrSyllable == -1) {
4525 pam->sType, pam->pType, itemBase[1], uMinDur,
4550 if (pam->nCurrSyllable == -1) {
4554 pam->sType, pam->pType, PICODATA_ITEMINFO1_BOUND_SBEG,
4565 pam->sType, pam->pType, 0, 0, 0);
4583 * performs the backward step of the PAM adapter
4584 * @param this : pointer to PAM PU sub object pointer
4587 * @remarks derived in some parts from the pam forward code
4594 register pam_subobj_t * pam;
4601 pam = (pam_subobj_t *) this->subObj;
4606 nSyll = pam->nCurrSyllable;
4607 while (pam->nCurrSyllable >= 0) {
4609 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P2] == 1) {
4612 pam->nCurrSyllable--;
4616 && (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P3] == 1)) {
4620 pam->nCurrSyllable--;
4624 && (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P4] == 1)) {
4628 pam->nCurrSyllable--;
4634 pam->nCurrSyllable--;
4637 }/*end while (pam->nCurrSyllable>=0)*/
4639 pam->nCurrSyllable = nSyll;
4642 pam->nCurrSyllable = 0;
4643 pam->nSyllPhoneme = 0;
4650 * @param this : pointer to PAM PU sub object pointer : processes a pause (silence) syllable after backward processing
4653 * @remarks pam->nCurrSyllable should point to a pause item
4663 pam_subobj_t *pam;
4667 pam = (pam_subobj_t *) this->subObj;
4668 syllCurr = pam->nCurrSyllable;
4671 if (pam->nCurrSyllable > 0) {
4672 pam->sSyllFeats[pam->nCurrSyllable].phoneV[A3]
4673 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B3];
4674 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B8]
4675 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B8];
4676 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B10]
4677 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B10];
4678 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B12]
4679 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B12];
4680 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B14]
4681 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B14];
4682 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B17]
4683 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B17];
4684 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B19]
4685 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B19];
4686 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B20]
4687 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B20];
4688 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B21]
4689 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[B21];
4691 pam->sSyllFeats[pam->nCurrSyllable].phoneV[D2]
4692 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E2];
4693 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G1]
4694 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H1];
4695 pam->sSyllFeats[pam->nCurrSyllable].phoneV[G2]
4696 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H2];
4698 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E5]
4699 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E5];
4700 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E7]
4701 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E7];
4702 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E9]
4703 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E9];
4704 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E11]
4705 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E11];
4706 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E12]
4707 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E12];
4708 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E13]
4709 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E13];
4710 pam->sSyllFeats[pam->nCurrSyllable].phoneV[E13]
4711 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[E13];
4713 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H1]
4714 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H1];
4715 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
4716 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H2];
4717 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H3]
4718 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H3];
4719 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H4]
4720 = pam->sSyllFeats[pam->nCurrSyllable - 1].phoneV[H4];
4723 pam->sSyllFeats[pam->nCurrSyllable].phoneV[A3]
4724 =pam->sSyllFeats[pam->nCurrSyllable].phoneV[B8]
4725 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B10]
4726 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B12]
4727 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B14]
4728 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B17]
4729 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B19]
4730 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B20]
4731 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[B21]
4732 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E5]
4733 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E9]
4734 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E11]
4735 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[E12]
4736 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H1]
4737 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H2]
4738 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[H3]
4742 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H4]
4743 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[J3];
4744 pam->sSyllFeats[pam->nCurrSyllable].phoneV[H5] = PICOPAM_p;
4749 if (pam->nCurrSyllable < pam->nTotalSyllables - 1) {
4751 pam->sSyllFeats[pam->nCurrSyllable].phoneV[C3]
4752 = pam->sSyllFeats[pam->nCurrSyllable + 1].phoneV[B3];
4753 pam->sSyllFeats[pam->nCurrSyllable].phoneV[F2]
4754 = pam->sSyllFeats[pam->nCurrSyllable + 1].phoneV[E2];
4755 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I1]
4756 = pam->sSyllFeats[pam->nCurrSyllable + 1].phoneV[H1];
4757 pam->sSyllFeats[pam->nCurrSyllable].phoneV[I2]
4758 = pam->sSyllFeats[pam->nCurrSyllable + 1].phoneV[H2];
4761 pam->sSyllFeats[pam->nCurrSyllable].phoneV[C3]
4762 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[F2]
4763 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[I1]
4764 = pam->sSyllFeats[pam->nCurrSyllable].phoneV[I2]
4769 pam->sSyllFeats[pam->nCurrSyllable].phoneV[B18] = 0;
4776 * @param this : pointer to PAM PU sub object pointer : processes a pause (silence) syllable after backward processing
4784 register pam_subobj_t * pam;
4790 pam = (pam_subobj_t *) this->subObj;
4793 nSyll = pam->nCurrSyllable;
4794 while (pam->nCurrSyllable >= 0) {
4795 if (pam->sSyllFeats[pam->nCurrSyllable].phoneV[P2] == 1) {
4799 pam->nCurrSyllable--;
4800 }/*end while (pam->nCurrSyllable>=0)*/
4802 pam->nCurrSyllable = nSyll;