• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ speex_encoder_init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: speex_bits_init

hsBool plSpeex::Init(Mode mode) 
{
    int enh = 1;
    
    // setup speex
    speex_bits_init(fBits);
    fBitsInit = true;

    if(mode == kNarrowband)
    {
        fEncoderState = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));                         // narrowband
        fDecoderState = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));
    }
    else if(mode == kWideband)
    {
        fEncoderState = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
        fDecoderState = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
    }
    
    speex_encoder_ctl(fEncoderState, SPEEX_GET_FRAME_SIZE, &fFrameSize);            // get frame size
    speex_encoder_ctl(fEncoderState, SPEEX_SET_COMPLEXITY, &fComplexity);           // 3
    speex_encoder_ctl(fEncoderState, SPEEX_SET_SAMPLING_RATE, &fSampleRate);        // 8 khz
    speex_encoder_ctl(fEncoderState, SPEEX_SET_VBR_QUALITY, &fQuality);             // 7
    speex_encoder_ctl(fEncoderState, SPEEX_SET_VBR, &fVBR);                         // use variable bit rate
    speex_encoder_ctl(fEncoderState, SPEEX_SET_ABR, &fAverageBitrate);              // default to 8kb
    
    speex_decoder_ctl(fDecoderState, SPEEX_SET_ENH, &fENH);                         // perceptual enhancement               

    fInitialized = true;

    return true;
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:32,代码来源:plVoiceChat.cpp


示例2: gviSpeexInitialize

GVBool gviSpeexInitialize(int quality, GVRate sampleRate)
{
	int rate;
	int bitsPerFrame;
	int samplesPerSecond;
	
	// we shouldn't already be initialized
	if(gviSpeexInitialized)
		return GVFalse;

	// create a new encoder state
	if (sampleRate == GVRate_8KHz)
		gviSpeexEncoderState = speex_encoder_init(&speex_nb_mode);
	else if (sampleRate == GVRate_16KHz)
		gviSpeexEncoderState = speex_encoder_init(&speex_wb_mode);
	else
		return GVFalse;

	if(!gviSpeexEncoderState)
		return GVFalse;

	// set the sampling rate
	samplesPerSecond = sampleRate;
	speex_encoder_ctl(gviSpeexEncoderState, SPEEX_SET_SAMPLING_RATE, &samplesPerSecond);

	// Get the samples per frame setting.
	speex_encoder_ctl(gviSpeexEncoderState, SPEEX_GET_FRAME_SIZE, &gviSpeexSamplesPerFrame);

	// set the quality
	speex_encoder_ctl(gviSpeexEncoderState, SPEEX_SET_QUALITY, &quality);

	// initialize the bits struct
	speex_bits_init(&gviSpeexBits);

	// get the bitrate
	speex_encoder_ctl(gviSpeexEncoderState, SPEEX_GET_BITRATE, &rate);

	// convert to bits per frame
	bitsPerFrame = (rate / (sampleRate / gviSpeexSamplesPerFrame));

	// convert to bytes per frame and store, round up to allocate more space than needed.
	gviSpeexEncodedFrameSize = (bitsPerFrame / 8);
	if (bitsPerFrame % 8)
		gviSpeexEncodedFrameSize++;

	// create our encoding and decoding buffer.
	gviSpeexBuffer = (float *)gsimalloc(gviSpeexSamplesPerFrame * sizeof(float));

	// we're now initialized
	gviSpeexInitialized = GVTrue;

	return GVTrue;
}
开发者ID:gamespy-tech,项目名称:GameSpyOpenSource,代码行数:53,代码来源:gvSpeex.c


示例3: encode_speex

