+////////////////////////////////////////////////////////////////////////////////
+// Name: sndfrmt.h
+// Purpose: wxMMedia
+// Author: Guilhem Lavaux
+// Created: 1998
+// Updated: December 1998
+// Copyright: (C) 1997, 1998, Guilhem Lavaux
+// License: wxWindows license
+////////////////////////////////////////////////////////////////////////////////
#ifndef __SNDFRMT_H__
#define __SNDFRMT_H__
#endif
#include <wx/object.h>
+#include <wx/stream.h>
class wxSndBuffer;
class wxSoundDataFormat {
public:
wxSoundDataFormat();
+ wxSoundDataFormat(const wxSoundDataFormat& format);
~wxSoundDataFormat();
void SetSampleRate(int srate) { m_srate = srate; }
void SetChannels(int channels);
void SetStereo(bool on);
void SetCodecNo(int no);
+ int GetCodecNo() { return m_codno; }
void SetCodecCreate(bool create) { m_codcreate = create; }
int GetSampleRate() const { return m_srate; }
class wxSoundCodec : public wxObject, public wxStreamBase {
DECLARE_ABSTRACT_CLASS(wxSoundCodec)
+ public:
+ typedef enum {
+ WAITING = 0,
+ ENCODING,
+ DECODING
+ } ModeType;
public:
wxSoundCodec();
virtual ~wxSoundCodec();
size_t Available();
void InitIO(const wxSoundDataFormat& format);
- void InitMode(int mode);
- void ExitMode();
+ virtual void InitWith(const wxSoundDataFormat& format) {}
inline void SetInStream(wxStreamBuffer *s)
{ m_in_sound = s; }
inline wxStreamBuffer *GetInStream() const { return m_in_sound; }
inline wxStreamBuffer *GetOutStream() const { return m_out_sound; }
- inline bool Good() const { return (m_in_sound->Stream()->LastError() == wxStream_NOERROR) && (m_out_sound->Stream()->LastError() == wxStream_NOERROR); }
+ inline bool StreamOk() const
+ { return (m_in_sound->Stream()->LastError() == wxStream_NOERROR) &&
+ (m_out_sound->Stream()->LastError() == wxStream_NOERROR); }
virtual size_t GetByteRate() const = 0;
virtual wxSoundDataFormat GetPreferredFormat(int codec = 0) const = 0;
+ virtual void InitMode(ModeType mode);
+ virtual void ExitMode();
virtual void Decode() = 0;
virtual void Encode() = 0;
wxStreamBuffer *m_in_sound, *m_out_sound;
wxSoundCodec *m_chain_codec;
bool m_init, m_chain_before;
-
- enum {
- ENCODING = 0,
- DECODING
- } m_mode;
+ ModeType m_mode;
};
#endif