annotate layer/PianoScale.h @ 1238:4d0ca1ab4cd0
Some work to make spectrum layers (and slice layers generally) zoomable in the frequency axis. Also fixes a number of view id mixups in SliceLayer which broke offset calculations for the x axis scale.
author |
Chris Cannam |
date |
Tue, 07 Feb 2017 14:55:19 +0000 |
parents |
4fe7a09be0fe |
children |
b4cb11ca8233 |
rev |
line source |
Chris@690
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@690
|
2
|
Chris@690
|
3 /*
|
Chris@690
|
4 Sonic Visualiser
|
Chris@690
|
5 An audio file viewer and annotation editor.
|
Chris@690
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@690
|
7 This file copyright 2006-2013 Chris Cannam and QMUL.
|
Chris@690
|
8
|
Chris@690
|
9 This program is free software; you can redistribute it and/or
|
Chris@690
|
10 modify it under the terms of the GNU General Public License as
|
Chris@690
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@690
|
12 License, or (at your option) any later version. See the file
|
Chris@690
|
13 COPYING included with this distribution for more information.
|
Chris@690
|
14 */
|
Chris@690
|
15
|
Chris@690
|
16 #ifndef PIANO_SCALE_H
|
Chris@690
|
17 #define PIANO_SCALE_H
|
Chris@690
|
18
|
Chris@690
|
19 #include <QRect>
|
Chris@690
|
20
|
Chris@690
|
21 class QPainter;
|
Chris@918
|
22 class LayerGeometryProvider;
|
Chris@690
|
23
|
Chris@690
|
24 class PianoScale
|
Chris@690
|
25 {
|
Chris@690
|
26 public:
|
Chris@690
|
27 void paintPianoVertical
|
Chris@917
|
28 (LayerGeometryProvider *v, QPainter &paint, QRect rect, double minf, double maxf);
|
Chris@1238
|
29
|
Chris@1238
|
30 class HorizontalScaleProvider {
|
Chris@1238
|
31 public:
|
Chris@1238
|
32 virtual double getFrequencyForX(const LayerGeometryProvider *, double x) const = 0;
|
Chris@1238
|
33 virtual double getXForFrequency(const LayerGeometryProvider *, double freq) const = 0;
|
Chris@1238
|
34 };
|
Chris@1238
|
35
|
Chris@1238
|
36 void paintPianoHorizontal
|
Chris@1238
|
37 (LayerGeometryProvider *v, const HorizontalScaleProvider *p,
|
Chris@1238
|
38 QPainter &paint, QRect rect);
|
Chris@690
|
39 };
|
Chris@690
|
40
|
Chris@690
|
41 #endif
|
Chris@690
|
42
|
Chris@690
|
43
|
Chris@690
|
44
|