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

C++ speex_decoder_init函数代码示例

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

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



在下文中一共展示了speex_decoder_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: throw

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

	SpeexMode mode = getMode(modeName);
	if (mode == INVALID_MODE)
		throw OperationNotPerfomedException("Invalid Mode");

	decoder = new HalfCodec;
	decoder->mode = mode;
	speex_bits_init(&decoder->bits);

	switch (mode) {
	case MODE_NB:
		decoder->state = speex_decoder_init(&speex_nb_mode);
		break;
	case MODE_WB:
		decoder->state = speex_decoder_init(&speex_wb_mode);
		break;
	case MODE_UWB:
		decoder->state = speex_decoder_init(&speex_uwb_mode);
		break;
	};
}
开发者ID:txithihausen,项目名称:streamadapt,代码行数:26,代码来源:speexplugin.cpp


示例3: gviSpursSpeexDecoderInitialize

void gviSpursSpeexDecoderInitialize(SpursSpeexTaskOutput *spuTaskOut)
{
	void * decoder = gviSpursSpeexStateBuffer;
	int perceptualEnhancement = 1;

	// create a new decoder state
	if (gviSpursSpeexTaskDesc.mSamplesPerSecond == GVRate_8KHz)
		speex_decoder_init(&speex_nb_mode, decoder);
	else if (gviSpursSpeexTaskDesc.mSamplesPerSecond == GVRate_16KHz)
		speex_decoder_init(&speex_wb_mode, decoder);
	else
	{
		//spuDebugPrintf("[Speex][SPU] Error: invalid sample rate!\n");
		spuTaskOut->mSpeexReturnCode = -1;
	}

	if(!decoder)
	{
		//spuDebugPrintf("[Speex][SPU] Error: initializing decoder failed!\n");
		spuTaskOut->mSpeexReturnCode = -2;
	}

	// turn on the perceptual enhancement
	speex_decoder_ctl(decoder, SPEEX_SET_ENH, &perceptualEnhancement);

	spuTaskOut->mSpeexReturnCode = 0;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:27,代码来源:SpuSpeexTaskMain.cpp


示例4: FUNCSPEEX

JNIEXPORT void JNICALL FUNCSPEEX(initDecode)(JNIEnv* env, jobject obj) {
	speex_bits_init(&dbits);
	dec_state = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB));
	speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &dec_frame_size);
	int tmp = 1;
	speex_decoder_ctl(dec_state, SPEEX_SET_ENH, &tmp);
}
开发者ID:hihua,项目名称:hihuacode,代码行数:7,代码来源:audiorecord.cpp


示例5: _speex_dec_state

AudioDecoderSpeex::AudioDecoderSpeex()
    : _speex_dec_state(speex_decoder_init(&speex_wb_mode)) 
{
    if (!_speex_dec_state) {
        throw MediaException(_("AudioDecoderSpeex: state initialization failed."));
    }

    speex_bits_init(&_speex_bits);

    speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_framesize);

#ifdef RESAMPLING_SPEEX
    int err = 0;
    _resampler = speex_resampler_init(1, 16000, 44100,
        SPEEX_RESAMPLER_QUALITY_DEFAULT, &err);

    if (err != RESAMPLER_ERR_SUCCESS) {
        throw MediaException(_("AudioDecoderSpeex: initialization failed."));
    }

    spx_uint32_t num = 0, den = 0;

    speex_resampler_get_ratio (_resampler, &num, &den);
    assert(num && den);

    boost::rational<boost::uint32_t> numsamples(den, num);

    numsamples *= _speex_framesize * 2 /* convert to stereo */;

    _target_frame_size = boost::rational_cast<boost::uint32_t>(numsamples);
#endif
}
开发者ID:adamh,项目名称:gnash-fork,代码行数:32,代码来源:AudioDecoderSpeex.cpp


示例6: allocate_slot

JNIEXPORT jint JNICALL Java_com_purplefrog_speexjni_SpeexDecoder_allocate
  (JNIEnv *env, jclass cls, jint wideband)
{
    int slot = allocate_slot(&slots);

    //

    slots.slots[slot] = malloc(sizeof(struct Slot));

    struct Slot* gob = slots.slots[slot];

    //

    speex_bits_init(&gob->bits);


    const SpeexMode * mode;
    switch (wideband) {
    case 1:
	mode = &speex_wb_mode;
	break;
    case 2:
	mode = &speex_uwb_mode;
	break;
    default:
	mode = &speex_nb_mode;
	break;
    }

    gob->state = speex_decoder_init(mode);

    return slot;
}
开发者ID:LZXiaoFeng,项目名称:speex-android,代码行数:33,代码来源:com_purplefrog_speexjni_SpeexDecoder.c


