[speex-dev] decode in ppc 2003

Carl Douglas CarlD at itouchmobility.com
Wed Jan 21 13:33:49 PST 2004



You are writing to a test.wav file, but I don't see a RIFF header being written to this file.
-----Original Message-----
From: owner-speex-dev at xiph.org [mailto:owner-speex-dev at xiph.org]On Behalf Of Rodrigo Parra M
Sent: Monday, 19 January 2004 11:20 p.m.
To: speex-dev at xiph.org
Subject: [speex-dev] decode in ppc 2003

<p>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;
}

--- >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