/** @param default_type The type of port that will be created by ensure_io
* and friends if no type is explicitly requested (to avoid breakage).
*/
-IO::IO (Session& s, string name,
+IO::IO (Session& s, const string& name,
int input_min, int input_max, int output_min, int output_max,
DataType default_type)
- : _session (s),
+ : SessionObject(s, name),
_output_buffers(new BufferSet()),
- _name (name),
_default_type(default_type),
_gain_control (X_("gaincontrol"), *this),
_gain_automation_curve (0.0, 2.0, 1.0),
}
IO::IO (Session& s, const XMLNode& node, DataType dt)
- : _session (s),
+ : SessionObject(s, "unnamed io"),
_output_buffers(new BufferSet()),
_default_type (dt),
_gain_control (X_("gaincontrol"), *this),
_gain_automation_curve (0, 0, 0) // all reset in set_state()
{
- // FIXME: hack
_meter = new PeakMeter (_session);
_panner = 0;
collect_input (bufs, nframes, offset);
- _meter->run(bufs, nframes);
+ _meter->run(bufs, start_frame, end_frame, nframes, offset);
}
void
gain_t
IO::effective_gain () const
{
- if (gain_automation_playback()) {
+ if (_gain_automation_curve.automation_playback()) {
return _effective_gain;
} else {
return _desired_gain;
return ports.size();
}
-int
-IO::set_name (string name, void* src)
+bool
+IO::set_name (const string& str)
{
- if (name == _name) {
- return 0;
+ if (str == _name) {
+ return true;
}
-
+
/* replace all colons in the name. i wish we didn't have to do this */
+ string name = str;
if (replace_all (name, ":", "-")) {
warning << _("you cannot use colons to name objects with I/O connections") << endmsg;
i->set_name (current_name);
}
- _name = name;
- name_changed (src); /* EMIT SIGNAL */
-
- return 0;
+ return SessionObject::set_name(name);
}
void
void
IO::setup_peak_meters()
{
- _meter->setup(std::max(_inputs.count(), _outputs.count()));
+ ChanCount max_streams = std::max(_inputs.count(), _outputs.count());
+ _meter->configure_io(max_streams, max_streams);
}
/**
if (changed) {
_session.set_dirty ();
- gain_automation_state_changed (); /* EMIT SIGNAL */
+ //gain_automation_state_changed (); /* EMIT SIGNAL */
}
}
void
IO::set_gain_automation_style (AutoStyle style)
{
- bool changed = false;
-
- {
- Glib::Mutex::Lock lm (automation_lock);
-
- if (style != _gain_automation_curve.automation_style()) {
- changed = true;
- _gain_automation_curve.set_automation_style (style);
- }
- }
-
- if (changed) {
- gain_automation_style_changed (); /* EMIT SIGNAL */
- }
+ Glib::Mutex::Lock lm (automation_lock);
+ _gain_automation_curve.set_automation_style (style);
}
+
void
IO::inc_gain (gain_t factor, void *src)
{
gain_changed (src);
_gain_control.Changed (); /* EMIT SIGNAL */
- if (_session.transport_stopped() && src != 0 && src != this && gain_automation_recording()) {
+ if (_session.transport_stopped() && src != 0 && src != this && _gain_automation_curve.automation_write()) {
_gain_automation_curve.add (_session.transport_frame(), val);
}
{
if (last_automation_snapshot > now || (now - last_automation_snapshot) > _automation_interval) {
- if (gain_automation_recording()) {
+ if (_gain_automation_curve.automation_write()) {
_gain_automation_curve.rt_add (now, gain());
}