annotate data/fileio/CachedFile.h @ 1196:c7b9c902642f spectrogram-minor-refactor

Fix threshold in spectrogram -- it wasn't working in the last release. There is a new protocol for this. Formerly the threshold parameter had a range from -50dB to 0 with the default at -50, and -50 treated internally as "no threshold". However, there was a hardcoded, hidden internal threshold for spectrogram colour mapping at -80dB with anything below this being rounded to zero. Now the threshold parameter has range -81 to -1 with the default at -80, -81 is treated internally as "no threshold", and there is no hidden internal threshold. So the default behaviour is the same as before, an effective -80dB threshold, but it is now possible to change this in both directions. Sessions reloaded from prior versions may look slightly different because, if the session says there should be no threshold, there will now actually be no threshold instead of having the hidden internal one. Still need to do something in the UI to make it apparent that the -81dB setting removes the threshold entirely. This is at least no worse than the previous, also obscured, magic -50dB setting.
author Chris Cannam
date Mon, 01 Aug 2016 16:21:01 +0100
parents b99dc5465b80
children ad5f892c0c4d
rev   line source
Chris@465 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@465 2
Chris@465 3 /*
Chris@465 4 Sonic Visualiser
Chris@465 5 An audio file viewer and annotation editor.
Chris@465 6 Centre for Digital Music, Queen Mary, University of London.
Chris@465 7 This file copyright 2008 QMUL.
Chris@465 8
Chris@465 9 This program is free software; you can redistribute it and/or
Chris@465 10 modify it under the terms of the GNU General Public License as
Chris@465 11 published by the Free Software Foundation; either version 2 of the
Chris@465 12 License, or (at your option) any later version. See the file
Chris@465 13 COPYING included with this distribution for more information.
Chris@465 14 */
Chris@465 15
Chris@465 16 #ifndef _CACHED_FILE_H_
Chris@465 17 #define _CACHED_FILE_H_
Chris@465 18
Chris@465 19 #include <QString>
Chris@465 20 #include <QUrl>
Chris@465 21 #include <QDateTime>
Chris@481 22 #include <map>
Chris@465 23
Chris@465 24 class ProgressReporter;
Chris@465 25
Chris@465 26 class CachedFile
Chris@465 27 {
Chris@465 28 public:
Chris@520 29 CachedFile(QString fileOrUrl,
Chris@520 30 ProgressReporter *reporter = 0,
Chris@520 31 QString preferredContentType = "");
Chris@520 32 CachedFile(QUrl url,
Chris@520 33 ProgressReporter *reporter = 0,
Chris@520 34 QString preferredContentType = "");
Chris@465 35
Chris@465 36 virtual ~CachedFile();
Chris@465 37
Chris@465 38 bool isOK() const;
Chris@465 39
Chris@465 40 QString getLocalFilename() const;
Chris@465 41
Chris@465 42 protected:
Chris@468 43 QString m_origin;
Chris@465 44 QString m_localFilename;
Chris@520 45 QString m_preferredContentType;
Chris@466 46 ProgressReporter *m_reporter;
Chris@465 47 bool m_ok;
Chris@465 48
Chris@691 49 void checkFile();
Chris@465 50 bool retrieve();
Chris@465 51
Chris@465 52 QDateTime getLastRetrieval();
Chris@465 53 void updateLastRetrieval(bool successful);
Chris@465 54
Chris@465 55 static QString getCacheDirectory();
Chris@465 56 static QString getLocalFilenameFor(QUrl url);
Chris@481 57
Chris@481 58 typedef std::map<QString, QString> OriginLocalFilenameMap;
Chris@481 59 static OriginLocalFilenameMap m_knownGoodCaches;
Chris@465 60 };
Chris@465 61
Chris@465 62 #endif