comparison data/fileio/AudioFileReader.h @ 1809:73447d746db3

Comments and debug-related bits
author Chris Cannam
date Tue, 29 Oct 2019 12:46:43 +0000
parents ce185d4dd408
children
comparison
equal deleted inserted replaced
1808:871a2050236b 1809:73447d746db3
68 */ 68 */
69 virtual sv_samplerate_t getNativeRate() const { return m_sampleRate; } 69 virtual sv_samplerate_t getNativeRate() const { return m_sampleRate; }
70 70
71 /** 71 /**
72 * Return the location of the audio data in the reader (as passed 72 * Return the location of the audio data in the reader (as passed
73 * in to the FileSource constructor, for example). 73 * in to the FileSource constructor, for example). This might be a
74 * remote URL.
75 *
76 * See also getLocalFilename().
74 */ 77 */
75 virtual QString getLocation() const { return ""; } 78 virtual QString getLocation() const = 0;
79
80 /**
81 * Return the local file path of the audio data. This is the
82 * filesystem location most likely to contain readable audio data,
83 * but it may be in a different place or format from the
84 * originally specified location - for example, if the file has
85 * been retrieved and decoded, then it will be the (possibly
86 * temporary) decode target file.
87 *
88 * This returns a non-empty value only if there is some local
89 * filename that contains exactly the audio data being provided by
90 * this reader. In some cases this may not exist, for example when
91 * a file has been resampled or normalised directly into a memory
92 * buffer. In this case, return an empty string.
93 *
94 * See also getLocation().
95 */
96 virtual QString getLocalFilename() const = 0;
76 97
77 /** 98 /**
78 * Return the title of the work in the audio file, if known. This 99 * Return the title of the work in the audio file, if known. This
79 * may be implemented by subclasses that support file tagging. 100 * may be implemented by subclasses that support file tagging.
80 * This is not the same thing as the file name. 101 * This is not the same thing as the file name.
87 * conductor, artist etc). 108 * conductor, artist etc).
88 */ 109 */
89 virtual QString getMaker() const = 0; 110 virtual QString getMaker() const = 0;
90 111
91 /** 112 /**
92 * Return the local file path of the audio data. This is the 113 * Return any tag pairs picked up from the audio file. See also
93 * location most likely to contain readable audio data: it may be 114 * getTitle and getMaker, and note that a reader which does not
94 * in a different place or format from the originally specified 115 * implement getTags may still return values from those.
95 * location, for example if the file has been retrieved and
96 * decoded. In some cases there may be no local file path, and
97 * this will return "" if there is none.
98 */ 116 */
99 virtual QString getLocalFilename() const { return ""; }
100
101 typedef std::map<QString, QString> TagMap; 117 typedef std::map<QString, QString> TagMap;
102 virtual TagMap getTags() const { return TagMap(); } 118 virtual TagMap getTags() const { return TagMap(); }
103 119
104 /** 120 /**
105 * Return true if this file supports fast seek and random 121 * Return true if this file supports fast seek and random
106 * access. Typically this will be true for uncompressed formats 122 * access. Typically this will be true for uncompressed formats
107 * and false for compressed ones. 123 * and false for compressed ones.
108 */ 124 */
109 virtual bool isQuicklySeekable() const = 0; 125 virtual bool isQuicklySeekable() const = 0;
126
127 /**
128 * Return a percentage value indicating how far through decoding
129 * the audio file we are. This should be implemented by subclasses
130 * that will not know exactly how long the audio file is (in
131 * sample frames) until it has been completely decoded. A reader
132 * that initialises the frame count directly within its
133 * constructor should always return 100 from this.
134 */
135 virtual int getDecodeCompletion() const { return 100; }
136
137 /**
138 * Return true if decoding is still in progress and the frame
139 * count may change.
140 */
141 virtual bool isUpdating() const { return false; }
110 142
111 /** 143 /**
112 * Return interleaved samples for count frames from index start. 144 * Return interleaved samples for count frames from index start.
113 * The resulting vector will contain count * getChannelCount() 145 * The resulting vector will contain count * getChannelCount()
114 * samples (or fewer if end of file is reached). 146 * samples (or fewer if end of file is reached).
128 * each (or fewer if end of file is reached). 160 * each (or fewer if end of file is reached).
129 */ 161 */
130 virtual std::vector<floatvec_t> getDeInterleavedFrames(sv_frame_t start, 162 virtual std::vector<floatvec_t> getDeInterleavedFrames(sv_frame_t start,
131 sv_frame_t count) const; 163 sv_frame_t count) const;
132 164
133 // only subclasses that do not know exactly how long the audio
134 // file is until it's been completely decoded should implement this
135 virtual int getDecodeCompletion() const { return 100; } // %
136
137 virtual bool isUpdating() const { return false; }
138
139 signals: 165 signals:
140 void frameCountChanged(); 166 void frameCountChanged();
141 167
142 protected: 168 protected:
143 sv_frame_t m_frameCount; 169 sv_frame_t m_frameCount;