nick m's fix for markers etc ; several tweaks for mute/solo ; rename run_in_place() as run()

git-svn-id: svn://localhost/ardour2/branches/3.0@5155 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-06-10 18:10:07 +00:00
parent ff26317d4f
commit 6e9b9294e1
27 changed files with 106 additions and 140 deletions

View File

@ -776,16 +776,17 @@ Editor::scroll_canvas_horizontally ()
nframes64_t time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
/* horizontal scrolling only */
double x_delta;
double x1, y1, x2, y2, x_delta;
_master_group->get_bounds (x1, y1, x2, y2);
x_delta = (leftmost_frame - time_origin) / frames_per_unit;
x_delta = - (x1 + horizontal_adjustment.get_value());
_master_group->move (x_delta, 0);
timebar_group->move (x_delta, 0);
time_line_group->move (x_delta, 0);
cursor_group->move (x_delta, 0);
leftmost_frame = time_origin;
leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
update_fixed_rulers ();
redisplay_tempo (true);

View File

@ -1127,7 +1127,7 @@ RouteUI::toggle_polarity ()
ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_polarity));
if ((x = polarity_menu_item->get_active()) != _route->phase_invert()) {
_route->set_phase_invert (x, this);
_route->set_phase_invert (x);
if (x) {
name_label.set_text (X_("Ø ") + name_label.get_text());
} else {
@ -1140,7 +1140,11 @@ RouteUI::toggle_polarity ()
void
RouteUI::polarity_changed ()
{
/* no signal for this yet */
if (_route->phase_invert()) {
name_label.set_text (X_("Ø ") + name_label.get_text());
} else {
name_label.set_text (_route->name());
}
}
void
@ -1153,7 +1157,7 @@ RouteUI::toggle_denormal_protection ()
ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_denormal_protection));
if ((x = denormal_menu_item->get_active()) != _route->denormal_protection()) {
_route->set_denormal_protection (x, this);
_route->set_denormal_protection (x);
}
}
}
@ -1161,7 +1165,9 @@ RouteUI::toggle_denormal_protection ()
void
RouteUI::denormal_protection_changed ()
{
/* no signal for this yet */
if (denormal_menu_item) {
denormal_menu_item->set_active (_route->denormal_protection());
}
}
void

View File

@ -16,6 +16,7 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
@ -64,7 +65,7 @@ Amp::configure_io (ChanCount in, ChanCount out)
}
void
Amp::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
Amp::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
gain_t mute_gain;
@ -137,25 +138,15 @@ Amp::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
Amp::apply_gain (bufs, nframes, _current_gain, dg);
_current_gain = dg;
} else if ((_current_gain != 0.0f) && (_current_gain != 1.0f)) {
} else if (_current_gain != 1.0f) {
/* gain has not changed, but its non-unity, so apply it unless
its zero.
/* gain has not changed, but its non-unity
*/
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
Sample* const sp = i->data();
apply_gain_to_buffer(sp, nframes, _current_gain);
apply_gain_to_buffer (i->data(), nframes, _current_gain);
}
} else if (_current_gain == 0.0f) {
/* silence! */
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
i->clear();
}
}
}
}
}
}

View File

@ -40,7 +40,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
bool apply_gain() const { return _apply_gain; }
void apply_gain(bool yn) { _apply_gain = yn; }

View File

@ -50,7 +50,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
/* supplemental method use with MIDI */

View File

@ -64,7 +64,6 @@ class IOProcessor : public Processor
void set_input (boost::shared_ptr<IO>);
void set_output (boost::shared_ptr<IO>);
void run_in_place (BufferSet& in, sframes_t start, sframes_t end, nframes_t nframes) = 0;
void silence (nframes_t nframes);
sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged;

View File

