[Speex-dev] Continous decoding of several audio files without
destroying speex_decoder
Jean-Marc Valin
jean-marc.valin at usherbrooke.ca
Sun Dec 23 21:20:40 PST 2007
> We are using speex decoder only for narrow band decoding.
> Quite often, even though source frame is not silence, decoded audio is
> silence.
> I wonder there is a problem in the way we uses speex decoder API.
> Basically, we initialize speex decoder only once and just reset the decoder
> before we decoding another file.
> Do we need to intialize speex decoder and destory decoder for each audio
> file decoding ?
You can do a reset if you don't want to destroy and re-initialise.
Cheers,
Jean-Marc
> Here is current pseudo code.
> main()
> {
> m_speex = speex_decoder_init(speex_nb_mode);
> speex_decoder_ctl(m_speex, SPEEX_SET_ENH, &tmp);
> speex_bits_init(&m_bits);
>
> while(end of files)
> {
> speex_decoder_ctl(m_speex, SPEEX_RESET_STATE, &tmp);
> speex_bits_reset(&m_bits);
>
> OpenFile(speex audio file);
> while(end of file)
> {
> fread(speex frame);
> speex_bits_read_from();
> speex_decode_int();
> fwrite(decoded audio);
> }
> CloseFile(speex audio file);
> }
>
> speex_decoder_destroy();
> speex_bits_destroy();
> }
>
> Thanks in advance for your help.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
More information about the Speex-dev
mailing list