Mercurial > hg > svcore
comparison data/model/WritableWaveFileModel.h @ 175:b0f4555b625e
* Introduce WritableWaveFileModel, and use it as an output model for audio
real-time plugin transforms. Updates aren't working correctly yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Oct 2006 14:17:37 +0000 |
parents | |
children | 0ed2b2e26b44 |
comparison
equal
deleted
inserted
replaced
174:f8cf055dbf34 | 175:b0f4555b625e |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #ifndef _WRITABLE_WAVE_FILE_MODEL_H_ | |
17 #define _WRITABLE_WAVE_FILE_MODEL_H_ | |
18 | |
19 #include "WaveFileModel.h" | |
20 | |
21 class WavFileWriter; | |
22 class WavFileReader; | |
23 | |
24 class WritableWaveFileModel : public RangeSummarisableTimeValueModel, | |
25 virtual public PowerOfSqrtTwoZoomConstraint | |
26 { | |
27 Q_OBJECT | |
28 | |
29 public: | |
30 WritableWaveFileModel(size_t sampleRate, size_t channels, QString path = ""); | |
31 ~WritableWaveFileModel(); | |
32 | |
33 virtual bool addSamples(float **samples, size_t count); | |
34 virtual void sync(); | |
35 | |
36 bool isOK() const; | |
37 bool isReady(int *) const; | |
38 | |
39 size_t getFrameCount() const; | |
40 size_t getChannelCount() const { return m_channels; } | |
41 size_t getSampleRate() const { return m_sampleRate; } | |
42 | |
43 virtual Model *clone() const; | |
44 | |
45 float getValueMinimum() const { return -1.0f; } | |
46 float getValueMaximum() const { return 1.0f; } | |
47 | |
48 virtual size_t getStartFrame() const { return 0; } | |
49 virtual size_t getEndFrame() const { return getFrameCount(); } | |
50 | |
51 virtual size_t getValues(int channel, size_t start, size_t end, | |
52 float *buffer) const; | |
53 | |
54 virtual size_t getValues(int channel, size_t start, size_t end, | |
55 double *buffer) const; | |
56 | |
57 virtual RangeBlock getRanges(size_t channel, size_t start, size_t end, | |
58 size_t &blockSize) const; | |
59 | |
60 virtual Range getRange(size_t channel, size_t start, size_t end) const; | |
61 | |
62 virtual void toXml(QTextStream &out, | |
63 QString indent = "", | |
64 QString extraAttributes = "") const; | |
65 | |
66 virtual QString toXmlString(QString indent = "", | |
67 QString extraAttributes = "") const; | |
68 | |
69 protected: | |
70 WaveFileModel *m_model; | |
71 WavFileWriter *m_writer; | |
72 WavFileReader *m_reader; | |
73 size_t m_sampleRate; | |
74 size_t m_channels; | |
75 size_t m_frameCount; | |
76 }; | |
77 | |
78 #endif | |
79 |