[speex-dev] decode in ppc 2003
Rodrigo Parra M
rparra at ing.puc.cl
Mon Jan 19 02:19:40 PST 2004
Hi all,
Please a moment to look my source code, this is very similar to example of
the documentation. I added FIXED_POINT flag. My source code compile and
build but not decode correctly (the error may be in the while). I work with
eVC 4.0 and pocket pc 2003. Someone know what is the error?
Thanks.
Rodrigo.
#include "speex.h"
#define FRAME_SIZE 160
void CPlayerDlg::OnButton3()
{
char infile[]="test.spx";
char outfile[]="test.wav";
char *outFile;
char *inFile;
FILE *fout; // output file
FILE *fin; // input file
short out[FRAME_SIZE];
short output[FRAME_SIZE];
char cbits[200];
int nbBytes;
void *state;
SpeexBits bits;
int i, tmp;
state = speex_decoder_init(&speex_nb_mode);
tmp=1;
speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp);
outFile = outfile;
fout = fopen(outFile, "w");
inFile = infile;
fin = fopen(inFile,"r");
speex_bits_init(&bits);
while (1)
{
fread(&nbBytes, sizeof(int), 1, fin);
fprintf (stderr, "nbBytes: %d\n", nbBytes);
if (feof(fin))
break;
/*Read the "packet" encoded by sampleenc*/
fread(cbits, 1, nbBytes, fin);
/*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;
}
<p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Speex-dev
mailing list