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


C++ speex_encoder_destroy函数代码示例

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


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

示例1: stop

void Transmitter::setup(int srate, int quality, int abr, int vbr, float vbr_quality, int complexity, int vad, int dtx, int txstop)
{
	if (recording)
	{
		recorder->end();
		stop();
	}

	SpeexMode *mode = NULL;
	
	switch (srate)
	{
		case 32000:
			mode = (SpeexMode *) &speex_uwb_mode;
			speexmode = DRTA_INFO_MODE_ULTRAWIDE;
			break;
		case 16000:
			mode = (SpeexMode *) &speex_wb_mode;
			speexmode = DRTA_INFO_MODE_WIDE;
			break;
		case 8000:
			mode = (SpeexMode *) &speex_nb_mode;
			speexmode = DRTA_INFO_MODE_NARROW;
			break;
	}
	
	if (state)
		speex_encoder_destroy(state);
	
	state = speex_encoder_init(mode);

	speex_encoder_ctl(state, SPEEX_SET_SAMPLING_RATE, &srate);
	speex_encoder_ctl(state, SPEEX_SET_COMPLEXITY, &complexity);
	if (vbr)
	{
		speex_encoder_ctl(state, SPEEX_SET_VBR, &vbr);
		speex_encoder_ctl(state, SPEEX_SET_VBR_QUALITY, &vbr_quality);
	}
	else
	{
		speex_encoder_ctl(state, SPEEX_SET_QUALITY, &quality);
		speex_encoder_ctl(state, SPEEX_SET_VAD, &vad);
	}
	if (abr)
		speex_encoder_ctl(state, SPEEX_SET_ABR, &abr);
	speex_encoder_ctl(state, SPEEX_SET_DTX, &dtx);
	speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &frame_size);
	
	stoptx = (int) ((srate / frame_size)*txstop);
	
	speex_bits_init(&bits);
	
	rate = srate;

	if (recording)
	{
		initRecorder();
		go();
	}
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:60,代码来源:Transmitter.cpp

示例2: voice_close

void voice_close()
{
	if (voice_fd != -1) {
		close(voice_fd);
		voice_fd = -1;
	}
#if HAVE_GSM
	if (voice_gsm_dec) {
		gsm_destroy(voice_gsm_dec);
		voice_gsm_dec = NULL;
	}

	if (voice_gsm_enc) {
		gsm_destroy(voice_gsm_enc);
		voice_gsm_enc = NULL;
	}
#endif

#if HAVE_SPEEX
	if (voice_speex_enc) {
		speex_encoder_destroy(voice_speex_enc);
		voice_speex_enc = NULL;
		speex_bits_destroy(&speex_enc_bits);
	}

	if (voice_speex_dec) {
		speex_decoder_destroy(voice_speex_dec);
		voice_speex_dec = NULL;
		speex_bits_destroy(&speex_dec_bits);
	}

#endif
}
开发者ID:canthar,项目名称:libgadu,代码行数:33,代码来源:voice7.c

示例3: sb_encoder_destroy

void sb_encoder_destroy(void *state)
{
   SBEncState *st=(SBEncState*)state;

   speex_encoder_destroy(st->st_low);
#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
   /*speex_free_scratch(st->stack);*/
#endif

   speex_free(st->high);

   speex_free(st->h0_mem);
   speex_free(st->h1_mem);

   speex_free(st->old_lsp);
   speex_free(st->old_qlsp);
   speex_free(st->interp_qlpc);
   speex_free(st->pi_gain);
   speex_free(st->exc_rms);

   speex_free(st->mem_sp);
   speex_free(st->mem_sp2);
   speex_free(st->mem_sw);

   
   speex_free(st);
}
开发者ID:AstralSerpent,项目名称:QtZ,代码行数:27,代码来源:sb_celp.c

示例4: wait

AudioInput::~AudioInput() {
	bRunning = false;
	wait();

	if (ceEncoder) {
		cCodec->celt_encoder_destroy(ceEncoder);
	} else if (esSpeex) {
		speex_bits_destroy(&sbBits);
		speex_encoder_destroy(esSpeex);
	}

	foreach(short *buf, qlEchoFrames)
		delete [] buf;

	if (sppPreprocess)
		speex_preprocess_state_destroy(sppPreprocess);
	if (sesEcho)
		speex_echo_state_destroy(sesEcho);

	if (srsMic)
		speex_resampler_destroy(srsMic);
	if (srsEcho)
		speex_resampler_destroy(srsEcho);

	delete [] psMic;
	delete [] psClean;
	delete [] psSpeaker;

	delete [] pfMicInput;
	delete [] pfEchoInput;
	delete [] pfOutput;
}
开发者ID:ashurta,项目名称:mumble,代码行数:32,代码来源:AudioInput.cpp

示例5: switch_speex_destroy

