summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2015-03-25 16:47:25 -0500
committerRobin Gareus <robin@gareus.org>2015-04-22 00:22:43 +0200
commit46f97e8d92241c94d12d81ea182a9172df98e61e (patch)
treef757e7014aa6260b7d927b35bcf1fd221e2d40e4 /libs/ardour
parent187ddb3bad70088f901ed1ea5e1402519fd393b4 (diff)
Initial Gain Coefficient tweaks
1) Disambiguate 1.0 to GAIN_COEFF_UNITY, and 0.0 to GAIN_COEFF_ZERO 2) Add GAIN_COEFF_SMALL which replaces SMALL_SIGNAL (-140dB) 3) GAIN_COEFF_SMALL can used to avoid interpolating towards -inf on a db scale 4) GAIN_COEFF_SMALL is used to detect very small (denormal?) gains and memset to zero
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/amp.cc22
-rw-r--r--libs/ardour/ardour/dB.h4
-rw-r--r--libs/ardour/audio_track.cc2
-rw-r--r--libs/ardour/audioengine.cc2
-rw-r--r--libs/ardour/audioregion.cc42
-rw-r--r--libs/ardour/delivery.cc16
-rw-r--r--libs/ardour/export_format_specification.cc2
-rw-r--r--libs/ardour/internal_send.cc12
-rw-r--r--libs/ardour/monitor_processor.cc28
-rw-r--r--libs/ardour/mute_master.cc12
-rw-r--r--libs/ardour/panner_shell.cc6
-rw-r--r--libs/ardour/route.cc6
-rw-r--r--libs/ardour/session.cc4
13 files changed, 80 insertions, 78 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 523b538359..ac970fc581 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -40,7 +40,7 @@ Amp::Amp (Session& s)
: Processor(s, "Amp")
, _apply_gain(true)
, _apply_gain_automation(false)
- , _current_gain(1.0)
+ , _current_gain(GAIN_COEFF_UNITY)
, _current_automation_frame (INT64_MAX)
, _gain_automation_buffer(0)
{
@@ -115,7 +115,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
_current_gain = Amp::apply_gain (bufs, _session.nominal_frame_rate(), nframes, _current_gain, dg);
- } else if (_current_gain != 1.0f) {
+ } else if (_current_gain != GAIN_COEFF_UNITY) {
/* gain has not changed, but its non-unity
*/
@@ -221,11 +221,11 @@ Amp::declick (BufferSet& bufs, framecnt_t nframes, int dir)
if (dir < 0) {
/* fade out: remove more and more of delta from initial */
delta = -1.0;
- initial = 1.0;
+ initial = GAIN_COEFF_UNITY;
} else {
/* fade in: add more and more of delta from initial */
delta = 1.0;
- initial = 0.0;
+ initial = GAIN_COEFF_ZERO;
}
/* Audio Gain */
@@ -275,15 +275,15 @@ Amp::apply_gain (AudioBuffer& buf, framecnt_t sample_rate, framecnt_t nframes, g
lpf += a * (target - lpf);
}
- if (lpf < 1e-10) return 0;
- if (fabsf(lpf - 1.0) < 1e-10) return 1.0;
+ if (lpf < 1e-10) return 0; // TODO use GAIN_COEFF_TINY or _DENORMAL
+ if (fabsf(lpf - GAIN_COEFF_UNITY) < 1e-10) return GAIN_COEFF_UNITY;
return lpf;
}
void
Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target)
{
- if (target == 0.0) {
+ if (target < GAIN_COEFF_SMALL) {
for (BufferSet::midi_iterator i = bufs.midi_begin(); i != bufs.midi_end(); ++i) {
MidiBuffer& mb (*i);
@@ -300,7 +300,7 @@ Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target)
memset (i->data(), 0, sizeof (Sample) * nframes);
}
- } else if (target != 1.0) {
+ } else if (target != GAIN_COEFF_UNITY) {
for (BufferSet::midi_iterator i = bufs.midi_begin(); i != bufs.midi_end(); ++i) {
MidiBuffer& mb (*i);
@@ -322,9 +322,9 @@ Amp::apply_simple_gain (BufferSet& bufs, framecnt_t nframes, gain_t target)
void
Amp::apply_simple_gain (AudioBuffer& buf, framecnt_t nframes, gain_t target)
{
- if (target == 0.0) {
+ if (target < GAIN_COEFF_SMALL) {
memset (buf.data(), 0, sizeof (Sample) * nframes);
- } else if (target != 1.0) {
+ } else if (target != GAIN_COEFF_UNITY) {
apply_gain_to_buffer (buf.data(), nframes, target);
}
}
@@ -334,7 +334,7 @@ Amp::inc_gain (gain_t factor, void *src)
{
float desired_gain = _gain_control->user_double();
- if (desired_gain == 0.0f) {
+ if (desired_gain < GAIN_COEFF_SMALL) {
set_gain (0.000001f + (0.000001f * factor), src);
} else {
set_gain (desired_gain + (desired_gain * factor), src);
diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h
index abacdfcd29..0fd75a869f 100644
--- a/libs/ardour/ardour/dB.h
+++ b/libs/ardour/ardour/dB.h
@@ -22,6 +22,10 @@
#include "pbd/fastlog.h"
+#define GAIN_COEFF_ZERO 0.0
+#define GAIN_COEFF_SMALL 0.0000001 //-140dB
+#define GAIN_COEFF_UNITY 1.0
+
static inline float dB_to_coefficient (float dB) {
return dB > -318.8f ? pow (10.0f, dB * 0.05f) : 0.0f;
}
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 62109e86c7..33a5ba8f37 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -603,7 +603,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
/* reset stuff that has already been accounted for in the freeze process */
- set_gain (1.0, this);
+ set_gain (GAIN_COEFF_UNITY, this);
_amp->gain_control()->set_automation_state (Off);
/* XXX need to use _main_outs _panner->set_automation_state (Off); */
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 116b99085b..c70a48725a 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -283,7 +283,7 @@ AudioEngine::process_callback (pframes_t nframes)
/* fade out over 1 second */
session_removal_countdown = sample_rate()/2;
- session_removal_gain = 1.0;
+ session_removal_gain = GAIN_COEFF_UNITY;
session_removal_gain_step = 1.0/session_removal_countdown;
} else if (session_removal_countdown > 0) {
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 37bf3e1fed..026de0713b 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -72,8 +72,6 @@ namespace ARDOUR {
}
}
-static const double VERY_SMALL_SIGNAL = 0.0000001; //-140dB
-
/* Curve manipulations */
static void
@@ -106,14 +104,14 @@ generate_db_fade (boost::shared_ptr<Evoral::ControlList> dst, double len, int nu
//generate a fade-out curve by successively applying a gain drop
float fade_speed = dB_to_coefficient(dB_drop / (float) num_steps);
for (int i = 1; i < (num_steps-1); i++) {
- float coeff = 1.0;
+ float coeff = GAIN_COEFF_UNITY;
for (int j = 0; j < i; j++) {
coeff *= fade_speed;
}
dst->fast_simple_add (len*(double)i/(double)num_steps, coeff);
}
- dst->fast_simple_add (len, VERY_SMALL_SIGNAL);
+ dst->fast_simple_add (len, GAIN_COEFF_SMALL);
}
static void
@@ -791,8 +789,8 @@ AudioRegion::state ()
// so, if they are both at 1.0f, that means the default region.
if (_envelope->size() == 2 &&
- _envelope->front()->value == 1.0f &&
- _envelope->back()->value==1.0f) {
+ _envelope->front()->value == GAIN_COEFF_UNITY &&
+ _envelope->back()->value==GAIN_COEFF_UNITY) {
if (_envelope->front()->when == 0 && _envelope->back()->when == _length) {
default_env = true;
}
@@ -1026,8 +1024,8 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
switch (shape) {
case FadeLinear:
- _fade_in->fast_simple_add (0.0, VERY_SMALL_SIGNAL);
- _fade_in->fast_simple_add (len, 1.0);
+ _fade_in->fast_simple_add (0.0, GAIN_COEFF_SMALL);
+ _fade_in->fast_simple_add (len, GAIN_COEFF_UNITY);
reverse_curve (_inverse_fade_in.val(), _fade_in.val());
break;
@@ -1048,12 +1046,12 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
break;
case FadeConstantPower:
- _fade_in->fast_simple_add (0.0, VERY_SMALL_SIGNAL);
+ _fade_in->fast_simple_add (0.0, GAIN_COEFF_SMALL);
for (int i = 1; i < num_steps; ++i) {
const float dist = i / (num_steps + 1.f);
_fade_in->fast_simple_add (len * dist, sin (dist * M_PI / 2.0));
}
- _fade_in->fast_simple_add (len, 1.0);
+ _fade_in->fast_simple_add (len, GAIN_COEFF_UNITY);
reverse_curve (_inverse_fade_in.val(), _fade_in.val());
break;
@@ -1065,9 +1063,9 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
const double breakpoint = 0.7; //linear for first 70%
for (int i = 2; i < 9; ++i) {
const float coeff = (1.f - breakpoint) * powf (0.5, i);
- _fade_in->fast_simple_add (len * (breakpoint + ((1.0 - breakpoint) * (double)i / 9.0)), coeff);
+ _fade_in->fast_simple_add (len * (breakpoint + ((GAIN_COEFF_UNITY - breakpoint) * (double)i / 9.0)), coeff);
}
- _fade_in->fast_simple_add (len, VERY_SMALL_SIGNAL);
+ _fade_in->fast_simple_add (len, GAIN_COEFF_SMALL);
reverse_curve (c3, _fade_in.val());
_fade_in->copy_events (*c3);
reverse_curve (_inverse_fade_in.val(), _fade_in.val());
@@ -1108,8 +1106,8 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
switch (shape) {
case FadeLinear:
- _fade_out->fast_simple_add (0.0, 1.0);
- _fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL);
+ _fade_out->fast_simple_add (0.0, GAIN_COEFF_UNITY);
+ _fade_out->fast_simple_add (len, GAIN_COEFF_SMALL);
reverse_curve (_inverse_fade_out.val(), _fade_out.val());
break;
@@ -1128,12 +1126,12 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
case FadeConstantPower:
//constant-power fades use a sin/cos relationship
//the cutoff is abrupt but it has the benefit of being symmetrical
- _fade_out->fast_simple_add (0.0, 1.0);
+ _fade_out->fast_simple_add (0.0, GAIN_COEFF_UNITY);
for (int i = 1; i < num_steps; ++i) {
const float dist = i / (num_steps + 1.f);
_fade_out->fast_simple_add (len * dist, cos (dist * M_PI / 2.0));
}
- _fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL);
+ _fade_out->fast_simple_add (len, GAIN_COEFF_SMALL);
reverse_curve (_inverse_fade_out.val(), _fade_out.val());
break;
@@ -1145,9 +1143,9 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
const double breakpoint = 0.7; //linear for first 70%
for (int i = 2; i < 9; ++i) {
const float coeff = (1.f - breakpoint) * powf (0.5, i);
- _fade_out->fast_simple_add (len * (breakpoint + ((1.0 - breakpoint) * (double)i / 9.0)), coeff);
+ _fade_out->fast_simple_add (len * (breakpoint + ((GAIN_COEFF_UNITY - breakpoint) * (double)i / 9.0)), coeff);
}
- _fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL);
+ _fade_out->fast_simple_add (len, GAIN_COEFF_SMALL);
reverse_curve (_inverse_fade_out.val(), _fade_out.val());
break;
}
@@ -1266,8 +1264,8 @@ AudioRegion::set_default_envelope ()
{
_envelope->freeze ();
_envelope->clear ();
- _envelope->fast_simple_add (0, 1.0f);
- _envelope->fast_simple_add (_length, 1.0f);
+ _envelope->fast_simple_add (0, GAIN_COEFF_UNITY);
+ _envelope->fast_simple_add (_length, GAIN_COEFF_UNITY);
_envelope->thaw ();
}
@@ -1447,14 +1445,14 @@ AudioRegion::normalize (float max_amplitude, float target_dB)
{
gain_t target = dB_to_coefficient (target_dB);
- if (target == 1.0f) {
+ if (target == GAIN_COEFF_UNITY) {
/* do not normalize to precisely 1.0 (0 dBFS), to avoid making it appear
that we may have clipped.
*/
target -= FLT_EPSILON;
}
- if (max_amplitude == 0.0f) {
+ if (max_amplitude < GAIN_COEFF_SMALL) {
/* don't even try */
return;
}
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index f16719888f..359b029d0c 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -52,7 +52,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<Pann
: IOProcessor(s, boost::shared_ptr<IO>(), (role_requires_output_ports (r) ? io : boost::shared_ptr<IO>()), name)
, _role (r)
, _output_buffers (new BufferSet())
- , _current_gain (1.0)
+ , _current_gain (GAIN_COEFF_UNITY)
, _no_outs_cuz_we_no_monitor (false)
, _mute_master (mm)
, _no_panner_reset (false)
@@ -76,7 +76,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr<Pannable> pannable, boost::sha
: IOProcessor(s, false, (role_requires_output_ports (r) ? true : false), name, "", DataType::AUDIO, (r == Send))
, _role (r)
, _output_buffers (new BufferSet())
- , _current_gain (1.0)
+ , _current_gain (GAIN_COEFF_UNITY)
, _no_outs_cuz_we_no_monitor (false)
, _mute_master (mm)
, _no_panner_reset (false)
@@ -264,7 +264,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pf
_current_gain = Amp::apply_gain (bufs, _session.nominal_frame_rate(), nframes, _current_gain, tgain);
- } else if (tgain == 0.0) {
+ } else if (tgain < GAIN_COEFF_SMALL) {
/* we were quiet last time, and we're still supposed to be quiet.
Silence the outputs, and make sure the buffers are quiet too,
@@ -273,11 +273,11 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pf
_output->silence (nframes);
if (result_required) {
bufs.set_count (output_buffers().count ());
- Amp::apply_simple_gain (bufs, nframes, 0.0);
+ Amp::apply_simple_gain (bufs, nframes, GAIN_COEFF_ZERO);
}
goto out;
- } else if (tgain != 1.0) {
+ } else if (tgain != GAIN_COEFF_UNITY) {
/* target gain has not changed, but is not unity */
Amp::apply_simple_gain (bufs, nframes, tgain);
@@ -498,7 +498,7 @@ Delivery::target_gain ()
/* if we've been requested to deactivate, our target gain is zero */
if (!_pending_active) {
- return 0.0;
+ return GAIN_COEFF_ZERO;
}
/* if we've been told not to output because its a monitoring situation and
@@ -506,7 +506,7 @@ Delivery::target_gain ()
*/
if (_no_outs_cuz_we_no_monitor) {
- return 0.0;
+ return GAIN_COEFF_ZERO;
}
MuteMaster::MutePoint mp = MuteMaster::Main; // stupid gcc uninit warning
@@ -538,7 +538,7 @@ Delivery::target_gain ()
it gets its signal from the master out.
*/
- desired_gain = 0.0;
+ desired_gain = GAIN_COEFF_ZERO;
}
diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc
index 7e41b209a4..32d16c9dee 100644
--- a/libs/ardour/export_format_specification.cc
+++ b/libs/ardour/export_format_specification.cc
@@ -167,7 +167,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s)
, _silence_end (s)
, _normalize (false)
- , _normalize_target (1.0)
+ , _normalize_target (GAIN_COEFF_UNITY)
, _with_toc (false)
, _with_cue (false)
, _with_mp4chaps (false)
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index de5af0c6e2..e8e560c7c0 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -74,10 +74,10 @@ InternalSend::init_gain ()
{
if (_role == Listen) {
/* send to monitor bus is always at unity */
- _amp->set_gain (1.0, this);
+ _amp->set_gain (GAIN_COEFF_UNITY, this);
} else {
/* aux sends start at -inf dB */
- _amp->set_gain (0, this);
+ _amp->set_gain (GAIN_COEFF_ZERO, this);
}
}
@@ -196,16 +196,16 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
_current_gain = Amp::apply_gain (mixbufs, _session.nominal_frame_rate(), nframes, _current_gain, tgain);
- } else if (tgain == 0.0) {
+ } else if (tgain == GAIN_COEFF_ZERO) {
/* we were quiet last time, and we're still supposed to be quiet.
*/
_meter->reset ();
- Amp::apply_simple_gain (mixbufs, nframes, 0.0);
+ Amp::apply_simple_gain (mixbufs, nframes, GAIN_COEFF_ZERO);
goto out;
- } else if (tgain != 1.0) {
+ } else if (tgain != GAIN_COEFF_UNITY) {
/* target gain has not changed, but is not zero or unity */
Amp::apply_simple_gain (mixbufs, nframes, tgain);
@@ -220,7 +220,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
/* consider metering */
if (_metering) {
- if (_amp->gain_control()->get_value() == 0) {
+ if (_amp->gain_control()->get_value() == GAIN_COEFF_ZERO) {
_meter->reset();
} else {
_meter->run (mixbufs, start_frame, end_frame, nframes, true);
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index f19ce908ec..70e4ed52c4 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -182,9 +182,9 @@ MonitorProcessor::set_state (const XMLNode& node, int version)
if ((prop = (*i)->property ("cut")) != 0) {
if (string_is_affirmative (prop->value())){
- cr.cut = 0.0f;
+ cr.cut = GAIN_COEFF_ZERO;
} else {
- cr.cut = 1.0f;
+ cr.cut = GAIN_COEFF_UNITY;
}
}
@@ -256,8 +256,8 @@ MonitorProcessor::state (bool full)
snprintf (buf, sizeof (buf), "%u", chn);
chn_node->add_property ("id", buf);
- chn_node->add_property (X_("cut"), (*x)->cut == 1.0f ? "no" : "yes");
- chn_node->add_property (X_("invert"), (*x)->polarity == 1.0f ? "no" : "yes");
+ chn_node->add_property (X_("cut"), (*x)->cut == GAIN_COEFF_UNITY ? "no" : "yes");
+ chn_node->add_property (X_("invert"), (*x)->polarity == GAIN_COEFF_UNITY ? "no" : "yes");
chn_node->add_property (X_("dim"), (*x)->dim ? "yes" : "no");
chn_node->add_property (X_("solo"), (*x)->soloed ? "yes" : "no");
@@ -273,21 +273,21 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /
uint32_t chn = 0;
gain_t target_gain;
gain_t dim_level_this_time = _dim_level;
- gain_t global_cut = (_cut_all ? 0.0f : 1.0f);
- gain_t global_dim = (_dim_all ? dim_level_this_time : 1.0);
+ gain_t global_cut = (_cut_all ? GAIN_COEFF_ZERO : GAIN_COEFF_UNITY);
+ gain_t global_dim = (_dim_all ? dim_level_this_time : GAIN_COEFF_UNITY);
gain_t solo_boost;
if (_session.listening() || _session.soloing()) {
solo_boost = _solo_boost_level;
} else {
- solo_boost = 1.0;
+ solo_boost = GAIN_COEFF_UNITY;
}
for (BufferSet::audio_iterator b = bufs.audio_begin(); b != bufs.audio_end(); ++b) {
/* don't double-scale by both track dim and global dim coefficients */
- gain_t dim_level = (global_dim == 1.0 ? (_channels[chn]->dim ? dim_level_this_time : 1.0) : 1.0);
+ gain_t dim_level = (global_dim == GAIN_COEFF_UNITY ? (_channels[chn]->dim ? dim_level_this_time : GAIN_COEFF_UNITY) : GAIN_COEFF_UNITY);
if (_channels[chn]->soloed) {
target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost;
@@ -295,11 +295,11 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /
if (solo_cnt == 0) {
target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost;
} else {
- target_gain = 0.0;
+ target_gain = GAIN_COEFF_ZERO;
}
}
- if (target_gain != _channels[chn]->current_gain || target_gain != 1.0f) {
+ if (target_gain != _channels[chn]->current_gain || target_gain != GAIN_COEFF_UNITY) {
_channels[chn]->current_gain = Amp::apply_gain (*b, _session.nominal_frame_rate(), nframes, _channels[chn]->current_gain, target_gain);
}
@@ -380,9 +380,9 @@ void
MonitorProcessor::set_cut (uint32_t chn, bool yn)
{
if (yn) {
- _channels[chn]->cut = 0.0f;
+ _channels[chn]->cut = GAIN_COEFF_ZERO;
} else {
- _channels[chn]->cut = 1.0f;
+ _channels[chn]->cut = GAIN_COEFF_UNITY;
}
}
@@ -443,7 +443,7 @@ MonitorProcessor::inverted (uint32_t chn) const
bool
MonitorProcessor::cut (uint32_t chn) const
{
- return _channels[chn]->cut == 0.0f;
+ return _channels[chn]->cut == GAIN_COEFF_ZERO;
}
bool
@@ -507,7 +507,7 @@ MonitorProcessor::channel_solo_control (uint32_t chn) const
}
MonitorProcessor::ChannelRecord::ChannelRecord (uint32_t chn)
- : current_gain (1.0)
+ : current_gain (GAIN_COEFF_UNITY)
, cut_ptr (new MPControl<gain_t> (1.0, string_compose (_("cut control %1"), chn), PBD::Controllable::GainLike))
, dim_ptr (new MPControl<bool> (false, string_compose (_("dim control"), chn), PBD::Controllable::Toggle))
, polarity_ptr (new MPControl<gain_t> (1.0, string_compose (_("polarity control"), chn), PBD::Controllable::Toggle, -1, 1))
diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc
index 5734af8a3d..4c23855915 100644
--- a/libs/ardour/mute_master.cc
+++ b/libs/ardour/mute_master.cc
@@ -90,26 +90,26 @@ MuteMaster::mute_gain_at (MutePoint mp) const
if (Config->get_solo_mute_override()) {
if (_soloed) {
- gain = 1.0;
+ gain = GAIN_COEFF_UNITY;
} else if (muted_by_self_at (mp)) {
- gain = 0.0;
+ gain = GAIN_COEFF_ZERO;
} else {
if (muted_by_others_at (mp)) {
gain = Config->get_solo_mute_gain ();
} else {
- gain = 1.0;
+ gain = GAIN_COEFF_UNITY;
}
}
} else {
if (muted_by_self_at (mp)) {
- gain = 0.0;
+ gain = GAIN_COEFF_ZERO;
} else if (_soloed) {
- gain = 1.0;
+ gain = GAIN_COEFF_UNITY;
} else {
if (muted_by_others_at (mp)) {
gain = Config->get_solo_mute_gain ();
} else {
- gain = 1.0;
+ gain = GAIN_COEFF_UNITY;
}
}
}
diff --git a/libs/ardour/panner_shell.cc b/libs/ardour/panner_shell.cc
index 7b19977b9c..fd5564bbef 100644
--- a/libs/ardour/panner_shell.cc
+++ b/libs/ardour/panner_shell.cc
@@ -284,13 +284,13 @@ PannerShell::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, pf
AudioBuffer& dst = outbufs.get_audio(0);
- if (gain_coeff == 0.0f) {
+ if (gain_coeff == GAIN_COEFF_ZERO) {
/* gain was zero, so make it silent */
dst.silence (nframes);
- } else if (gain_coeff == 1.0f){
+ } else if (gain_coeff == GAIN_COEFF_UNITY){
/* mix all input buffers into the output */
@@ -386,7 +386,7 @@ PannerShell::run (BufferSet& inbufs, BufferSet& outbufs, framepos_t start_frame,
if (!(as & Play || ((as & Touch) && !_panner->touching()))) {
// Speed quietning
- gain_t gain_coeff = 1.0;
+ gain_t gain_coeff = GAIN_COEFF_UNITY;
if (fabsf(_session.transport_speed()) > 1.5f && Config->get_quieten_at_speed ()) {
gain_coeff = speed_quietning;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index e22acd8d4d..c2a7c62f6d 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -3457,9 +3457,9 @@ Route::SoloControllable::get_value () const
}
if (Config->get_solo_control_is_listen_control()) {
- return r->listening_via_monitor() ? 1.0f : 0.0f;
+ return r->listening_via_monitor() ? GAIN_COEFF_UNITY : GAIN_COEFF_ZERO;
} else {
- return r->self_soloed() ? 1.0f : 0.0f;
+ return r->self_soloed() ? GAIN_COEFF_UNITY : GAIN_COEFF_ZERO;
}
}
@@ -3521,7 +3521,7 @@ Route::MuteControllable::get_value () const
// Not playing back automation, get the actual route mute value
boost::shared_ptr<Route> r = _route.lock ();
- return (r && r->muted()) ? 1.0 : 0.0;
+ return (r && r->muted()) ? GAIN_COEFF_UNITY : GAIN_COEFF_ZERO;
}
void
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 31f2635ac3..b69b0bce61 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2775,7 +2775,7 @@ Session::globally_set_send_gains_to_zero (boost::shared_ptr<Route> dest)
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((s = (*i)->internal_send_for (dest)) != 0) {
- s->amp()->gain_control()->set_value (0.0);
+ s->amp()->gain_control()->set_value (GAIN_COEFF_ZERO);
}
}
}
@@ -2788,7 +2788,7 @@ Session::globally_set_send_gains_to_unity (boost::shared_ptr<Route> dest)
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((s = (*i)->internal_send_for (dest)) != 0) {
- s->amp()->gain_control()->set_value (1.0);
+ s->amp()->gain_control()->set_value (GAIN_COEFF_UNITY);
}
}
}