annotate layer/PaintAssistant.h @ 1127:9fb8dfd7ce4c 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 ee01a4062747
children dc6457ac4d07
rev   line source
Chris@195 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@195 2
Chris@195 3 /*
Chris@195 4 Sonic Visualiser
Chris@195 5 An audio file viewer and annotation editor.
Chris@195 6 Centre for Digital Music, Queen Mary, University of London.
Chris@195 7 This file copyright 2006-2007 Chris Cannam and QMUL.
Chris@195 8
Chris@195 9 This program is free software; you can redistribute it and/or
Chris@195 10 modify it under the terms of the GNU General Public License as
Chris@195 11 published by the Free Software Foundation; either version 2 of the
Chris@195 12 License, or (at your option) any later version. See the file
Chris@195 13 COPYING included with this distribution for more information.
Chris@195 14 */
Chris@195 15
Chris@1078 16 #ifndef PAINT_ASSISTANT_H
Chris@1078 17 #define PAINT_ASSISTANT_H
Chris@195 18
Chris@195 19 #include <QRect>
Chris@195 20 #include <vector>
Chris@195 21
Chris@195 22 class QPainter;
Chris@1078 23 class Layer;
Chris@1078 24 class LayerGeometryProvider;
Chris@195 25
Chris@195 26 class PaintAssistant
Chris@195 27 {
Chris@195 28 public:
Chris@195 29 enum Scale { LinearScale, MeterScale, dBScale };
Chris@195 30
Chris@195 31 static void paintVerticalLevelScale(QPainter &p, QRect rect,
Chris@905 32 double minVal, double maxVal,
Chris@220 33 Scale scale, int &multRtn,
Chris@195 34 std::vector<int> *markCoordRtns = 0);
Chris@195 35
Chris@905 36 static int getYForValue(Scale scale, double value,
Chris@905 37 double minVal, double maxVal,
Chris@195 38 int minY, int height);
Chris@1078 39
Chris@1078 40 enum TextStyle {
Chris@1078 41 BoxedText,
Chris@1078 42 OutlinedText,
Chris@1078 43 OutlinedItalicText
Chris@1078 44 };
Chris@1078 45
Chris@1078 46 static void drawVisibleText(const LayerGeometryProvider *,
Chris@1078 47 QPainter &p, int x, int y,
Chris@1078 48 QString text, TextStyle style);
Chris@195 49 };
Chris@195 50
Chris@195 51 #endif