@ -61,7 +61,7 @@ public:
bool configure_io (ChanCount in, ChanCount out);
/** Compute peaks */
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
float peak_power (uint32_t n) {
if (n < _visible_peak_power.size()) {

View File

@ -54,7 +54,7 @@ class PluginInsert : public Processor
XMLNode& get_state(void);
int set_state(const XMLNode&);
void run_in_place (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void silence (nframes_t nframes);
void activate ();

View File

@ -51,7 +51,7 @@ class PortInsert : public IOProcessor
XMLNode& get_state(void);
int set_state(const XMLNode&);
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
nframes_t signal_latency() const;

View File

@ -76,14 +76,7 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
virtual void set_block_size (nframes_t nframes) {}
virtual void run_in_place (BufferSet& bufs,
sframes_t start_frame, sframes_t end_frame,
nframes_t nframes) { assert(is_in_place()); }
virtual void run_out_of_place (BufferSet& input, BufferSet& output,
sframes_t start_frame, sframes_t end_frame,
nframes_t nframes) { assert(is_out_of_place()); }
virtual void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) {}
virtual void silence (nframes_t nframes) {}
void activate () { _active = true; ActiveChanged(); }
@ -93,13 +86,6 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
/* Derived classes should override these, or processor appears as an in-place pass-through */
/** In-place processors implement run_in_place and modify thee input buffer parameter */
virtual bool is_in_place () const { return true; }
/* Out-Of-Place processors implement run_out_of_place, don't modify the input parameter
* and write to their output parameter */
virtual bool is_out_of_place () const { return false; }
virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const = 0;
virtual ChanCount input_streams () const { return _configured_input; }
virtual ChanCount output_streams() const { return _configured_output; }

View File

@ -44,7 +44,7 @@ public:
uint32_t bit_slot() const { return _bitslot; }
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; }

View File

@ -129,10 +129,10 @@ class Route : public SessionObject, public AutomatableControls
void set_solo_isolated (bool yn, void *src);
bool solo_isolated() const;
void set_phase_invert (bool yn, void* src);
void set_phase_invert (bool yn);
bool phase_invert() const;
void set_denormal_protection (bool yn, void* src);
void set_denormal_protection (bool yn);
bool denormal_protection() const;
void set_edit_group (RouteGroup *, void *);
@ -226,6 +226,8 @@ class Route : public SessionObject, public AutomatableControls
nframes_t initial_delay() const { return _initial_delay; }
sigc::signal<void> active_changed;
sigc::signal<void> phase_invert_changed;
sigc::signal<void> denormal_protection_changed;
sigc::signal<void,void*> solo_changed;
sigc::signal<void,void*> solo_safe_changed;
sigc::signal<void,void*> solo_isolated_changed;

View File

@ -55,7 +55,7 @@ class Send : public Delivery
uint32_t pans_required() const { return _configured_input.n_audio(); }
void run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;

View File

@ -1466,13 +1466,12 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
/* mixer stuff */
bool solo_update_disabled;
bool currently_soloing;
void route_mute_changed (void *src);
void route_solo_changed (void *src, boost::weak_ptr<Route>);
void catch_up_on_solo ();
void catch_up_on_solo_mute_override ();
void update_route_solo_state ();
void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>());
void modify_solo_mute (bool, bool);
void strip_portname_for_solo (std::string& portname);

View File

@ -667,7 +667,7 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes
for (i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<Processor> processor;
if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) {
processor->run_in_place (buffers, start, start+nframes, nframes);
processor->run (buffers, start, start+nframes, nframes);
}
}

View File

@ -142,18 +142,22 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
void
Delivery::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
if (_output->n_ports ().get (_output->default_type()) == 0) {
return;
}
/* this setup is not just for our purposes, but for anything that comes after us in the
processing pathway that wants to use this->output_buffers() for some reason.
*/
PortSet& ports (_output->ports());
output_buffers().attach_buffers (ports, nframes, _output_offset);
// this Delivery processor is not a derived type, and thus we assume
// we really can modify the buffers passed in (it is almost certainly
// the main output stage of a Route). Contrast with Send::run_in_place()
// the main output stage of a Route). Contrast with Send::run()
// which cannot do this.
gain_t tgain = target_gain ();

View File

@ -509,7 +509,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (MuteMaster, PostFader);
REGISTER_CLASS_ENUM (MuteMaster, Listen);
REGISTER_CLASS_ENUM (MuteMaster, Main);
REGISTER (_MuteMaster_MutePoint);
REGISTER_BITS (_MuteMaster_MutePoint);
REGISTER_CLASS_ENUM (IO, Input);
REGISTER_CLASS_ENUM (IO, Output);

View File

@ -1280,7 +1280,7 @@ IO::process_input (boost::shared_ptr<Processor> proc, sframes_t start_frame, sfr
/* don't read the data into new buffers - just use the port buffers directly */
bufs.attach_buffers (_ports, nframes, 0);
proc->run_in_place (bufs, start_frame, end_frame, nframes);
proc->run (bufs, start_frame, end_frame, nframes);
}
void

View File