示例7: decode

void decode(int header) {
  FILE * fin = fopen("audiopacket2.spx", "r");
  FILE * fout = fopen("decoded_audio.raw", "w");
  int i;
  short out[FRAME_SIZE];
  float output[FRAME_SIZE];
  char cbits[331-20];

  SpeexBits bits;
  void * state;
  
  state = speex_decoder_init(&speex_nb_mode);
  speex_bits_init(&bits);

  while(1) {
    if(feof(fin))
      break;

    /* on lit 307 octets (un paquet) vers cbits */
    fread(cbits, 1, 331-20, fin);
    /* on le copie vers une structure bit-stream */
    speex_bits_read_from(&bits, cbits+header, 331-20-header);
    /* on decode */
    speex_decode(state, &bits, output);

    for(i=0 ; i< FRAME_SIZE ; i++)
      out[i]= output[i];

    fwrite(out, sizeof(short), FRAME_SIZE, fout);
  }
}
开发者ID:Youx,项目名称:soliloque-client,代码行数:31,代码来源:test.c


示例8: SpeexDecodeInit

//*****************************************************************************
//
//! Initialize the decoder's state to prepare for decoding new frames.
//!
//! This function will initializes the decoder so that it is prepared to start
//! receiving frames to decode.
//!
//! \return This function returns 0.
//
//*****************************************************************************
int32_t
SpeexDecodeInit(void)
{
    int iTemp;

    //
    // Clear out the flags for this instance.
    //
    g_sSpeexDecoder.ui32Flags = 0;

    //
    // Create a new decoder state in narrow band mode.
    //
    g_sSpeexDecoder.pvState = speex_decoder_init(&speex_nb_mode);

    //
    // Disable enhanced decoding to reduce processing requirements.
    //
    iTemp = 0;
    speex_decoder_ctl(g_sSpeexDecoder.pvState, SPEEX_SET_ENH, &iTemp);

    //
    // Initialization of the structure that holds the bits.
    //
    speex_bits_init(&g_sSpeexDecoder.sBits);

    return(0);
}
开发者ID:GuillaumeGalasso,项目名称:Embedded_Systems--Shape_The_World,代码行数:38,代码来源:speexlib.c


示例9: libspeex_decode_init

static av_cold int libspeex_decode_init(AVCodecContext *avctx)
{
    LibSpeexContext *s = avctx->priv_data;
    const SpeexMode *mode;

    // defaults in the case of a missing header
    if (avctx->sample_rate <= 8000)
        mode = &speex_nb_mode;
    else if (avctx->sample_rate <= 16000)
        mode = &speex_wb_mode;
    else
        mode = &speex_uwb_mode;

    if (avctx->extradata_size >= 80)
        s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);

    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
    if (s->header) {
        avctx->sample_rate = s->header->rate;
        avctx->channels    = s->header->nb_channels;
        s->frame_size      = s->header->frame_size;

        mode = speex_lib_get_mode(s->header->mode);
        if (!mode) {
            av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", s->header->mode);
            return AVERROR_INVALIDDATA;
        }
    } else
        av_log(avctx, AV_LOG_INFO, "Missing Speex header, assuming defaults.\n");

    if (avctx->channels > 2) {
        av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n");
        return AVERROR(EINVAL);
    }

    speex_bits_init(&s->bits);
    s->dec_state = speex_decoder_init(mode);
    if (!s->dec_state) {
        av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex decoder.\n");
        return -1;
    }

    if (!s->header) {
        speex_decoder_ctl(s->dec_state, SPEEX_GET_FRAME_SIZE, &s->frame_size);
    }

    if (avctx->channels == 2) {
        SpeexCallback callback;
        callback.callback_id = SPEEX_INBAND_STEREO;
        callback.func = speex_std_stereo_request_handler;
        callback.data = &s->stereo;
        s->stereo = (SpeexStereoState)SPEEX_STEREO_STATE_INIT;
        speex_decoder_ctl(s->dec_state, SPEEX_SET_HANDLER, &callback);
    }

    avcodec_get_frame_defaults(&s->frame);
    avctx->coded_frame = &s->frame;

    return 0;
}
开发者ID:0x0B501E7E,项目名称:ffmpeg,代码行数:60,代码来源:libspeexdec.c


