void CA_AttachCMStoUtterance(CA_Wave *hWave, CA_Utterance *hUtt) { /* Link the utt's spchchan to the wave object's. This is checked in AGC fn to ensure that the correct Utt & Wave objects have been supplied. */ TRY_CA_EXCEPT ASSERT(hUtt); ASSERT(hWave); if (hWave->is_configuredForAgc == False) SERVICE_ERROR(UNCONFIGURED_CMS_AND_AGC); if (hWave->is_attached == True) SERVICE_ERROR(ATTACHED_CMS_AND_AGC); ASSERT(hWave->data.channel->channorm); hUtt->data.gen_utt.spchchan = hWave->data.channel->spchchan; hUtt->data.gen_utt.channorm = hWave->data.channel->channorm; hUtt->data.gen_utt.swicms = hWave->data.channel->swicms; hUtt->data.gen_utt.do_channorm = True; #if NORM_IN_IMELDA /* TODO: find appropriate number */ hUtt->data.gen_utt.num_chan = 3 * hWave->data.channel->mel_dim; #else hUtt->data.gen_utt.num_chan = hWave->data.channel->mel_dim; #endif hWave->is_configuredForAgc = True; hWave->is_attached = True; return; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hFrontend); }
void CA_FreePatternParameters(CA_PatInputParams *hPatInp) { TRY_CA_EXCEPT ASSERT(hPatInp); FREE((char *)hPatInp); return; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hPatInp); }
void CA_FreeAcousticParameters(CA_AcoustInputParams *hAcoustInp) { TRY_CA_EXCEPT ASSERT(hAcoustInp); FREE((char *)hAcoustInp); return; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hAcoustInp); }
void CA_FreeRecognitionParameters(CA_RecInputParams *hRecInp) { TRY_CA_EXCEPT ASSERT(hRecInp); FREE((char *)hRecInp); return; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hRecInp); }
void CA_FreeConfidenceScorer(CA_ConfidenceScorer* hConfidenceScorer) { TRY_CA_EXCEPT ASSERT(hConfidenceScorer); CA_UnloadConfidenceScorer(hConfidenceScorer); FREE((char *) hConfidenceScorer); return; BEG_CATCH_CA_EXCEPT END_CATCH_CA_EXCEPT(hConfidenceScorer); }
CA_Acoustic *CA_AllocateAcoustic(void) { CA_Acoustic *hAcoust = NULL; TRY_CA_EXCEPT; hAcoust = (CA_Acoustic *) CALLOC_CLR(1, sizeof(CA_Acoustic), "ca.hAcoust"); hAcoust->is_loaded = False; hAcoust->pattern_setup_count = 0; hAcoust->ca_rtti = CA_ACOUSTIC_SIGNATURE; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hAcoust); return (hAcoust); }
CA_Annotation* CA_AllocateAnnotation(void) { CA_Annotation* hAnnotation = NULL; TRY_CA_EXCEPT hAnnotation = (CA_Annotation*) VAR_ALLOCATE_CLR(1, sizeof(CA_Annotation), "ca.CA_Annotation"); hAnnotation->data = allocate_annotation(); hAnnotation->has_segments = False; hAnnotation->ca_rtti = CA_ANNOTATION_SIGNATURE; hAnnotation->label = NULL; hAnnotation->data->snr = 0; return hAnnotation; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hAnnotation); }
CA_RecInputParams *CA_AllocateRecognitionParameters(void) { CA_RecInputParams *hRecInp = NULL; TRY_CA_EXCEPT hRecInp = (CA_RecInputParams *) CALLOC_CLR(1, sizeof(CA_RecInputParams), "ca.hRecInp"); if ( hRecInp != NULL ) { hRecInp->is_loaded = False; hRecInp->ca_rtti = CA_RECOGNIZER_PARAMETERS_SIGNATURE; } return (hRecInp); BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hRecInp); }
CA_PatInputParams *CA_AllocatePatternParameters(void) { CA_PatInputParams *hPatInp = NULL; TRY_CA_EXCEPT hPatInp = (CA_PatInputParams *) CALLOC_CLR(1, sizeof(CA_PatInputParams), "ca.hPatInp"); hPatInp->is_loaded = False; hPatInp->ca_rtti = CA_PATTERN_PARAMETERS_SIGNATURE; return (hPatInp); BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hPatInp); }
CA_AcoustInputParams *CA_AllocateAcousticParameters(void) { CA_AcoustInputParams *hAcoustInp = NULL; TRY_CA_EXCEPT hAcoustInp = (CA_AcoustInputParams *) CALLOC_CLR(1, sizeof(CA_AcoustInputParams), "ca.hAcoustInp"); hAcoustInp->is_loaded = False; hAcoustInp->ca_rtti = CA_ACOUSTIC_PARAMETERS_SIGNATURE; BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hAcoustInp); return (hAcoustInp); }
void CA_LoadCMSParameters(CA_Wave *hWave, const char *basename, CA_FrontendInputParams *hFrontArgs) { TRY_CA_EXCEPT #if !defined(_RTT) ASSERT(hWave); /* ASSERT (basename); */ ASSERT(hFrontArgs); if (hWave->is_configuredForAgc == True) SERVICE_ERROR(CONFIGURED_CMS_AND_AGC); if (hWave->is_attached == True) SERVICE_ERROR(ATTACHED_CMS_AND_AGC); hWave->data.channel->channorm = create_channel_normalization(); /* load_channel_parameters (basename, hWave->data.channel->channorm); not used anymore, rather we spec this is the parfile directly */ hWave->data.channel->channorm->dim = MAX_CHAN_DIM; setup_channel_normalization(hWave->data.channel->channorm, hWave->data.channel->spchchan, #if NORM_IN_IMELDA hFrontArgs->mel_dim * 3, /* TODO: find appropriate number */ #else hFrontArgs->mel_dim, #endif hFrontArgs->forget_factor); hWave->data.channel->mel_dim = hFrontArgs->mel_dim; /* TODO: more checks */ hWave->data.channel->swicms = (swicms_norm_info*)CALLOC(1, sizeof(swicms_norm_info), "cfront.swicms"); if( swicms_init(hWave->data.channel->swicms) ) SERVICE_ERROR(UNEXPECTED_DATA_ERROR); hWave->is_configuredForAgc = True; #else log_report("Channel normalization or RTT not in module\n"); SERVICE_ERROR(FEATURE_NOT_SUPPORTED); #endif BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hFrontend); }
void CA_ClearCMSParameters(CA_Wave *hWave) { TRY_CA_EXCEPT #if NORM_IN_IMELDA int dim = hWave->data.channel->mel_dim * 3; #else int dim = hWave->data.channel->mel_dim; #endif ASSERT(hWave); if (hWave->is_configuredForAgc == False) SERVICE_ERROR(UNCONFIGURED_CMS_AND_AGC); if (hWave->is_attached == True) SERVICE_ERROR(ATTACHED_CMS_AND_AGC); clear_channel_normalization(hWave->data.channel->spchchan, dim); destroy_channel_normalization(hWave->data.channel->channorm); hWave->data.channel->channorm = NULL; hWave->is_configuredForAgc = False; FREE(hWave->data.channel->swicms); BEG_CATCH_CA_EXCEPT; END_CATCH_CA_EXCEPT(hWave); }