当前位置: 首页>>代码示例>>C++>>正文


C++ cst_free函数代码示例

本文整理汇总了C++中cst_free函数的典型用法代码示例。如果您正苦于以下问题:C++ cst_free函数的具体用法?C++ cst_free怎么用?C++ cst_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cst_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: audio_close_wince

int audio_close_wince(cst_audiodev *ad)
{
    au_wince_pdata *pd = ad->platform_data;
    MMRESULT err;

    if (ad)
    {
        /* Okay, I actually think this isn't a race, because
           bcnt is only ever decremented asynchronously, and
           the asynchronous callback can't be interrupted.  So
           the only issue is whether it hits zero between the
           time we test it and the time we start waiting, and
           in this case, the event will get set anyway. */
        if (pd->bcnt > 0)
            WaitForSingleObject(pd->bevt, INFINITE);
        pd->in_reset = 1;
        err = waveOutReset(pd->wo);
        if (err != MMSYSERR_NOERROR)
        {
            cst_errmsg("Failed to reset output device: %x\n", err);
            cst_error();
        }
        pd->in_reset = 0;
        free_queue_empty(ad);
        err = waveOutClose(pd->wo);
        if (err != MMSYSERR_NOERROR)
        {
            cst_errmsg("Failed to close output device: %x\n", err);
            cst_error();
        }
        cst_free(pd);
        cst_free(ad);
    }
    return 0;
}
开发者ID:hendrikp,项目名称:Plugin_Flite,代码行数:35,代码来源:au_wince.c

示例2: cst_errmsg

cst_filemap *cst_read_whole_file(const char *path)
{
    cst_filemap *fmap;
    cst_file fh;

    if ((fh = cst_fopen(path, CST_OPEN_READ)) < 0) {
	cst_errmsg("cst_read_whole_file: Failed to open file\n");
	return NULL;
    }

    fmap = cst_alloc(cst_filemap, 1);
    fmap->fh = fh;
    fmap->mapsize = cst_filesize(fmap->fh);
    fmap->mem = cst_alloc(char, fmap->mapsize);
    if (cst_fread(fmap->fh, fmap->mem, 1, fmap->mapsize) < fmap->mapsize)
    {
	cst_errmsg("cst_read_whole_file: read() failed\n");
	cst_fclose(fmap->fh);
	cst_free(fmap->mem);
	cst_free(fmap);
	return NULL;
    }

    return fmap;
}
开发者ID:LongBoolean,项目名称:flite_vocalid_compare,代码行数:25,代码来源:cst_mmap_none.c

示例3: cons_val

cst_val *en_exp_real(const char *numstring)
{
    char *aaa, *p;
    cst_val *r;

    if (numstring && (numstring[0] == '-'))
	r = cons_val(string_val("minus"),
		     en_exp_real(&numstring[1]));
    else if (numstring && (numstring[0] == '+'))
	r = cons_val(string_val("plus"),
		     en_exp_real(&numstring[1]));
    else if (((p=strchr(numstring,'e')) != 0) ||
	     ((p=strchr(numstring,'E')) != 0))
    {
	aaa = cst_strdup(numstring);
	aaa[cst_strlen(numstring)-cst_strlen(p)] = '\0';
	r = val_append(en_exp_real(aaa),
		       cons_val(string_val("e"),
				en_exp_real(p+1)));
	cst_free(aaa);
    }
    else if ((p=strchr(numstring,'.')) != 0)
    {
	aaa = cst_strdup(numstring);
	aaa[cst_strlen(numstring)-cst_strlen(p)] = '\0';
	r = val_append(en_exp_number(aaa),
		       cons_val(string_val("point"),
				en_exp_digits(p+1)));
	cst_free(aaa);
    }
    else
	r = en_exp_number(numstring);  /* I don't think you can get here */

    return r;
}
开发者ID:2php,项目名称:flite-2.0.0-release,代码行数:35,代码来源:us_expand.c

示例4: delete_tokenstream

void delete_tokenstream(cst_tokenstream *ts)
{
    cst_free(ts->whitespace);
    cst_free(ts->token);
    if (ts->prepunctuation) cst_free(ts->prepunctuation);
    if (ts->postpunctuation) cst_free(ts->postpunctuation);
    cst_free(ts);
}
开发者ID:QuinnEbert,项目名称:zedom8or,代码行数:8,代码来源:cst_tokenstream.c

示例5: cst_alloc