示例10: dec_preprocess

static void dec_preprocess(MSFilter *f){
	DecState *s=(DecState*)f->data;
	const SpeexMode *mode=NULL;
	int modeid;
	switch(s->rate){
		case 8000:
	        modeid = SPEEX_MODEID_NB;    /* rate = 8000Hz */
			break;
		case 16000:
	        modeid = SPEEX_MODEID_WB;    /* rate = 16000Hz */
			break;
			/* should be supported in the future */
		case 32000:
	        modeid = SPEEX_MODEID_UWB;   /* rate = 32000Hz */
			break;
		default:
			ms_error("Unsupported rate for speex decoder (back to default rate=8000).");
			modeid=SPEEX_MODEID_NB;
	}
	/* warning: speex_lib_get_mode() is not available on speex<1.1.12 */
	mode = speex_lib_get_mode(modeid);
	s->state=speex_decoder_init(mode);
	speex_mode_query(mode,SPEEX_MODE_FRAME_SIZE,&s->frsz);
	if (s->penh==1)
		speex_decoder_ctl (s->state, SPEEX_SET_ENH, &s->penh);
	s->sample_time=0;
}
开发者ID:TheBaobabTeam,项目名称:linphone-android,代码行数:27,代码来源:msspeex.c


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

int main(int argc, char **argv)
{
   char *outFile;
   FILE *fout;
   /*Holds the audio that will be written to file (16 bits per sample)*/
   short out[FRAME_SIZE];
   /*Speex handle samples as float, so we need an array of floats*/
   float output[FRAME_SIZE];
   char cbits[200];
   int nbBytes;
   /*Holds the state of the decoder*/
   void *state;
   /*Holds bits so they can be read and written to by the Speex routines*/
   SpeexBits bits;
   int i, tmp;

   /*Create a new decoder state in narrowband mode*/
   state = speex_decoder_init(&speex_nb_mode);

   /*Set the perceptual enhancement on*/
   tmp=1;
   speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp);

   outFile = argv[1];
   fout = fopen(outFile, "w");

   /*Initialization of the structure that holds the bits*/
   speex_bits_init(&bits);
   while (1)
   {
      /*Read the size encoded by sampleenc, this part will likely be
        different in your application*/
      fread(&nbBytes, sizeof(int), 1, stdin);
      fprintf (stderr, "nbBytes: %d\n", nbBytes);
      if (feof(stdin))
         break;

      /*Read the "packet" encoded by sampleenc*/
      fread(cbits, 1, nbBytes, stdin);
      /*Copy the data into the bit-stream struct*/
      speex_bits_read_from(&bits, cbits, nbBytes);

      /*Decode the data*/
      speex_decode(state, &bits, output);

      /*Copy from float to short (16 bits) for output*/
      for (i=0;i<FRAME_SIZE;i++)
         out[i]=output[i];

      /*Write the decoded audio to file*/
      fwrite(out, sizeof(short), FRAME_SIZE, fout);
   }

   /*Destroy the decoder state*/
   speex_decoder_destroy(state);
   /*Destroy the bit-stream truct*/
   speex_bits_destroy(&bits);
   fclose(fout);
   return 0;
}
开发者ID:Distrotech,项目名称:speex,代码行数:60,代码来源:sampledec.c


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


示例14: speex_bits_init

speex_decoder::speex_decoder(speex_profile p)
{
    speex_bits_init(&bits_);
    decoder_state_ = speex_decoder_init(p == wideband_speex_profile ? &speex_wb_mode : &speex_nb_mode);

    int fs;
    do_decoder_ctl(decoder_state_, SPEEX_GET_FRAME_SIZE, &fs);
    block_size_ = fs;
}
开发者ID:jagajaga,项目名称:Voice-qChat,代码行数:9,代码来源:speex_decoder.cpp


示例15: speex2pcm_int

	speex2pcm_int()
	{
		state = speex_decoder_init(&speex_nb_mode);
		int tmp=1;
		speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp);
		speex_bits_init(&bits);
		speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &frame_size);

		out  = new short[ frame_size ];
	}
开发者ID:kolonse,项目名称:speex_helper,代码行数:10,代码来源:speex_helper.cpp


示例16: init_speex_decoder