static int encode_speex(int16_t * input_frame, uint8_t nbframes, char * output, int bitrate) {
	int i, bytesToWrite, nbBytes;
  SpeexBits bits;
  void * state;
  long long total;

  speex_bits_init(&bits);
  state = speex_encoder_init(&speex_nb_mode);
  speex_encoder_ctl(state, SPEEX_SET_QUALITY, &bitrate);
  speex_bits_reset(&bits);
  
  total = 0;
  for(i=0;i<5*160;i++) {
    total += input_frame[i];
  }
  total /= (5*160);
  if(abs(total) < 10)
    return 0;

  for(i=0;i<5;i++) {
	  speex_encode_int(state, input_frame + (i*160), &bits);
  }

	bytesToWrite = speex_bits_nbytes(&bits);
  nbBytes = speex_bits_write(&bits, output, bytesToWrite);
  speex_bits_destroy(&bits);
  speex_decoder_destroy(state);
	return nbBytes;
}
开发者ID:Youx,项目名称:soliloque-client,代码行数:29,代码来源:encoder.c


示例4: 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


示例5: spx_encode_init

int  spx_encode_init(){

    fp_speex_send = fopen("speex_send.spx" ,"w+");
    if(fp_speex_send == NULL){
         printf("open sdcard/fp_speex_send.spx file failed");
    }

    speex_encode_union_t * speex_encode_u = (speex_encode_union_t *)malloc(sizeof(speex_encode_union_t));
    if(speex_encode_u == NULL){
        printf("speex_encode_union malloc failed ...\n");
        exit(1);
    }

        /*Create a new encoder state in narrowband mode*/
   speex_encode_u->state = speex_encoder_init(&speex_nb_mode);

    /*Set the quality to 8 (15 kbps)*/
    int tmp = 8;
    speex_encoder_ctl(speex_encode_u->state, SPEEX_SET_QUALITY, &tmp);

    /*Initialization of the structure that holds the bits*/
    speex_bits_init(&speex_encode_u->bits);

    return (int )speex_encode_u;
}
开发者ID:chris-magic,项目名称:voice_processing,代码行数:25,代码来源:speex_encode.cpp


示例6: speex_init_encoder

static void speex_init_encoder (enix_aenc_t *this_gen, enix_stream_t *stream) {
  
  speex_t          *this = (speex_t *) this_gen;
  int                bitrate, channels, sample_rate;
  enix_options_t    *options;
  int                ret;

  /* 
   * gather parameters
   */

  options      = this->encoder.options;
  bitrate      = options->get_num_option (options, "bitrate");
  channels     = stream->get_property (stream, ENIX_STREAM_PROP_AUDIO_CHANNELS);
  sample_rate  = stream->get_property (stream, ENIX_STREAM_PROP_SAMPLE_RATE);

  printf ("acodec_speex: %d audio channels, %d samples/sec\n",
	  channels, sample_rate);

  /*
   * speex init
   */

  speex_bits_init (&this->bits);

  this->enc_state = speex_encoder_init (&speex_nb_mode);   

  speex_encoder_ctl (this->enc_state, SPEEX_GET_FRAME_SIZE, &this->frame_size);
  printf ("acodec_speex: codec init done. frame size is %d\n", this->frame_size);

  this->num_samples = 0;
}
开发者ID:BackupTheBerlios,项目名称:enix,代码行数:32,代码来源:acodec_speex.c


示例7: throw

void SpeexPlugin::buildEncoder(std::string modeName)
		throw(OperationNotPerfomedException) {
	if (encoder)
		throw OperationNotPerfomedException("The encoder already exists. "
			"Please call endEncoder before perform this task");

	SpeexMode mode = getMode(modeName);

	const ::SpeexMode *_mode = 0;

	switch (mode) {
	case MODE_NB:
		_mode = &speex_nb_mode;
		break;
	case MODE_WB:
		_mode = &speex_wb_mode;
		break;
	case MODE_UWB:
		_mode = &speex_uwb_mode;
		break;
	default:
		throw OperationNotPerfomedException("Invalid Mode");
	};

	encoder = new HalfCodec;
	encoder->mode = mode;
	speex_bits_init(&encoder->bits);
	encoder->state = speex_encoder_init(_mode);
}
开发者ID:txithihausen,项目名称:streamadapt,代码行数:29,代码来源:speexplugin.cpp


示例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: 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


示例10: init_speex_encoder