@ -71,7 +71,7 @@ Metering::update_meters()
* be set to 0.
*/
void
PeakMeter::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
PeakMeter::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
const uint32_t n_audio = min(_configured_input.n_audio(), bufs.count().n_audio());
const uint32_t n_midi = min(_configured_input.n_midi(), bufs.count().n_midi());

View File

@ -17,7 +17,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <iostream>
#include "pbd/enumwriter.h"
#include "ardour/mute_master.h"
#include "ardour/rc_configuration.h"
@ -104,11 +105,19 @@ MuteMaster::get_value () const
int
MuteMaster::set_state (const XMLNode& node)
{
const XMLProperty* prop;
if ((prop = node.property ("mute-point")) != 0) {
_mute_point = (MutePoint) string_2_enum (prop->value(), _mute_point);
}
return 0;
}
XMLNode&
MuteMaster::get_state()
{
return *(new XMLNode (X_("MuteMaster")));
XMLNode* node = new XMLNode (X_("MuteMaster"));
node->add_property ("mute-point", enum_2_string (_mute_point));
return *node;
}

View File

@ -371,7 +371,7 @@ PluginInsert::silence (nframes_t nframes)
}
void
PluginInsert::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
PluginInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
if (active()) {

View File

@ -66,7 +66,7 @@ PortInsert::~PortInsert ()
}
void
PortInsert::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
if (_output->n_ports().n_total() == 0) {
return;
@ -78,7 +78,7 @@ PortInsert::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_
return;
}
_out->run_in_place (bufs, start_frame, end_frame, nframes);
_out->run (bufs, start_frame, end_frame, nframes);
_input->collect_input (bufs, nframes, ChanCount::ZERO);
}

View File

@ -119,7 +119,7 @@ Return::set_state(const XMLNode& node)
}
void
Return::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
if (!active() || _input->n_ports() == ChanCount::ZERO) {
return;
@ -131,13 +131,13 @@ Return::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_fram
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
_amp->run_in_place (bufs, start_frame, end_frame, nframes);
_amp->run (bufs, start_frame, end_frame, nframes);
if (_metering) {
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
_meter->run_in_place (bufs, start_frame, end_frame, nframes);
_meter->run (bufs, start_frame, end_frame, nframes);
}
}
}

View File

@ -383,6 +383,19 @@ Route::process_output_buffers (BufferSet& bufs,
}
}
}
} else {
if (_denormal_protection || Config->get_denormal_protection()) {
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
Sample* const sp = i->data();
for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] += 1.0e-27f;
}
}
}
}
/* -------------------------------------------------------------------------------------------
@ -394,7 +407,7 @@ Route::process_output_buffers (BufferSet& bufs,
if (rm.locked()) {
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
bufs.set_count (ChanCount::max(bufs.count(), (*i)->input_streams()));
(*i)->run_in_place (bufs, start_frame, end_frame, nframes);
(*i)->run (bufs, start_frame, end_frame, nframes);
bufs.set_count (ChanCount::max(bufs.count(), (*i)->output_streams()));
}
@ -1471,11 +1484,11 @@ Route::_set_state (const XMLNode& node, bool call_base)
}
if ((prop = node.property (X_("phase-invert"))) != 0) {
set_phase_invert (prop->value()=="yes"?true:false, this);
set_phase_invert (prop->value()=="yes"?true:false);
}
if ((prop = node.property (X_("denormal-protection"))) != 0) {
set_denormal_protection (prop->value()=="yes"?true:false, this);
set_denormal_protection (prop->value()=="yes"?true:false);
}
if ((prop = node.property (X_("active"))) != 0) {
@ -1589,7 +1602,10 @@ Route::_set_state (const XMLNode& node, bool call_base)
sscanf (prop->value().c_str(), "%d", &x);
set_remote_control_id (x);
}
}
} else if (child->name() == X_("MuteMaster")) {
_mute_master->set_state (*child);
}
}
if ((prop = node.property (X_("mix-group"))) != 0) {
@ -2414,11 +2430,11 @@ Route::send_for (boost::shared_ptr<const IO> target) const
}
void
Route::set_phase_invert (bool yn, void *src)
Route::set_phase_invert (bool yn)
{
if (_phase_invert != yn) {
_phase_invert = yn;
// phase_invert_changed (src); /* EMIT SIGNAL */
_phase_invert = 0xffff; // XXX all channels
phase_invert_changed (); /* EMIT SIGNAL */
}
}
@ -2429,11 +2445,11 @@ Route::phase_invert () const
}
void
Route::set_denormal_protection (bool yn, void *src)
Route::set_denormal_protection (bool yn)
{
if (_denormal_protection != yn) {
_denormal_protection = yn;
// denormal_protection_changed (src); /* EMIT SIGNAL */
denormal_protection_changed (); /* EMIT SIGNAL */
}
}

