Salve forum!
Non riesco a capire perché compilando il seguente codice ottengo questo errore:
codice:
giovanni@Ubuntu10:~/Scrivania$ gcc a.cpp
a.cpp: In member function ‘bool MPEGaudio::WantedSpec(SDL_AudioSpec*)’:
a.cpp:20: error: ‘Play_MPEGaudioSDL’ was not declared in this scope
Ecco il codice:
codice:
//a.h
#include <SDL/SDL.h>
class MPEGaudio {
friend void Play_MPEGaudioSDL(void *udata, Uint8 *stream, int len);
friend int Play_MPEGaudio(MPEGaudio *audio, Uint8 *stream, int len);
#ifdef THREADED_AUDIO
friend int Decode_MPEGaudio(void *udata);
#endif
public:
bool WantedSpec(SDL_AudioSpec *wanted);
private:
static const int bitrate[2][3][15],frequencies[2][3];
int stereobound,subbandnumber,inputstereo,outputstereo;
int layer,protection,bitrateindex,padding,extendedmode;
enum _mpegversion {mpeg1,mpeg2} version;
enum _mode {fullstereo,joint,dual,single} mode;
enum _frequency {frequency44100,frequency48000,frequency32000} frequency;
};
//a.cpp
#include <SDL/SDL.h>
#include "a.h"
bool
MPEGaudio:: WantedSpec(SDL_AudioSpec *wanted)
{
wanted->freq = frequencies[version][frequency];
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
wanted->format = AUDIO_S16LSB;
#else
wanted->format = AUDIO_S16MSB;
#endif
if ( outputstereo ) {
wanted->channels = 2;
} else {
wanted->channels = 1;
}
wanted->samples = 4096;
wanted->callback = Play_MPEGaudioSDL;
wanted->userdata = this;
return true;
}
Grazie!