comparison data/fileio/AudioFileReaderFactory.h @ 392:183ee2a55fc7

* More work to abstract out interactive components used in the data library, so that it does not need to depend on QtGui.
author Chris Cannam
date Fri, 14 Mar 2008 17:14:21 +0000
parents 1d656dcda8ef
children f3cda3280398 59e7fe1b1003
comparison
equal deleted inserted replaced
391:5858cc462d0a 392:183ee2a55fc7
19 #include <QString> 19 #include <QString>
20 20
21 #include "FileSource.h" 21 #include "FileSource.h"
22 22
23 class AudioFileReader; 23 class AudioFileReader;
24 class ProgressReporter;
24 25
25 class AudioFileReaderFactory 26 class AudioFileReaderFactory
26 { 27 {
27 public: 28 public:
28 /** 29 /**
40 * If targetRate is non-zero, the file will be resampled to that 41 * If targetRate is non-zero, the file will be resampled to that
41 * rate (transparently). You can query reader->getNativeRate() 42 * rate (transparently). You can query reader->getNativeRate()
42 * if you want to find out whether the file is being resampled 43 * if you want to find out whether the file is being resampled
43 * or not. 44 * or not.
44 * 45 *
46 * If a ProgressReporter is provided, it will be updated with
47 * progress status. Caller retains ownership of the reporter
48 * object.
49 *
45 * Caller owns the returned object and must delete it after use. 50 * Caller owns the returned object and must delete it after use.
46 */ 51 */
47 static AudioFileReader *createReader(FileSource source, 52 static AudioFileReader *createReader(FileSource source,
48 size_t targetRate = 0); 53 size_t targetRate = 0,
54 ProgressReporter *reporter = 0);
49 55
50 /** 56 /**
51 * Return an audio file reader initialised to the file at the 57 * Return an audio file reader initialised to the file at the
52 * given path, or NULL if no suitable reader for this path is 58 * given path, or NULL if no suitable reader for this path is
53 * available or the file cannot be opened. If the reader supports 59 * available or the file cannot be opened. If the reader supports
57 * If targetRate is non-zero, the file will be resampled to that 63 * If targetRate is non-zero, the file will be resampled to that
58 * rate (transparently). You can query reader->getNativeRate() 64 * rate (transparently). You can query reader->getNativeRate()
59 * if you want to find out whether the file is being resampled 65 * if you want to find out whether the file is being resampled
60 * or not. 66 * or not.
61 * 67 *
68 * If a ProgressReporter is provided, it will be updated with
69 * progress status. This will only be meaningful if threading
70 * mode is not used because the file reader in use does not
71 * support it; otherwise progress as reported will jump straight
72 * to 100% before threading mode takes over. Caller retains
73 * ownership of the reporter object.
74 *
62 * Caller owns the returned object and must delete it after use. 75 * Caller owns the returned object and must delete it after use.
63 */ 76 */
64 static AudioFileReader *createThreadingReader(FileSource source, 77 static AudioFileReader *createThreadingReader(FileSource source,
65 size_t targetRate = 0); 78 size_t targetRate = 0,
79 ProgressReporter *reporter = 0);
66 80
67 protected: 81 protected:
68 static AudioFileReader *create(FileSource source, 82 static AudioFileReader *create(FileSource source,
69 size_t targetRate, 83 size_t targetRate,
70 bool threading); 84 bool threading,
85 ProgressReporter *reporter);
71 }; 86 };
72 87
73 #endif 88 #endif
74 89