wxWidgets/utils/wxMMedia2/lib/sndfile.h
Guilhem Lavaux 526ddb13e2 Removed wxMMedia
Added wxMMedia2: it should work on linux (wave read/write, aiff read only)
      I begin to write windows driver now

Added some file to filelist.txt
Make configure build wxMMedia2 makefiles


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1999-08-14 12:06:35 +00:00

100 lines
2.3 KiB
C++

// --------------------------------------------------------------------------
// Name: sndfile.h
// Purpose:
// Date: 08/11/1999
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
// CVSID: $Id$
// --------------------------------------------------------------------------
#ifndef _WX_SNDFILE_H
#define _WX_SNDFILE_H
#include <wx/defs.h>
#include <wx/stream.h>
#include <stdlib.h>
#include "sndbase.h"
#include "sndcodec.h"
#define wxSOUND_INFINITE_TIME ((unsigned long)-1)
//
// Codec router class
//
class WXDLLEXPORT wxSoundRouterStream: public wxSoundStreamCodec {
public:
wxSoundRouterStream(wxSoundStream& sndio);
~wxSoundRouterStream();
wxSoundStream& Read(void *buffer, size_t len);
wxSoundStream& Write(const void *buffer, size_t len);
bool SetSoundFormat(const wxSoundFormatBase& format);
bool StartProduction(int evt);
bool StopProduction();
protected:
wxSoundStream *m_router;
};
typedef enum {
wxSOUND_FILE_STOPPED,
wxSOUND_FILE_PAUSED,
wxSOUND_FILE_PLAYING,
wxSOUND_FILE_RECORDING
} wxSoundFileState;
//
// Base class for file coders/decoders
//
class wxSoundFileStream: public wxSoundStream {
public:
wxSoundFileStream(wxInputStream& stream, wxSoundStream& io_sound);
wxSoundFileStream(wxOutputStream& stream, wxSoundStream& io_sound);
~wxSoundFileStream();
bool Play();
bool Record(unsigned long time);
bool Stop();
bool Pause();
bool Resume();
bool IsStopped() const { return m_state == wxSOUND_FILE_STOPPED; }
bool StartProduction(int evt);
bool StopProduction();
unsigned long GetLength() const;
wxSoundStream& Read(void *buffer, size_t len);
wxSoundStream& Write(const void *buffer, size_t len);
void SetDuplexMode(bool duplex);
bool SetSoundFormat(const wxSoundFormatBase& format);
virtual bool CanRead() { return TRUE; }
protected:
wxSoundRouterStream m_codec;
wxSoundStream *m_sndio;
wxInputStream *m_input;
wxOutputStream *m_output;
wxSoundFileState m_state, m_oldstate;
wxUint32 m_len;
protected:
virtual bool PrepareToPlay() = 0;
virtual bool PrepareToRecord(unsigned long time) = 0;
virtual bool FinishRecording() = 0;
virtual size_t GetData(void *buffer, size_t len) = 0;
virtual size_t PutData(const void *buffer, size_t len) = 0;
void OnSoundEvent(int evt);
};
#endif