Add logarithmic option
This commit is contained in:
parent
53389dbe54
commit
f2bdcbb402
|
@ -34,6 +34,7 @@
|
||||||
bool Waveform::fill = true;
|
bool Waveform::fill = true;
|
||||||
bool Waveform::outline = true;
|
bool Waveform::outline = true;
|
||||||
bool Waveform::vary_color = true;
|
bool Waveform::vary_color = true;
|
||||||
|
bool Waveform::logarithmic = true;
|
||||||
|
|
||||||
/* TODO: split the variations into separate functions. eg, plain,
|
/* TODO: split the variations into separate functions. eg, plain,
|
||||||
* outlined, filled, polygonal, rectified. */
|
* outlined, filled, polygonal, rectified. */
|
||||||
|
@ -68,6 +69,12 @@ Waveform::draw ( int ox, int X, int Y, int W, int H, Audio_File *_clip, int chan
|
||||||
p.max *= _scale;
|
p.max *= _scale;
|
||||||
p.min *= _scale;
|
p.min *= _scale;
|
||||||
|
|
||||||
|
if ( Waveform::logarithmic )
|
||||||
|
{
|
||||||
|
p.max = 10.0f * log10f( p.max );
|
||||||
|
p.min = 10.0f * log10f( p.min );
|
||||||
|
}
|
||||||
|
|
||||||
const float diff = fabs( p.max - p.min );
|
const float diff = fabs( p.max - p.min );
|
||||||
|
|
||||||
if ( diff > 2.0f )
|
if ( diff > 2.0f )
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
static bool fill;
|
static bool fill;
|
||||||
static bool outline;
|
static bool outline;
|
||||||
static bool vary_color;
|
static bool vary_color;
|
||||||
|
static bool logarithmic;
|
||||||
|
|
||||||
static void draw ( int rx, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color );
|
static void draw ( int rx, int X, int Y, int W, int H, Audio_File *_clip, int channel, float fpp, nframes_t _start, nframes_t _end, float _scale, Fl_Color color );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue