Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.h @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | 1c9bbbb6116a |
children | c01cbe41aeb5 |
comparison
equal
deleted
inserted
replaced
1324:d4a28d1479a8 | 1527:710e6250a401 |
---|---|
11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef _CODED_AUDIO_FILE_READER_H_ | 16 #ifndef SV_CODED_AUDIO_FILE_READER_H |
17 #define _CODED_AUDIO_FILE_READER_H_ | 17 #define SV_CODED_AUDIO_FILE_READER_H |
18 | 18 |
19 #include "AudioFileReader.h" | 19 #include "AudioFileReader.h" |
20 | 20 |
21 #include <sndfile.h> | |
22 #include <QMutex> | 21 #include <QMutex> |
23 #include <QReadWriteLock> | 22 #include <QReadWriteLock> |
23 | |
24 #ifdef Q_OS_WIN | |
25 #include <windows.h> | |
26 #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1 | |
27 #endif | |
28 | |
29 #include <sndfile.h> | |
24 | 30 |
25 class WavFileReader; | 31 class WavFileReader; |
26 class Serialiser; | 32 class Serialiser; |
27 | 33 |
28 namespace breakfastquay { | 34 namespace breakfastquay { |
44 enum DecodeMode { | 50 enum DecodeMode { |
45 DecodeAtOnce, // decode the file on construction, with progress | 51 DecodeAtOnce, // decode the file on construction, with progress |
46 DecodeThreaded // decode in a background thread after construction | 52 DecodeThreaded // decode in a background thread after construction |
47 }; | 53 }; |
48 | 54 |
49 virtual std::vector<float> getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; | 55 virtual floatvec_t getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; |
50 | 56 |
51 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } | 57 virtual sv_samplerate_t getNativeRate() const { return m_fileRate; } |
52 | 58 |
53 virtual QString getLocalFilename() const { return m_cacheFileName; } | 59 virtual QString getLocalFilename() const { return m_cacheFileName; } |
54 | 60 |
69 void setFramesToTrim(sv_frame_t fromStart, sv_frame_t fromEnd); | 75 void setFramesToTrim(sv_frame_t fromStart, sv_frame_t fromEnd); |
70 | 76 |
71 // may throw InsufficientDiscSpace: | 77 // may throw InsufficientDiscSpace: |
72 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); | 78 void addSamplesToDecodeCache(float **samples, sv_frame_t nframes); |
73 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); | 79 void addSamplesToDecodeCache(float *samplesInterleaved, sv_frame_t nframes); |
74 void addSamplesToDecodeCache(const std::vector<float> &interleaved); | 80 void addSamplesToDecodeCache(const floatvec_t &interleaved); |
75 | 81 |
76 // may throw InsufficientDiscSpace: | 82 // may throw InsufficientDiscSpace: |
77 void finishDecodeCache(); | 83 void finishDecodeCache(); |
78 | 84 |
79 bool isDecodeCacheInitialised() const { return m_initialised; } | 85 bool isDecodeCacheInitialised() const { return m_initialised; } |
93 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); | 99 void pushBufferNonResampling(float *interleaved, sv_frame_t sz); |
94 | 100 |
95 protected: | 101 protected: |
96 QMutex m_cacheMutex; | 102 QMutex m_cacheMutex; |
97 CacheMode m_cacheMode; | 103 CacheMode m_cacheMode; |
98 std::vector<float> m_data; | 104 floatvec_t m_data; |
99 mutable QMutex m_dataLock; | 105 mutable QMutex m_dataLock; |
100 bool m_initialised; | 106 bool m_initialised; |
101 Serialiser *m_serialiser; | 107 Serialiser *m_serialiser; |
102 sv_samplerate_t m_fileRate; | 108 sv_samplerate_t m_fileRate; |
103 | 109 |