# HG changeset patch # User Chris Cannam # Date 1415985818 0 # Node ID 36f79bc5c3d751409e3075df278168c5d7880f71 # Parent e369dd281cf252031d7e338a5ba859ba490df10d Provide access to local filename diff -r e369dd281cf2 -r 36f79bc5c3d7 data/fileio/AudioFileReader.h --- a/data/fileio/AudioFileReader.h Fri Nov 14 17:23:27 2014 +0000 +++ b/data/fileio/AudioFileReader.h Fri Nov 14 17:23:38 2014 +0000 @@ -62,6 +62,16 @@ */ virtual QString getMaker() const { return ""; } + /** + * Return the local file path of the audio data. This is the + * location most likely to contain readable audio data: it may be + * in a different place or format from the originally specified + * location, for example if the file has been retrieved and + * decoded. In some cases there may be no local file path, and + * this will return "" if there is none. + */ + virtual QString getLocalFilename() const { return ""; } + typedef std::map TagMap; virtual TagMap getTags() const { return TagMap(); } diff -r e369dd281cf2 -r 36f79bc5c3d7 data/fileio/CodedAudioFileReader.h --- a/data/fileio/CodedAudioFileReader.h Fri Nov 14 17:23:27 2014 +0000 +++ b/data/fileio/CodedAudioFileReader.h Fri Nov 14 17:23:38 2014 +0000 @@ -43,6 +43,8 @@ virtual int getNativeRate() const { return m_fileRate; } + virtual QString getLocalFilename() const { return m_cacheFileName; } + /// Intermediate cache means all CodedAudioFileReaders are quickly seekable virtual bool isQuicklySeekable() const { return true; } diff -r e369dd281cf2 -r 36f79bc5c3d7 data/fileio/WavFileReader.h --- a/data/fileio/WavFileReader.h Fri Nov 14 17:23:27 2014 +0000 +++ b/data/fileio/WavFileReader.h Fri Nov 14 17:23:38 2014 +0000 @@ -42,6 +42,8 @@ virtual QString getLocation() const { return m_source.getLocation(); } virtual QString getError() const { return m_error; } + virtual QString getLocalFilename() const { return m_path; } + virtual bool isQuicklySeekable() const { return m_seekable; } /** diff -r e369dd281cf2 -r 36f79bc5c3d7 data/model/AlignmentModel.h --- a/data/model/AlignmentModel.h Fri Nov 14 17:23:27 2014 +0000 +++ b/data/model/AlignmentModel.h Fri Nov 14 17:23:38 2014 +0000 @@ -32,7 +32,7 @@ public: AlignmentModel(Model *reference, Model *aligned, - Model *inputModel, // probably an AggregateWaveModel; I take ownership + Model *inputModel, // probably an AggregateWaveModel; may be null; I take ownership SparseTimeValueModel *path); // I take ownership ~AlignmentModel(); diff -r e369dd281cf2 -r 36f79bc5c3d7 data/model/WaveFileModel.cpp --- a/data/model/WaveFileModel.cpp Fri Nov 14 17:23:27 2014 +0000 +++ b/data/model/WaveFileModel.cpp Fri Nov 14 17:23:38 2014 +0000 @@ -183,6 +183,13 @@ if (m_reader) return m_reader->getLocation(); return ""; } + +QString +WaveFileModel::getLocalFilename() const +{ + if (m_reader) return m_reader->getLocalFilename(); + return ""; +} int WaveFileModel::getData(int channel, int start, int count, diff -r e369dd281cf2 -r 36f79bc5c3d7 data/model/WaveFileModel.h --- a/data/model/WaveFileModel.h Fri Nov 14 17:23:27 2014 +0000 +++ b/data/model/WaveFileModel.h Fri Nov 14 17:23:38 2014 +0000 @@ -52,6 +52,8 @@ QString getMaker() const; QString getLocation() const; + QString getLocalFilename() const; + virtual Model *clone() const; float getValueMinimum() const { return -1.0f; }