void init_speex_encoder() {
    if (!gEncoderState) {
        gEncoderState = speex_encoder_init(&speex_nb_mode);
	int quality = 3; // 8000 bps
        speex_encoder_ctl(gEncoderState, SPEEX_SET_QUALITY, &quality);
	int complexity = 4; // net play is demanding, ok?
        speex_encoder_ctl(gEncoderState, SPEEX_SET_COMPLEXITY, &complexity);
        int tmp = kNetworkAudioSampleRate;
        speex_encoder_ctl(gEncoderState, SPEEX_SET_SAMPLING_RATE, &tmp);
        speex_bits_init(&gEncoderBits);

	// set up the preprocessor
	int frame_size;
	speex_encoder_ctl(gEncoderState, SPEEX_GET_FRAME_SIZE, &frame_size);
	gPreprocessState = speex_preprocess_state_init(frame_size, kNetworkAudioSampleRate);
	// turn on AGC and denoise
	tmp = 1;
	speex_preprocess_ctl(gPreprocessState, SPEEX_PREPROCESS_SET_DENOISE, &tmp);
	tmp = 1;
	speex_preprocess_ctl(gPreprocessState, SPEEX_PREPROCESS_SET_AGC, &tmp);
	
	float agc_level = 32768.0 * 0.7;
	speex_preprocess_ctl(gPreprocessState, SPEEX_PREPROCESS_SET_AGC_LEVEL, &agc_level);
    }
    
}
开发者ID:Aleph-One-Marathon,项目名称:alephone-psp,代码行数:26,代码来源:network_speex.cpp


示例11: Java_com_haitou_xiaoyoupai_imservice_support_audio_Speex_open

extern "C" JNIEXPORT jint JNICALL Java_com_haitou_xiaoyoupai_imservice_support_audio_Speex_open(
    JNIEnv *env, jobject obj, jint compression) {
    int tmp = 0;
    if (codec_open++ != 0)
        return (jint) 0;

    speex_bits_init(&ebits);
    speex_bits_init(&dbits);

    enc_state = speex_encoder_init(&speex_nb_mode);
    dec_state = speex_decoder_init(&speex_nb_mode);

    tmp = compression;
    speex_encoder_ctl(enc_state, SPEEX_SET_QUALITY, &tmp);
    speex_encoder_ctl(enc_state, SPEEX_GET_FRAME_SIZE, &enc_frame_size);
    speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &dec_frame_size);

    SpeexPreprocessState * m_st;
    m_st = speex_preprocess_state_init(enc_frame_size, 8000);
    int denoise = 1;
    int noiseSuppress = -25;
    speex_preprocess_ctl(m_st, SPEEX_PREPROCESS_SET_DENOISE, &denoise);
    speex_preprocess_ctl(m_st, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS,
                         &noiseSuppress);

    return (jint) 0;
}
开发者ID:treejames,项目名称:FreshMAn-Task,代码行数:27,代码来源:speex_jni.cpp


示例12: spx_codec_open

/*
 * Open codec.
 */