View File

@ -66,7 +66,7 @@ Send::~Send ()
}
void
Send::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
{
if (!_active || _output->n_ports() == ChanCount::ZERO) {
_meter->reset ();
@ -85,11 +85,11 @@ Send::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
_amp->run_in_place (sendbufs, start_frame, end_frame, nframes);
_amp->run (sendbufs, start_frame, end_frame, nframes);
/* deliver to outputs */
Delivery::run_in_place (sendbufs, start_frame, end_frame, nframes);
Delivery::run (sendbufs, start_frame, end_frame, nframes);
/* consider metering */
@ -97,7 +97,7 @@ Send::run_in_place (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
_meter->run_in_place (*_output_buffers, start_frame, end_frame, nframes);
_meter->run (*_output_buffers, start_frame, end_frame, nframes);
}
}
}

View File

@ -1889,7 +1889,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
try {
shared_ptr<Route> bus (new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO));
if (bus->output()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),
input_channels, output_channels)
<< endmsg;
@ -1904,22 +1904,17 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
goto failure;
}
/*
for (uint32_t x = 0; n_physical_audio_inputs && x < bus->n_inputs(); ++x) {
for (uint32_t x = 0; n_physical_audio_inputs && x < bus->input()->n_ports().n_audio(); ++x) {
port = "";
if (Config->get_input_auto_connect() & AutoConnectPhysical) {
port = physinputs[((n+x)%n_physical_audio_inputs)];
}
if (port.length() && bus->connect_input (bus->input (x), port, this)) {
if (port.length() && bus->input()->connect (bus->input()->nth (x), port, this)) {
break;
}
}
*/
for (uint32_t x = 0; n_physical_audio_outputs && x < bus->n_outputs().n_audio(); ++x) {
port = "";
@ -2218,8 +2213,6 @@ Session::route_mute_changed (void* src)
void
Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
{
cerr << "RSC sud = " << solo_update_disabled << endl;
if (solo_update_disabled) {
// We know already
return;
@ -2242,16 +2235,13 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
delta = -1;
}
cerr << "\tshift solo level by " << delta << endl;
solo_update_disabled = true;
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->feeds (route->input())) {
/* do it */
solo_update_disabled = true;
(*i)->main_outs()->mod_solo_level (delta);
solo_update_disabled = false;
}
}
@ -2261,10 +2251,23 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
_master_out->main_outs()->mod_solo_level (1);
}
solo_update_disabled = false;
update_route_solo_state (r);
SoloChanged (); /* EMIT SIGNAL */
set_dirty();
}
void
Session::update_route_solo_state (boost::shared_ptr<RouteList> r)
{
/* now figure out if anything that matters is soloed */
bool something_soloed = false;
if (!r) {
r = routes.reader();
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_master() && !(*i)->is_hidden() && (*i)->soloed()) {
something_soloed = true;
@ -2276,57 +2279,8 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
_non_soloed_outs_muted = something_soloed;
SoloActive (_non_soloed_outs_muted); /* EMIT SIGNAL */
}
SoloChanged (); /* EMIT SIGNAL */
set_dirty();
}
void
Session::update_route_solo_state ()
{
bool mute = false;
bool is_track = false;
bool signal = false;
/* this is where we actually implement solo by changing
the solo mute setting of each track.
*/
shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->soloed()) {
mute = true;
if (boost::dynamic_pointer_cast<Track>(*i)) {
is_track = true;
}
break;
}
}
if (mute != currently_soloing) {
signal = true;
currently_soloing = mute;
}
if (!is_track && !mute) {
/* nothing is soloed */
if (signal) {
SoloActive (false);
}
return;
}
if (signal) {
SoloActive (currently_soloing);
}
}
void
Session::catch_up_on_solo ()
{

View File

@ -179,7 +179,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
next_quarter_frame_to_send = -1;
current_block_size = 0;
solo_update_disabled = false;
currently_soloing = false;
_have_captured = false;
_worst_output_latency = 0;
_worst_input_latency = 0;