comparison data/fileio/WavFileWriter.h @ 174:f8cf055dbf34

* Restructure WavFileWriter a bit to permit writing from raw data as well as from an existing model
author Chris Cannam
date Tue, 03 Oct 2006 10:06:37 +0000
parents 1a42221a1522
children b0f4555b625e
comparison
equal deleted inserted replaced
173:058a82e8bc3c 174:f8cf055dbf34
16 #ifndef _WAV_FILE_WRITER_H_ 16 #ifndef _WAV_FILE_WRITER_H_
17 #define _WAV_FILE_WRITER_H_ 17 #define _WAV_FILE_WRITER_H_
18 18
19 #include <QString> 19 #include <QString>
20 20
21 #include <sndfile.h>
22
21 class DenseTimeValueModel; 23 class DenseTimeValueModel;
22 class MultiSelection; 24 class MultiSelection;
23 25
24 class WavFileWriter 26 class WavFileWriter
25 { 27 {
26 public: 28 public:
27 WavFileWriter(QString path, size_t sampleRate, 29 WavFileWriter(QString path, size_t sampleRate, size_t channels);
28 DenseTimeValueModel *source,
29 MultiSelection *selection);
30 virtual ~WavFileWriter(); 30 virtual ~WavFileWriter();
31 31
32 bool isOK() const; 32 bool isOK() const;
33 33
34 virtual QString getError() const; 34 virtual QString getError() const;
35 35
36 void write(); 36 bool writeModel(DenseTimeValueModel *source,
37 MultiSelection *selection = 0);
38
39 bool writeSamples(float **samples, size_t count); // count per channel
40
41 bool close();
37 42
38 protected: 43 protected:
39 QString m_path; 44 QString m_path;
40 size_t m_sampleRate; 45 size_t m_sampleRate;
41 DenseTimeValueModel *m_model; 46 size_t m_channels;
42 MultiSelection *m_selection; 47 SNDFILE *m_file;
43 QString m_error; 48 QString m_error;
44 }; 49 };
45 50
46 51
47 #endif 52 #endif