static pj_status_t spx_codec_open( pjmedia_codec *codec, 
				   pjmedia_codec_param *attr )
{
    struct spx_private *spx;
    int id, tmp;

    spx = (struct spx_private*) codec->codec_data;
    id = spx->param_id;

    /* 
     * Create and initialize encoder. 
     */
    spx->enc = speex_encoder_init(spx_factory.speex_param[id].mode);
    if (!spx->enc)
	return PJMEDIA_CODEC_EFAILED;
    speex_bits_init(&spx->enc_bits);

    /* Set the quality*/
    if (spx_factory.speex_param[id].quality != -1) {
	speex_encoder_ctl(spx->enc, SPEEX_SET_QUALITY, 
			  &spx_factory.speex_param[id].quality);
    }

    /* Sampling rate. */
    tmp = attr->info.clock_rate;
    speex_encoder_ctl(spx->enc, SPEEX_SET_SAMPLING_RATE, 
		      &spx_factory.speex_param[id].clock_rate);

    /* VAD */
    tmp = (attr->setting.vad != 0);
    speex_encoder_ctl(spx->enc, SPEEX_SET_VAD, &tmp);
    speex_encoder_ctl(spx->enc, SPEEX_SET_DTX, &tmp);

    /* Complexity */
    if (spx_factory.speex_param[id].complexity != -1) {
	speex_encoder_ctl(spx->enc, SPEEX_SET_COMPLEXITY, 
			  &spx_factory.speex_param[id].complexity);
    }

    /* 
     * Create and initialize decoder. 
     */
    spx->dec = speex_decoder_init(spx_factory.speex_param[id].mode);
    if (!spx->dec) {
	spx_codec_close(codec);
	return PJMEDIA_CODEC_EFAILED;
    }
    speex_bits_init(&spx->dec_bits);

    /* Sampling rate. */
    speex_decoder_ctl(spx->dec, SPEEX_SET_SAMPLING_RATE, 
		      &spx_factory.speex_param[id].clock_rate);

    /* PENH */
    tmp = attr->setting.penh;
    speex_decoder_ctl(spx->dec, SPEEX_SET_ENH, &tmp);

    return PJ_SUCCESS;
}
开发者ID:imace,项目名称:mbgapp,代码行数:62,代码来源:speex_codec.c


示例13: 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


示例14: speex_lib_get_mode

void SpeexEncoder::encoder_init()
{
	int quality = 5;
	modeID = SPEEX_MODEID_NB;
	mode = speex_lib_get_mode(modeID);
	encoder_state = speex_encoder_init(mode);
	speex_encoder_ctl(encoder_state, SPEEX_SET_QUALITY, &quality);
	speex_bits_init(&encoder_bits);
}
开发者ID:MarcoMedrano,项目名称:speexsharp,代码行数:9,代码来源:speexencoder.cpp


示例15: FUNCSPEEX

JNIEXPORT void JNICALL FUNCSPEEX(initEncode)(JNIEnv* env, jobject obj, jint compression) {
	speex_bits_init(&ebits);
	enc_state = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));
	speex_encoder_ctl(enc_state, SPEEX_SET_QUALITY, &compression);
	speex_encoder_ctl(enc_state, SPEEX_GET_FRAME_SIZE, &enc_frame_size);
	int tmp = 1;
	speex_encoder_ctl(enc_state, SPEEX_SET_COMPLEXITY, &tmp);
	tmp = 0;
	speex_encoder_ctl(enc_state, SPEEX_SET_VBR, &tmp);
}
开发者ID:hihua,项目名称:hihuacode,代码行数:10,代码来源:audiorecord.cpp


示例16: pcm2speex_int

	pcm2speex_int()
	{
		state = speex_encoder_init(&speex_nb_mode); 
		int quality = QUALITY ; 
		speex_encoder_ctl(state, SPEEX_SET_QUALITY, &quality); 
		speex_bits_init(&bits);

		speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &frame_size);
		in  = new short[ frame_size ];
	}
开发者ID:kolonse,项目名称:speex_helper,代码行数:10,代码来源:speex_helper.cpp


示例17: tdav_codec_speex_open

int tdav_codec_speex_open(tmedia_codec_t* self)
{
	static int quality = SPEEX_DEFAULT_QUALITY;
	tdav_codec_speex_t* speex = (tdav_codec_speex_t*)self;
	
	switch(speex->type){
		case tdav_codec_speex_type_nb:
			speex->encoder.state = speex_encoder_init(&speex_nb_mode);
			speex->decoder.state = speex_decoder_init(&speex_nb_mode);
			break;
		case tdav_codec_speex_type_wb:
			speex->encoder.state = speex_encoder_init(&speex_wb_mode);
			speex->decoder.state = speex_decoder_init(&speex_wb_mode);
			break;
		case tdav_codec_speex_type_uwb:
			speex->encoder.state = speex_encoder_init(&speex_uwb_mode);
			speex->decoder.state = speex_decoder_init(&speex_uwb_mode);
			break;
		default:
			TSK_DEBUG_ERROR("Not implemented");
			return -2;
	}

	speex_decoder_ctl(speex->decoder.state, SPEEX_GET_FRAME_SIZE, &speex->decoder.size);
	speex->decoder.size *= sizeof(spx_int16_t);
	if(!(speex->decoder.buffer = tsk_calloc(speex->decoder.size, 1))){
		speex->decoder.size = speex->decoder.size = 0;
		TSK_DEBUG_ERROR("Failed to allocate new buffer");
		return -3;
	}

	speex_encoder_ctl(speex->encoder.state, SPEEX_SET_QUALITY, &quality);
	speex_encoder_ctl(speex->encoder.state, SPEEX_GET_FRAME_SIZE, &speex->encoder.size);

	speex_bits_init(&speex->encoder.bits);
	speex_bits_init(&speex->decoder.bits);
	speex_bits_reset(&speex->encoder.bits);
	speex_bits_reset(&speex->decoder.bits);

	return 0;
}
开发者ID:SayCV,项目名称:doubango,代码行数:41,代码来源:tdav_codec_speex.c


