Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.h @ 148:1a42221a1522
* Reorganising code base. This revision will not compile.
author | Chris Cannam |
---|---|
date | Mon, 31 Jul 2006 11:49:58 +0000 |
parents | |
children | 71dfc6ab3b54 |
comparison
equal
deleted
inserted
replaced
147:3a13b0d4934e | 148:1a42221a1522 |
---|---|
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 _CODED_AUDIO_FILE_READER_H_ | |
17 #define _CODED_AUDIO_FILE_READER_H_ | |
18 | |
19 #include "AudioFileReader.h" | |
20 | |
21 #include <sndfile.h> | |
22 | |
23 class WavFileReader; | |
24 | |
25 class CodedAudioFileReader : public AudioFileReader | |
26 { | |
27 public: | |
28 virtual ~CodedAudioFileReader(); | |
29 | |
30 enum CacheMode { | |
31 CacheInTemporaryFile, | |
32 CacheInMemory | |
33 }; | |
34 | |
35 virtual void getInterleavedFrames(size_t start, size_t count, | |
36 SampleBlock &frames) const; | |
37 | |
38 protected: | |
39 CodedAudioFileReader(CacheMode cacheMode); | |
40 | |
41 void initialiseDecodeCache(); // samplerate, channels must have been set | |
42 void addSampleToDecodeCache(float sample); | |
43 void finishDecodeCache(); | |
44 bool isDecodeCacheInitialised() const { return m_initialised; } | |
45 | |
46 CacheMode m_cacheMode; | |
47 SampleBlock m_data; | |
48 bool m_initialised; | |
49 | |
50 QString m_cacheFileName; | |
51 SNDFILE *m_cacheFileWritePtr; | |
52 WavFileReader *m_cacheFileReader; | |
53 float *m_cacheWriteBuffer; | |
54 size_t m_cacheWriteBufferIndex; | |
55 size_t m_cacheWriteBufferSize; // frames | |
56 }; | |
57 | |
58 #endif |