static switch_status_t switch_speex_destroy(switch_codec_t *codec)
{
	int encoding, decoding;
	struct speex_context *context = codec->private_info;

	if (!context) {
		return SWITCH_STATUS_FALSE;
	}

	encoding = (codec->flags & SWITCH_CODEC_FLAG_ENCODE);
	decoding = (codec->flags & SWITCH_CODEC_FLAG_DECODE);

	if (encoding) {
		speex_bits_destroy(&context->encoder_bits);
		speex_encoder_destroy(context->encoder_state);
	}

	if (decoding) {
		speex_bits_destroy(&context->decoder_bits);
		speex_decoder_destroy(context->decoder_state);
	}

	codec->private_info = NULL;

	return SWITCH_STATUS_SUCCESS;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:26,代码来源:mod_speex.c

示例6: stopRecorder

void Phone::setup(int mode, int quality, int abr, int vbr, float vbr_quality, int complexity, int vad, int dtx, int txstop, int th, int ring_vol)
{
	bool restart = recording;
	if (restart)
		stopRecorder();

	if (enc_state)
		speex_encoder_destroy(enc_state);

	SpeexMode *spmode = NULL;
	
	switch (mode)
	{
		case IHU_NARROW:
			spmode = (SpeexMode *) &speex_nb_mode;
			break;
		case IHU_WIDE:
			spmode = (SpeexMode *) &speex_wb_mode;
			break;
		case IHU_ULTRAWIDE:
			spmode = (SpeexMode *) &speex_uwb_mode;
			break;
	}
	
	enc_state = speex_encoder_init(spmode);

	speex_encoder_ctl(enc_state, SPEEX_SET_COMPLEXITY, &complexity);
	if (vbr)
	{
		speex_encoder_ctl(enc_state, SPEEX_SET_VBR, &vbr);
		speex_encoder_ctl(enc_state, SPEEX_SET_VBR_QUALITY, &vbr_quality);
	}
	else
	{
		speex_encoder_ctl(enc_state, SPEEX_SET_QUALITY, &quality);
		speex_encoder_ctl(enc_state, SPEEX_SET_VAD, &vad);
	}
	if (abr)
		speex_encoder_ctl(enc_state, SPEEX_SET_ABR, &abr);
	speex_encoder_ctl(enc_state, SPEEX_SET_DTX, &dtx);
	
	speex_encoder_ctl(enc_state, SPEEX_GET_SAMPLING_RATE, &rate);
	speex_encoder_ctl(enc_state, SPEEX_GET_FRAME_SIZE, &frame_size);

	stoptx = txstop;
	
	speex_bits_init(&enc_bits);
	
	ring_vol = -ring_vol + 1;
	float vol = 0.0;
	if (ring_vol <= 0)
		vol = powf(VOL_FACTOR, (float) (ring_vol));
	for (int i=0; i<SIZE_RING_32; i++)
		ringBuffer[i] = ((float) ring_32[i]) * vol;

	setThreshold(th);

	if (restart)
		startRecorder();
}
开发者ID:TylerOderkirk,项目名称:ihu,代码行数:60,代码来源:Phone.cpp

示例7: encode_destructor

static void encode_destructor(void *arg)
{
	struct auenc_state *st = arg;

	speex_bits_destroy(&st->bits);
	speex_encoder_destroy(st->enc);
}
开发者ID:FOSSRIT,项目名称:baresip,代码行数:7,代码来源:speex.c

示例8: speex_encoder_init

int AudioInput::getMaxBandwidth() {
	int audiorate;

	void *es;
	float f = static_cast<float>(g.s.iQuality);
	es = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
	speex_encoder_ctl(es,SPEEX_SET_VBR_QUALITY, &f);
	speex_encoder_ctl(es,SPEEX_GET_BITRATE,&audiorate);
	speex_encoder_destroy(es);

	audiorate /= 400/g.s.iFramesPerPacket;

	// Overhead
	audiorate += 20 + 8 + 4 + 3 + 1 + 2;

	if (g.s.bTransmitPosition)
		audiorate += 12;

	if (NetworkConfig::TcpModeEnabled())
		audiorate += 12;

	audiorate = (audiorate * 50) / g.s.iFramesPerPacket;

	return audiorate;
}
开发者ID:ArminW,项目名称:re-whisper,代码行数:25,代码来源:AudioInput.cpp

示例9: wait

AudioInput::~AudioInput() {
	bRunning = false;
	wait();
	speex_bits_destroy(&sbBits);
	speex_encoder_destroy(esEncState);
	mumble_drft_clear(&fftTable);
	jitter_buffer_destroy(jb);

	if (sppPreprocess)
		speex_preprocess_state_destroy(sppPreprocess);
	if (sesEcho)
		speex_echo_state_destroy(sesEcho);

	if (srsMic)
		speex_resampler_destroy(srsMic);
	if (srsEcho)
		speex_resampler_destroy(srsEcho);

	delete [] psMic;
	delete [] psSpeaker;
	delete [] psClean;

	if (pfMicInput)
		delete [] pfMicInput;
	if (pfEchoInput)
		delete [] pfEchoInput;
	if (pfOutput)
		delete [] pfOutput;
}
开发者ID:ArminW,项目名称:re-whisper,代码行数:29,代码来源:AudioInput.cpp

示例10: tdav_codec_speex_deinit

int tdav_codec_speex_deinit(tdav_codec_speex_t* self)
{
	if(self){
		if(self->decoder.state){
			speex_decoder_destroy(self->decoder.state);
			self->decoder.state = tsk_null;
		}
		speex_bits_destroy(&self->decoder.bits);
		if(self->decoder.buffer){
			TSK_FREE(self->decoder.buffer);
			self->decoder.size = 0;
		}

		if(self->encoder.state){
			speex_encoder_destroy(self->encoder.state);
			self->encoder.state = tsk_null;
		}
		speex_bits_destroy(&self->encoder.bits);
		self->encoder.size = 0;
		
		return 0;
	}
	else{
		TSK_DEBUG_ERROR("Invalid parameter");
		return -1;
	}
}
开发者ID:SayCV,项目名称:doubango,代码行数:27,代码来源:tdav_codec_speex.c

示例11: main

int main(int argc, char **argv)
{
   char *inFile;
   FILE *fin;
   short in[FRAME_SIZE];
   float input[FRAME_SIZE];
   char cbits[2000];
   int nbBytes;
   /*Holds the state of the encoder*/
   void *state;
   /*Holds bits so they can be read and written to by the Speex routines*/
   SpeexBits bits;
   int i, tmp;

   /*Create a new encoder state in narrowband mode*/
   state = speex_encoder_init(&speex_nb_mode);
   //printf("inited\n");
   /*Set the quality to 8 (15 kbps)*/
   tmp=8;
   speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp);

   inFile = argv[1];
   fin = fopen(inFile, "r");

   /*Initialization of the structure that holds the bits*/
   speex_bits_init(&bits);
   while (1)
   {
      /*Read a 16 bits/sample audio frame*/
      fread(in, sizeof(short), FRAME_SIZE, fin);
      if (feof(fin))
         break;
      /*Copy the 16 bits values to float so Speex can work on them*/
      for (i=0;i<FRAME_SIZE;i++)
         input[i]=in[i];

      /*Flush all the bits in the struct so we can encode a new frame*/
      speex_bits_reset(&bits);

      /*Encode the frame*/
      speex_encode(state, input, &bits);
      /*Copy the bits to an array of char that can be written*/
      nbBytes = speex_bits_write(&bits, cbits, 2000);

      /*Write the size of the frame first. This is what sampledec expects but
       it's likely to be different in your own application*/
      fwrite(&nbBytes, sizeof(int), 1, stdout);
      /*Write the compressed data*/
      fwrite(cbits, 1, nbBytes, stdout);
      
   }
   
   /*Destroy the encoder state*/
   speex_encoder_destroy(state);
   /*Destroy the bit-packing struct*/
   speex_bits_destroy(&bits);
   fclose(fin);
   return 0;
}
开发者ID:kaainet,项目名称:smart_bus_proto,代码行数:59,代码来源:sample.c

示例12: codec_drv_stop

static void codec_drv_stop(ErlDrvData handle)
{
	codec_data *d = (codec_data *) handle;
	speex_bits_destroy(&d->bits);
	speex_encoder_destroy(d->estate);
	speex_decoder_destroy(d->dstate);
	driver_free((char*)handle);
}
开发者ID:LeoKudrik,项目名称:rtplib,代码行数:8,代码来源:speex_codec.c

示例13: speex_encoder_destroy

void SpeexEncoder::Close()
{
	speex_encoder_destroy(st);
	speex_bits_destroy(&bits);
	ogg_stream_clear(&os);
	fclose(fout);
	closed = true;
}
开发者ID:MarcoMedrano,项目名称:speexsharp,代码行数:8,代码来源:speexencoder.cpp

示例14: FUNCSPEEX

JNIEXPORT void JNICALL FUNCSPEEX(releaseEncode)(JNIEnv* env, jobject obj) {
	speex_bits_destroy(&ebits);

	if (enc_state != NULL) {
		speex_encoder_destroy(enc_state);
		enc_state = NULL;
	}
}
开发者ID:hihua,项目名称:hihuacode,代码行数:8,代码来源:audiorecord.cpp

示例15: enc_uninit

static void enc_uninit(MSFilter *f){
	SpeexEncState *s=(SpeexEncState*)f->data;
	if (s==NULL)
		return;
	ms_bufferizer_destroy(s->bufferizer);
	if (s->state!=NULL)
		speex_encoder_destroy(s->state);
	ms_free(s);
}
开发者ID:TheBaobabTeam,项目名称:linphone-android,代码行数:9,代码来源:msspeex.c


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