+ Responder ao Tópico



  1. #1
    Barata_Branca_Do_Esgoto
    Visitante

    Padrão o que está errado nesse C++?

    e ai galera.. blz? altas horas da noite... e nois acordado aki... olha soh, quando eu vou compilar ele diz q esse código aki está errado... me digam o que pode estar errado...
    F L W!!!

    Código :
    class WaveHeader : public WAVEHDR -->>DIZ QUE AQUI ESTA ERRADO
    {
    public:
    	-->>DIZ QUE AQUI ESTA ERRADO bool isDone() const { return dwFlags & WHDR_DONE ; } ;
    } ;
     
    class WaveFormat : public WAVEFORMATEX
    {
    public:
    	WaveFormat( DWORD rate, WORD chan, WORD bits )
    	{
    		wFormatTag = WAVE_FORMAT_PCM ;
    		-->>DIZ QUE AQUI ESTA ERRADO nChannels = chan ;
    		-->>DIZ QUE AQUI ESTA ERRADOnSamplesPerSec = rate ;
    		-->>DIZ QUE AQUI ESTA ERRADOnAvgBytesPerSec = chan * rate * bits / 8 ;
    		nBlockAlign = chan * bits / 8 ;
    		wBitsPerSample = bits ;
    		cbSize = 0 ;
    	} ;
    } ;
     
     
    class WaveIn
    {
    public:
     
    	WaveIn() : status( MMSYSERR_BADDEVICEID ) {} ;
    	~WaveIn() { if( ok() ) { Stop(); Reset() ; Close() ; } ; } ;
     
    	bool Open( HWND, UINT, WaveFormat& ) ;
    	bool Close() ;
    	void Reset() { if( ok() ) waveInReset( hWave ) ; } ;
     
    	void Start() { waveInStart( hWave ) ; } ;
    	void Stop() { waveInStop( hWave ) ; } ;
     
    	void Prepare( WaveHeader* ) ;
    	void UnPrepare( WaveHeader* ) ;
    	void Send( WaveHeader* ) ;
     
    	LPSTR queryError() ;
    	LPCSTR queryTitle() { return "WaveAudio Input Engine" ; } ;
    	bool ok() { return status == 0 ; } ;
    	bool isInUse() { return status == MMSYSERR_ALLOCATED ; } ;
     
    private:
     
    	HWAVEIN hWave ;
    	UINT status ;
    	char errorText[164] ;
    } ;
     
    class Recorder
    {
    	enum { NUM_BUF = 8 } ;
    public:
    	Recorder( WORD cSamples, DWORD cSamplesPerSec, WORD nChannels, WORD bits ) ;
    	~Recorder() ;
     
    	bool Start( HWND hwnd ) ;
    	void Stop() ;
     
    	bool isBufferDone() const { return _header[_iBuf].isDone() ; } ;
    	bool BufferDone() ;
     
    	bool FillVector( svector<double>& ) ;
     
    	WORD SampleCount() const { return _cSamples ; } ;
    	DWORD SamplesPerSec() const { return _cSamplesPerSec ; } ;
    	WORD Bits() const { return _bits ; } ;
    	WORD Channels() const { return _nChannels ; } ;
     
    protected:
     
    	WaveIn _wave ;
    	int _iBuf ;
     
    	WORD _cSamples ;
    	DWORD _cSamplesPerSec ;
    	WORD _nChannels ;
    	WORD _bits ;
    	WORD _cbBuf ;
     
    	WaveHeader _header [ NUM_BUF ] ;
    	LPSTR _dataPool ;
    	svector<int> avoid_errors ;
    } ;
     
    inline bool WaveIn::Open( HWND hWnd, UINT id, WaveFormat& fmt )
    {
    	status = waveInOpen( &hWave, id, &fmt, (DWORD)hWnd, NULL, CALLBACK_WINDOW ) ;
    	return ok() ;
    } ;
     
    inline bool WaveIn::Close()
    {
    	if( waveInClose( hWave ) == 0 && ok() )
    	{
    		status = MMSYSERR_BADDEVICEID ;
    		return true ;
    	} ;
    	return false ;
    } ;
     
    inline void WaveIn::Prepare( WaveHeader* phdr )
    {
    	waveInPrepareHeader( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline void WaveIn::UnPrepare( WaveHeader* phdr )
    {
    	waveInUnprepareHeader( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline void WaveIn::Send( WaveHeader* phdr )
    {
    	waveInAddBuffer( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline LPSTR WaveIn::queryError()
    {
    	waveInGetErrorText( status, errorText, sizeof(errorText) ) ;
    	return errorText ;
    } ;class WaveHeader : public WAVEHDR
    {
    public:
    	bool isDone() const { return dwFlags & WHDR_DONE ; } ;
    } ;
     
    class WaveFormat : public WAVEFORMATEX
    {
    public:
    	WaveFormat( DWORD rate, WORD chan, WORD bits )
    	{
    		wFormatTag = WAVE_FORMAT_PCM ;
    		nChannels = chan ;
    		nSamplesPerSec = rate ;
    		nAvgBytesPerSec = chan * rate * bits / 8 ;
    		nBlockAlign = chan * bits / 8 ;
    		wBitsPerSample = bits ;
    		cbSize = 0 ;
    	} ;
    } ;
     
     
    class WaveIn
    {
    public:
     
    	WaveIn() : status( MMSYSERR_BADDEVICEID ) {} ;
    	~WaveIn() { if( ok() ) { Stop(); Reset() ; Close() ; } ; } ;
     
    	bool Open( HWND, UINT, WaveFormat& ) ;
    	bool Close() ;
    	void Reset() { if( ok() ) waveInReset( hWave ) ; } ;
     
    	void Start() { waveInStart( hWave ) ; } ;
    	void Stop() { waveInStop( hWave ) ; } ;
     
    	void Prepare( WaveHeader* ) ;
    	void UnPrepare( WaveHeader* ) ;
    	void Send( WaveHeader* ) ;
     
    	LPSTR queryError() ;
    	LPCSTR queryTitle() { return "WaveAudio Input Engine" ; } ;
    	bool ok() { return status == 0 ; } ;
    	bool isInUse() { return status == MMSYSERR_ALLOCATED ; } ;
     
    private:
     
    	HWAVEIN hWave ;
    	UINT status ;
    	char errorText[164] ;
    } ;
     
    class Recorder
    {
    	enum { NUM_BUF = 8 } ;
    public:
    	Recorder( WORD cSamples, DWORD cSamplesPerSec, WORD nChannels, WORD bits ) ;
    	~Recorder() ;
     
    	bool Start( HWND hwnd ) ;
    	void Stop() ;
     
    	bool isBufferDone() const { return _header[_iBuf].isDone() ; } ;
    	bool BufferDone() ;
     
    	bool FillVector( svector<double>& ) ;
     
    	WORD SampleCount() const { return _cSamples ; } ;
    	DWORD SamplesPerSec() const { return _cSamplesPerSec ; } ;
    	WORD Bits() const { return _bits ; } ;
    	WORD Channels() const { return _nChannels ; } ;
     
    protected:
     
    	WaveIn _wave ;
    	int _iBuf ;
     
    	WORD _cSamples ;
    	DWORD _cSamplesPerSec ;
    	WORD _nChannels ;
    	WORD _bits ;
    	WORD _cbBuf ;
     
    	WaveHeader _header [ NUM_BUF ] ;
    	LPSTR _dataPool ;
    	svector<int> avoid_errors ;
    } ;
     
    inline bool WaveIn::Open( HWND hWnd, UINT id, WaveFormat& fmt )
    {
    	-->>DIZ QUE AQUI ESTA ERRADO status = waveInOpen( &hWave, id, &fmt, (DWORD)hWnd, NULL, CALLBACK_WINDOW ) ;
    	return ok() ;
    } ;
     
    inline bool WaveIn::Close()
    {
    	if( waveInClose( hWave ) == 0 && ok() )
    	{
    		status = MMSYSERR_BADDEVICEID ;
    		return true ;
    	} ;
    	return false ;
    } ;
     
    inline void WaveIn::Prepare( WaveHeader* phdr )
    {
    	waveInPrepareHeader( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline void WaveIn::UnPrepare( WaveHeader* phdr )
    {
    	waveInUnprepareHeader( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline void WaveIn::Send( WaveHeader* phdr )
    {
    	waveInAddBuffer( hWave, phdr, sizeof(WAVEHDR) ) ;
    } ;
     
    inline LPSTR WaveIn::queryError()
    {
    	waveInGetErrorText( status, errorText, sizeof(errorText) ) ;
    	return errorText ;
    } ;


    FLWWWWWWWWWWWWWWWWWWW!

  2. #2
    Barata_Branca_Do_Esgoto
    Visitante

    Padrão o que está errado nesse C++?

    bem, acordei agora poko, só to comentando msm pra ver se alguem responde... ...
    FLWWWWWWWWWWWWWWWWWW!!!

  3. #3