cst_audiodev *audio_open_wince(int sps, int channels, int fmt)
{
    cst_audiodev *ad;
    au_wince_pdata *pd;
    HWAVEOUT wo;
    WAVEFORMATEX wfx;
    MMRESULT err;

    ad = cst_alloc(cst_audiodev,1);
    ad->sps = ad->real_sps = sps;
    ad->channels = ad->real_channels = channels;
    ad->fmt = ad->real_fmt = fmt;

    memset(&wfx,0,sizeof(wfx));
    wfx.nChannels = channels;
    wfx.nSamplesPerSec = sps;

    switch (fmt)
    {
    case CST_AUDIO_LINEAR16:
        wfx.wFormatTag = WAVE_FORMAT_PCM;
        wfx.wBitsPerSample = 16;
        break;
    case CST_AUDIO_LINEAR8:
        wfx.wFormatTag = WAVE_FORMAT_PCM;
        wfx.wBitsPerSample = 8;
        break;
    default:
        cst_errmsg("audio_open_wince: unsupported format %d\n", fmt);
        cst_free(ad);
        cst_error();
    }
    wfx.nBlockAlign = wfx.nChannels*wfx.wBitsPerSample/8;
    wfx.nAvgBytesPerSec = wfx.nSamplesPerSec*wfx.nBlockAlign;
    err = waveOutOpen(
        &wo,
        WAVE_MAPPER,
        &wfx,
        (DWORD_PTR)sndbuf_done,
        (DWORD_PTR)ad,
        CALLBACK_FUNCTION
        );

    if (err != MMSYSERR_NOERROR)
    {
        cst_errmsg("Failed to open output device: %x\n", err);
        cst_free(ad);
        cst_error();
    }

    pd = cst_alloc(au_wince_pdata,1);
    pd->wo = wo;
    pd->bevt = CreateEvent(NULL,FALSE,FALSE,NULL);
    pd->wevt = CreateEvent(NULL,FALSE,FALSE,NULL);
    pd->bcnt = 0;
    ad->platform_data = pd;
    return ad;
}
开发者ID:hendrikp,项目名称:Plugin_Flite,代码行数:58,代码来源:au_wince.c

示例6: delete_lexicon

void delete_lexicon(cst_lexicon *lex)
{   /* But I doubt if this will ever be called, lexicons are mapped */
    /* This probably isn't complete */
    if (lex)
    {
        cst_free(lex->data);
        cst_free(lex);
    }
}
开发者ID:rhdunn,项目名称:flite,代码行数:9,代码来源:cst_lexicon.c

示例7: cst_free_whole_file

int cst_free_whole_file(cst_filemap *fmap)
{
    if (cst_fclose(fmap->fh) < 0) {
	cst_errmsg("cst_free_whole_file: close() failed\n");
	return -1;
    }
    cst_free(fmap->mem);
    cst_free(fmap);
    return 0;
}
开发者ID:LongBoolean,项目名称:flite_vocalid_compare,代码行数:10,代码来源:cst_mmap_none.c

示例8: finish_header

static void finish_header(HWAVEOUT drvr, WAVEHDR *hdr)
{
    if (waveOutUnprepareHeader(drvr,hdr,sizeof(*hdr))
        != MMSYSERR_NOERROR)
    {
        cst_errmsg("Failed to unprepare header %p\n", hdr);
        cst_error();
    }
    cst_free(hdr->lpData);
    cst_free(hdr);
}
开发者ID:hendrikp,项目名称:Plugin_Flite,代码行数:11,代码来源:au_wince.c

示例9: new_wave

cst_wave *lpc_resynth(cst_lpcres *lpcres)
{
    cst_wave *w;
    int i,j,r,o,k;
    int ci,cr;
    float *outbuf, *lpccoefs;
    int pm_size_samps;

    /* Get a new wave to build the signal into */
    w = new_wave();
    cst_wave_resize(w,lpcres->num_samples,1);
    w->sample_rate = lpcres->sample_rate;
    /* outbuf is a circular buffer with past relevant samples in it */
    outbuf = cst_alloc(float,1+lpcres->num_channels);
    /* unpacked lpc coefficients */
    lpccoefs = cst_alloc(float,lpcres->num_channels);

    for (r=0,o=lpcres->num_channels,i=0; i < lpcres->num_frames; i++)
    {
	pm_size_samps = lpcres->sizes[i];

	/* Unpack the LPC coefficients */
	for (k=0; k<lpcres->num_channels; k++)
	{
	    lpccoefs[k] = (float)((((double)lpcres->frames[i][k])/65535.0)*
			   lpcres->lpc_range) + lpcres->lpc_min;
	}
	/* Note we don't zero the lead in from the previous part */
	/* seems like you should but it makes it worse if you do */
/*	memset(outbuf,0,sizeof(float)*(1+lpcres->num_channels)); */

	/* resynthesis the signal */
	for (j=0; j < pm_size_samps; j++,r++)
	{
            outbuf[o] = (float)cst_ulaw_to_short(lpcres->residual[r]);
	    cr = (o == 0 ? lpcres->num_channels : o-1);
	    for (ci=0; ci < lpcres->num_channels; ci++)
	    {
		outbuf[o] += lpccoefs[ci] * outbuf[cr];
		cr = (cr == 0 ? lpcres->num_channels : cr-1);
	    }
	    w->samples[r] = (short)(outbuf[o]);
	    o = (o == lpcres->num_channels ? 0 : o+1);
	}
    }

    cst_free(outbuf);
    cst_free(lpccoefs);

    return w;

}
开发者ID:dontulakapil,项目名称:Wordlevelcall_flite_tts,代码行数:52,代码来源:cst_sigpr.c

示例10: xdvfree