void init_speex_decoder() {
    if (gDecoderState == NULL) {
        gDecoderState = speex_decoder_init(&speex_nb_mode);
        int tmp = 1;
        speex_decoder_ctl(gDecoderState, SPEEX_SET_ENH, &tmp);
        tmp = kNetworkAudioSampleRate;
        speex_decoder_ctl(gDecoderState, SPEEX_SET_SAMPLING_RATE, &tmp);
        speex_bits_init(&gDecoderBits);
    }
}
开发者ID:Aleph-One-Marathon,项目名称:alephone-psp,代码行数:10,代码来源:network_speex.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: decode_update

static int decode_update(struct audec_state **adsp,
			 const struct aucodec *ac, const char *fmtp)
{
	struct audec_state *st;
	int err = 0;
	(void)fmtp;

	if (!adsp || !ac)
		return EINVAL;
	if (*adsp)
		return 0;

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

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

	/* Decoder */
	st->dec = speex_decoder_init(resolve_mode(ac->srate));
	if (!st->dec) {
		err = ENOMEM;
		goto out;
	}

	speex_bits_init(&st->bits);

	if (2 == st->channels) {

		/* Stereo. */
		st->stereo.balance = 1;
		st->stereo.e_ratio = .5f;
		st->stereo.smooth_left = 1;
		st->stereo.smooth_right = 1;

		st->callback.callback_id = SPEEX_INBAND_STEREO;
		st->callback.func = speex_std_stereo_request_handler;
		st->callback.data = &st->stereo;
		speex_decoder_ctl(st->dec, SPEEX_SET_HANDLER,
				  &st->callback);
	}

	decoder_config(st->dec);

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

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


示例19: speex_packet_to_header

static void *process_header (struct spx_data *data)
{
	void *st;
	const SpeexMode *mode;
	int modeID;
	SpeexCallback callback;
	int enhance = ENHANCE_AUDIO;

	data->header = speex_packet_to_header ((char*)data->op.packet,
			data->op.bytes);
	if (!data->header) {
		decoder_error (&data->error, ERROR_FATAL, 0,
				"Can't open speex file: can't read header");
		return NULL;
	}

	if (data->header->mode >= SPEEX_NB_MODES) {
		decoder_error (&data->error, ERROR_FATAL, 0,
				"Can't open speex file: Mode number %"PRId32
				" does not exist in this version",
				data->header->mode);
		return NULL;
	}

	modeID = data->header->mode;
	mode = speex_mode_list[modeID];

	if (mode->bitstream_version < data->header->mode_bitstream_version) {
		decoder_error (&data->error, ERROR_FATAL, 0,
				"Can't open speex file: The file was encoded "
				"with a newer version of Speex.");
		return NULL;
	}

	if (mode->bitstream_version > data->header->mode_bitstream_version) {
		decoder_error (&data->error, ERROR_FATAL, 0,
				"Can't open speex file: The file was encoded "
				"with an older version of Speex.");
		return NULL;
	}

	st = speex_decoder_init (mode);
	speex_decoder_ctl(st, SPEEX_SET_ENH, &enhance);
	speex_decoder_ctl(st, SPEEX_GET_FRAME_SIZE, &data->frame_size);

	callback.callback_id = SPEEX_INBAND_STEREO;
	callback.func = speex_std_stereo_request_handler;
	callback.data = &data->stereo;
	speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
	speex_decoder_ctl(st, SPEEX_SET_SAMPLING_RATE, &data->header->rate);

	return st;
}
开发者ID:jonsafari,项目名称:mocp,代码行数:53,代码来源:speex.c


示例20: gviSpeexNewDecoder

GVBool gviSpeexNewDecoder(GVDecoderData * data)
{
	void * decoder;
	int perceptualEnhancement = 1;
	
	// create a new decoder state
	if (gviGetSampleRate() == GVRate_8KHz)
		decoder = speex_decoder_init(&speex_nb_mode);
	else if (gviGetSampleRate() == GVRate_16KHz)
		decoder = speex_decoder_init(&speex_wb_mode);
	else
		return GVFalse;

	if(!decoder)
		return GVFalse;

	// turn on the perceptual enhancement
	speex_decoder_ctl(decoder, SPEEX_SET_ENH, &perceptualEnhancement);

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ speex_encoder_ctl函数代码示例发布时间:2022-05-30
下一篇:
C++ speex_decoder_ctl函数代码示例发布时间: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