{
Evoral::Parameter p (_type == "trim" ? TrimAutomation : GainAutomation);
boost::shared_ptr<AutomationList> gl (new AutomationList (p));
- _gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl));
+ _gain_control = boost::shared_ptr<GainControl> (new GainControl ((_type == "trim") ? X_("trimcontrol") : X_("gaincontrol"), s, this, p, gl));
_gain_control->set_flags (Controllable::GainLike);
add_control(_gain_control);
static BufferSet& get_route_buffers (ChanCount count = ChanCount::ZERO, bool silence = false);
static BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
static gain_t* gain_automation_buffer ();
+ static gain_t* trim_automation_buffer ();
static gain_t* send_gain_automation_buffer ();
static pan_t** pan_automation_buffer ();
bool _active;
framecnt_t _signal_latency;
framecnt_t _signal_latency_at_amp_position;
+ framecnt_t _signal_latency_at_trim_position;
framecnt_t _initial_delay;
framecnt_t _roll_delay;
/* buffers for gain and pan */
gain_t* gain_automation_buffer () const;
+ gain_t* trim_automation_buffer () const;
gain_t* send_gain_automation_buffer () const;
pan_t** pan_automation_buffer () const;
BufferSet* route_buffers;
BufferSet* mix_buffers;
gain_t* gain_automation_buffer;
+ gain_t* trim_automation_buffer;
gain_t* send_gain_automation_buffer;
pan_t** pan_automation_buffer;
uint32_t npan_buffers;
if (param == Evoral::Parameter(GainAutomation)) {
return _("Fader");
+ } else if (param.type() == TrimAutomation) {
+ return _("Trim");
} else if (param.type() == MuteAutomation) {
return _("Mute");
} else if (param.type() == MidiCCAutomation) {
} else {
warning << "GainAutomation for non-Amp" << endl;
}
+ } else if (param.type() == TrimAutomation) {
+ Amp* amp = dynamic_cast<Amp*>(this);
+ if (amp) {
+ control = new Amp::GainControl(X_("trimcontrol"), _a_session, amp, param);
+ } else {
+ warning << "TrimAutomation for non-Amp" << endl;
+ }
} else if (param.type() == PanAzimuthAutomation || param.type() == PanWidthAutomation || param.type() == PanElevationAutomation) {
Pannable* pannable = dynamic_cast<Pannable*>(this);
if (pannable) {
{
switch (_parameter.type()) {
case GainAutomation:
+ case TrimAutomation:
case PanAzimuthAutomation:
case PanElevationAutomation:
case PanWidthAutomation:
if (str == "gain") {
p_type = GainAutomation;
+ } else if (str == "trim") {
+ p_type = TrimAutomation;
} else if (str == "solo") {
p_type = SoloAutomation;
} else if (str == "mute") {
if (t == GainAutomation) {
return "gain";
+ } else if (t == TrimAutomation) {
+ return "trim";
} else if (t == PanAzimuthAutomation) {
return "pan-azimuth";
} else if (t == PanElevationAutomation) {
return g;
}
+gain_t*
+ProcessThread::trim_automation_buffer()
+{
+ ThreadBuffers* tb = _private_thread_buffers.get();
+ assert (tb);
+
+ gain_t *g = tb->trim_automation_buffer;
+ assert (g);
+ return g;
+}
+
gain_t*
ProcessThread::send_gain_automation_buffer()
{
, _active (true)
, _signal_latency (0)
, _signal_latency_at_amp_position (0)
+ , _signal_latency_at_trim_position (0)
, _initial_delay (0)
, _roll_delay (0)
, _flags (flg)
return newname;
}
-
void
Route::inc_gain (gain_t fraction, void *src)
{
start_frame + _signal_latency_at_amp_position,
end_frame + _signal_latency_at_amp_position,
nframes);
+
+ _trim->set_gain_automation_buffer (_session.trim_automation_buffer ());
+ _trim->setup_gain_automation (
+ start_frame + _signal_latency_at_trim_position,
+ end_frame + _signal_latency_at_trim_position,
+ nframes);
} else {
_amp->apply_gain_automation (false);
+ _trim->apply_gain_automation (false);
}
/* Tell main outs what to do about monitoring. We do this so that
_amp->set_gain_automation_buffer (_session.gain_automation_buffer ());
_amp->setup_gain_automation (start - latency, start - latency + nframes, nframes);
+ /* trim is always at the top, for bounce no latency compensation is needed */
+ _trim->set_gain_automation_buffer (_session.trim_automation_buffer ());
+ _trim->setup_gain_automation (start, start + nframes, nframes);
+
latency = 0;
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
seen_amp = true;
}
- if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs || (*i) == _delayline) {
+ if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs || (*i) == _delayline || (*i) == _trim) {
/* you can't remove these */
/* these can never be removed */
- if (processor == _amp || processor == _meter || processor == _main_outs || processor == _delayline) {
+ if (processor == _amp || processor == _meter || processor == _main_outs || processor == _delayline || processor == _trim) {
return 0;
}
}
_amp->apply_gain_automation (false);
+ _trim->apply_gain_automation (false);
passthru (bufs, start_frame, end_frame, nframes, 0);
return 0;
framecnt_t l = _output->user_latency();
framecnt_t lamp = 0;
bool before_amp = true;
+ framecnt_t ltrim = 0;
+ bool before_trim = true;
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if ((*i)->active ()) {
if ((*i) == _amp) {
before_amp = false;
}
+ if ((*i) == _trim) {
+ before_amp = false;
+ }
if (before_amp) {
lamp = l;
}
+ if (before_trim) {
+ lamp = l;
+ }
}
DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: internal signal latency = %2\n", _name, l));
+ // TODO: (lamp - _signal_latency) to sync to output (read-ahed), currently _roll_delay shifts this around
_signal_latency_at_amp_position = lamp;
+ _signal_latency_at_trim_position = ltrim;
+
if (_signal_latency != l) {
_signal_latency = l;
signal_latency_changed (); /* EMIT SIGNAL */
_session.add_command (new MementoCommand<AutomationList> (*gc->alist().get(), &before, &after));
}
+ /* gain automation */
+ {
+ boost::shared_ptr<AutomationControl> gc = _trim->gain_control();
+
+ XMLNode &before = gc->alist()->get_state ();
+ gc->alist()->shift (pos, frames);
+ XMLNode &after = gc->alist()->get_state ();
+ _session.add_command (new MementoCommand<AutomationList> (*gc->alist().get(), &before, &after));
+ }
+
+ // TODO mute automation ??
+
/* pan automation */
if (_pannable) {
ControlSet::Controls& c (_pannable->controls());
return ProcessThread::gain_automation_buffer ();
}
+gain_t*
+Session::trim_automation_buffer() const
+{
+ return ProcessThread::trim_automation_buffer ();
+}
+
gain_t*
Session::send_gain_automation_buffer() const
{
, route_buffers (new BufferSet)
, mix_buffers (new BufferSet)
, gain_automation_buffer (0)
+ , trim_automation_buffer (0)
, send_gain_automation_buffer (0)
, pan_automation_buffer (0)
, npan_buffers (0)
delete [] gain_automation_buffer;
gain_automation_buffer = new gain_t[audio_buffer_size];
+ delete [] trim_automation_buffer;
+ trim_automation_buffer = new gain_t[audio_buffer_size];
delete [] send_gain_automation_buffer;
send_gain_automation_buffer = new gain_t[audio_buffer_size];