AudioLevel.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 */
14 
15 /*
16  This is a modified version of a source file from the
17  Rosegarden MIDI and audio sequencer and notation editor.
18  This file copyright 2000-2006 Chris Cannam.
19 */
20 
21 #ifndef SV_AUDIO_LEVEL_H
22 #define SV_AUDIO_LEVEL_H
23 
35 {
36 public:
37 
38  static const double DB_FLOOR;
39 
40  enum FaderType {
41  ShortFader = 0, // -40 -> +6 dB
42  LongFader = 1, // -70 -> +10 dB
43  IEC268Meter = 2, // -70 -> 0 dB
44  IEC268LongMeter = 3, // -70 -> +10 dB (0dB aligns with LongFader)
46  };
47 
48  static double multiplier_to_dB(double multiplier);
49  static double dB_to_multiplier(double dB);
50 
51  static double fader_to_dB(int level, int maxLevel, FaderType type);
52  static int dB_to_fader(double dB, int maxFaderLevel, FaderType type);
53 
54  static double fader_to_multiplier(int level, int maxLevel, FaderType type);
55  static int multiplier_to_fader(double multiplier, int maxFaderLevel,
56  FaderType type);
57 
58  // fast if "levels" doesn't change often -- for audio segment previews
59  static int multiplier_to_preview(double multiplier, int levels);
60  static double preview_to_multiplier(int level, int levels);
61 };
62 
63 
64 #endif
65 
static double preview_to_multiplier(int level, int levels)
Definition: AudioLevel.cpp:227
static double fader_to_multiplier(int level, int maxLevel, FaderType type)
Definition: AudioLevel.cpp:204
static double multiplier_to_dB(double multiplier)
Definition: AudioLevel.cpp:50
static int multiplier_to_preview(double multiplier, int levels)
Definition: AudioLevel.cpp:220
static const double DB_FLOOR
Definition: AudioLevel.h:38
static int multiplier_to_fader(double multiplier, int maxFaderLevel, FaderType type)
Definition: AudioLevel.cpp:211
AudioLevel converts audio sample levels between various scales:
Definition: AudioLevel.h:34
static int dB_to_fader(double dB, int maxFaderLevel, FaderType type)
Definition: AudioLevel.cpp:150
static double fader_to_dB(int level, int maxLevel, FaderType type)
Definition: AudioLevel.cpp:113
static double dB_to_multiplier(double dB)
Definition: AudioLevel.cpp:59