void xdvfree(DVECTOR x)
{
    if (x != NULL) {
	if (x->data != NULL) {
	    cst_free(x->data);
	}
	if (x->imag != NULL) {
	    cst_free(x->imag);
	}
	cst_free(x);
    }

    return;
}
开发者ID:JonGBowen,项目名称:GoodVibes,代码行数:14,代码来源:cst_vc.c

示例11: HTS_b2en

/* HTS_b2en: calculate frame energy */
static double HTS_b2en(HTS_Vocoder * v, const double *b, const size_t m, const double a)
{
   size_t i;
   double en = 0.0;
   double *cep;
   double *ir;

   if (v->spectrum2en_size < m) {
      if (v->spectrum2en_buff != NULL)
         cst_free(v->spectrum2en_buff);
      v->spectrum2en_buff = cst_alloc(double,((m + 1) + 2 * IRLENG));
      v->spectrum2en_size = m;
   }
   cep = v->spectrum2en_buff + m + 1;
   ir = cep + IRLENG;

   b2mc(b, v->spectrum2en_buff, m, a);
   freqt(v->spectrum2en_buff, m, cep, IRLENG, -a);
   c2ir(cep, IRLENG, ir);

   for (i = 0; i < IRLENG; i++)
      en += ir[i] * ir[i];

   return (en);
}
开发者ID:peterdrysdale,项目名称:bellbird,代码行数:26,代码来源:HTS_vocoder.c

示例12: CreateFileW

cst_filemap *cst_mmap_file(const char *path)
{
	HANDLE ffm;
	cst_filemap *fmap = NULL;

	/* By default, CreateFile uses wide-char strings; this doesn't do the expected 
	   thing when passed non-wide strings
	   
	   We're explicitly using the non-wide version of CreateFile to
	   sidestep this issue.  If you're having problems with unicode
	   pathnames, you'll need to change this to call CreateFileW (and
	   then ensure you're always passing a wide-char string). */

	ffm = CreateFileA(path,GENERIC_READ,FILE_SHARE_READ,NULL,
			 OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	if (ffm == INVALID_HANDLE_VALUE) { 
		return NULL;
	} else {
		fmap = cst_alloc(cst_filemap,1);
		fmap->h = CreateFileMapping(ffm,NULL,PAGE_READONLY,0,0,NULL);
		fmap->mapsize = GetFileSize(fmap->h, NULL);
		fmap->mem = MapViewOfFile(fmap->h,FILE_MAP_READ,0,0,0);
		if (fmap->h == NULL || fmap->mem == NULL) {
			CloseHandle(ffm);
			cst_free(fmap);
			return NULL;
		}
	}

	return fmap;
}
开发者ID:2php,项目名称:flite-2.0.0-release,代码行数:31,代码来源:cst_mmap_win32.c

示例13: parse_description

static void parse_description(const char *description, cst_features *f)
{
    /* parse the description into something more usable */
    cst_tokenstream *ts;
    const char *arg;
    char *op;
    const char *xop;

    ts = ts_open_string(description,
			" \t\r\n", /* whitespace */
			"{}[]|",   /* singlecharsymbols */
			"",        /* prepunctuation */
			"");       /* postpunctuation */
    while (!ts_eof(ts))
    {
	op = cst_strdup(ts_get(ts));
	if ((op[0] == '-') && (cst_strchr(ts->whitespace,'\n') != 0))
	{   /* got an option */
            xop = feat_own_string(f,op);
	    arg = ts_get(ts);
	    if (arg[0] == '<')
		feat_set_string(f,xop,arg);
	    else
		feat_set_string(f,xop,"<binary>");
        }
        cst_free(op);
    }

    ts_close(ts);

}
开发者ID:2php,项目名称:flite-2.0.0-release,代码行数:31,代码来源:cst_args.c

示例14: cst_munmap_file

int cst_munmap_file(cst_filemap *fmap)
{
	UnmapViewOfFile(fmap->mem);
	CloseHandle(fmap->h);
	cst_free(fmap);
	return 0;
}
开发者ID:D3strukt0r,项目名称:HabboCMS,代码行数:7,代码来源:cst_mmap_win32.c

示例15: ef_set

static void ef_set(cst_features *f,const char *fv,const char *type)
{
    /* set feature from fv (F=V), guesses type if not explicit type given */
    const char *val;
    char *feat;

    if ((val = strchr(fv,'=')) == 0)
    {
	fprintf(stderr,
		"flite: can't find '=' in featval \"%s\", ignoring it\n",
		fv);
    }
    else
    {
	feat = cst_strdup(fv);
	feat[cst_strlen(fv)-cst_strlen(val)] = '\0';
	val = val+1;
	if ((type && cst_streq("int",type)) ||
	    ((type == 0) && (cst_regex_match(cst_rx_int,val))))
	    feat_set_int(f,feat,atoi(val));
	else if ((type && cst_streq("float",type)) ||
		 ((type == 0) && (cst_regex_match(cst_rx_double,val))))
	    feat_set_float(f,feat,atof(val));
	else
	    feat_set_string(f,feat,val);
        cst_free(feat);
    }
}
开发者ID:ljmljz,项目名称:MMDAgent,代码行数:28,代码来源:flite_main.c


注:本文中的cst_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。