00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ABSTRACTAUDIOWRITER_H
00023 #define ABSTRACTAUDIOWRITER_H
00024
00025 #include "defines.h"
00026
00027 class QString;
00028
00029 class AbstractAudioWriter
00030 {
00031
00032 public:
00033 AbstractAudioWriter();
00034 virtual ~AbstractAudioWriter();
00035
00036 virtual const char* get_extension() = 0;
00037
00038 void set_num_channels(int channels);
00039 void set_bits_per_sample(int bits);
00040 void set_rate(int rate);
00041 virtual bool set_format_attribute(const QString& key, const QString& value);
00042 nframes_t pos();
00043
00044 bool open(const QString& filename);
00045 nframes_t write(void* buffer, nframes_t frameCount);
00046 bool close();
00047
00048 static AbstractAudioWriter* create_audio_writer(const QString& type);
00049
00050 protected:
00051 virtual bool open_private() = 0;
00052 virtual nframes_t write_private(void* buffer, nframes_t frameCount) = 0;
00053 virtual bool close_private() = 0;
00054
00055 QString m_fileName;
00056 bool m_isOpen;
00057 int m_sampleWidth;
00058 nframes_t m_writePos;
00059 int m_channels;
00060 int m_rate;
00061 };
00062
00063 #endif