svcore  1.9
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 _AUDIO_LEVEL_H_
22 #define _AUDIO_LEVEL_H_
23 
35 {
36 public:
37 
38  static const float 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 float multiplier_to_dB(float multiplier);
49  static float dB_to_multiplier(float dB);
50 
51  static float fader_to_dB(int level, int maxLevel, FaderType type);
52  static int dB_to_fader(float dB, int maxFaderLevel, FaderType type);
53 
54  static float fader_to_multiplier(int level, int maxLevel, FaderType type);
55  static int multiplier_to_fader(float 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(float multiplier, int levels);
60  static float preview_to_multiplier(int level, int levels);
61 };
62 
63 
64 #endif
65 
static float multiplier_to_dB(float multiplier)
Definition: AudioLevel.cpp:54
static const float DB_FLOOR
Definition: AudioLevel.h:38
static float fader_to_multiplier(int level, int maxLevel, FaderType type)
Definition: AudioLevel.cpp:208
static float dB_to_multiplier(float dB)
Definition: AudioLevel.cpp:63
static float preview_to_multiplier(int level, int levels)
Definition: AudioLevel.cpp:281
static float fader_to_dB(int level, int maxLevel, FaderType type)
Definition: AudioLevel.cpp:117
AudioLevel converts audio sample levels between various scales:
Definition: AudioLevel.h:34
static int multiplier_to_preview(float multiplier, int levels)
Definition: AudioLevel.cpp:241
static int dB_to_fader(float dB, int maxFaderLevel, FaderType type)
Definition: AudioLevel.cpp:154
static int multiplier_to_fader(float multiplier, int maxFaderLevel, FaderType type)
Definition: AudioLevel.cpp:215