13
0

add configurable clipping level to Canvas::WaveView

This commit is contained in:
Paul Davis 2013-12-30 15:46:44 -05:00
parent 2d50adaf3a
commit 7158eb7565
2 changed files with 13 additions and 1 deletions

View File

@ -115,6 +115,9 @@ public:
void set_amplitude_above_axis (double v);
double amplitude_above_axis () const { return _amplitude_above_axis; }
static void set_clip_level (double dB);
static PBD::Signal0<void> ClipLevelChanged;
#ifdef CANVAS_COMPATIBILITY
void*& property_gain_src () {
return _foo_void;
@ -163,6 +166,7 @@ private:
static bool _global_logscaled;
static Shape _global_shape;
static bool _global_show_waveform_clipping;
static double _clip_level;
static PBD::Signal0<void> VisualPropertiesChanged;

View File

@ -45,6 +45,7 @@ double WaveView::_global_gradient_depth = 0.6;
bool WaveView::_global_logscaled = false;
WaveView::Shape WaveView::_global_shape = WaveView::Normal;
bool WaveView::_global_show_waveform_clipping = true;
double WaveView::_clip_level = 0.98853;
PBD::Signal0<void> WaveView::VisualPropertiesChanged;
@ -161,6 +162,13 @@ alt_log_meter (float power)
return _log_meter (power, -192.0, 0.0, 8.0);
}
void
WaveView::set_clip_level (double dB)
{
_clip_level = dB_to_coefficient (dB);
ClipLevelChanged ();
}
struct LineTips {
double top;
double bot;
@ -189,7 +197,7 @@ WaveView::draw_image (PeakData* _peaks, int n_peaks) const
has been scaled by scale_amplitude() already.
*/
const double clip_level = 0.98853 * _region->scale_amplitude();
const double clip_level = _clip_level * _region->scale_amplitude();
if (_shape == WaveView::Rectified) {