示例18: createEncoder

void createEncoder(void)
{
	signed int tmp = 0;
	speex_bits_init(&inbits);
	pEnc = speex_encoder_init(&speex_nb_mode);
	//tmp=0;
	//speex_encoder_ctl(pEnc, SPEEX_SET_VBR, &tmp);
	tmp=4;
	speex_encoder_ctl(pEnc, SPEEX_SET_QUALITY, &tmp);
	tmp=2;
	speex_encoder_ctl(pEnc, SPEEX_SET_COMPLEXITY, &tmp);
}
开发者ID:SrgShv,项目名称:speex_stm32,代码行数:12,代码来源:codec.c


示例19: encode_update

static int encode_update(struct auenc_state **aesp, const struct aucodec *ac,
			 struct auenc_param *prm, const char *fmtp)
{
	struct auenc_state *st;
	int ret, err = 0;

	if (!aesp || !ac || !prm)
		return EINVAL;
	if (prm->ptime != SPEEX_PTIME)
		return EPROTO;
	if (*aesp)
		return 0;

	st = mem_zalloc(sizeof(*st), encode_destructor);
	if (!st)
		return ENOMEM;

	st->frame_size = ac->srate * SPEEX_PTIME / 1000;
	st->channels = ac->ch;

	/* Encoder */
	st->enc = speex_encoder_init(resolve_mode(ac->srate));
	if (!st->enc) {
		err = ENOMEM;
		goto out;
	}

	speex_bits_init(&st->bits);

	encoder_config(st->enc);

	ret = speex_encoder_ctl(st->enc, SPEEX_GET_FRAME_SIZE,
				&st->frame_size);
	if (ret) {
		warning("speex: SPEEX_GET_FRAME_SIZE: %d\n", ret);
	}

	if (str_isset(fmtp)) {
		struct pl params;

		pl_set_str(&params, fmtp);

		fmt_param_apply(&params, param_handler, st);
	}

 out:
	if (err)
		mem_deref(st);
	else
		*aesp = st;

	return err;
}
开发者ID:FOSSRIT,项目名称:baresip,代码行数:53,代码来源:speex.c


示例20: speexout_tilde_speex_init

    /* initialize the speex library */
static void speexout_tilde_speex_init(t_speexout *x)
{

    speex_bits_init(&x->x_bits);

    switch ( x->x_mode ) 
    {
      case SPEEX_NB_MODE :
        x->x_encstate = speex_encoder_init(&speex_nb_mode);
        break;

      case SPEEX_WB_MODE :
        x->x_encstate = speex_encoder_init(&speex_wb_mode);
        break;
  
      default :
        error( "speexout~ : severe error : encoding scheme is unknown" );
        break;
    }

    speex_encoder_ctl(x->x_encstate, SPEEX_GET_FRAME_SIZE, (void*)&x->x_framesize);
    post( "speexout~ : frame size : %d", x->x_framesize );

}
开发者ID:Angeldude,项目名称:pd,代码行数:25,代码来源:speexout~.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ speex_preprocess_ctl函数代码示例发布时间:2022-05-30
下一篇:
C++ speex_encoder_destroy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap