restore independent gain control over click/metronome

git-svn-id: svn://localhost/ardour2/branches/3.0@11370 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-01-27 22:47:16 +00:00
parent d17918e32e
commit 19ebdba1cb
6 changed files with 55 additions and 20 deletions

View File

@ -80,7 +80,7 @@ public:
b = manage (new Button (_("Browse...")));
b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_emphasis_browse_clicked));
t->attach (*b, 2, 3, 1, 2, FILL);
_box->pack_start (*t, false, false);
_click_path_entry.signal_activate().connect (sigc::mem_fun (*this, &ClickOptions::click_changed));
@ -923,6 +923,14 @@ RCOptionEditor::RCOptionEditor ()
add_option (_("Misc"), new ClickOptions (_rc_config, this));
add_option (_("Misc"),
new FaderOption (
"click-gain",
_("Click Gain Level"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_click_gain),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_click_gain)
));
/* TRANSPORT */
add_option (_("Transport"),

View File

@ -107,6 +107,7 @@ CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true)
CONFIG_VARIABLE (bool, clicking, "clicking", false)
CONFIG_VARIABLE (std::string, click_sound, "click-sound", "")
CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "")
CONFIG_VARIABLE (gain_t, click_gain, "click-gain", 1.0)
/* transport control and related */

View File

@ -85,6 +85,7 @@ namespace Evoral {
namespace ARDOUR {
class Amp;
class AudioEngine;
class AudioFileSource;
class AudioRegion;
@ -723,6 +724,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* clicking */
boost::shared_ptr<IO> click_io() { return _click_io; }
boost::shared_ptr<Amp> click_gain() { return _click_gain; }
/* disk, buffer loads */
@ -1377,14 +1379,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* click track */
typedef std::list<Click*> Clicks;
Clicks clicks;
bool _clicking;
boost::shared_ptr<IO> _click_io;
Sample* click_data;
Sample* click_emphasis_data;
framecnt_t click_length;
framecnt_t click_emphasis_length;
mutable Glib::RWLock click_lock;
Clicks clicks;
bool _clicking;
boost::shared_ptr<IO> _click_io;
boost::shared_ptr<Amp> _click_gain;
Sample* click_data;
Sample* click_emphasis_data;
framecnt_t click_length;
framecnt_t click_emphasis_length;
mutable Glib::RWLock click_lock;
static const Sample default_click[];
static const framecnt_t default_click_length;

View File

@ -377,19 +377,27 @@ Session::when_engine_running ()
XMLNode* child = 0;
_click_io.reset (new ClickIO (*this, "click"));
_click_gain.reset (new Amp (*this));
_click_gain->activate ();
if (state_tree && (child = find_named_node (*state_tree->root(), "Click")) != 0) {
/* existing state for Click */
int c;
int c = 0;
if (Stateful::loading_state_version < 3000) {
c = _click_io->set_state_2X (*child->children().front(), Stateful::loading_state_version, false);
} else {
c = _click_io->set_state (*child->children().front(), Stateful::loading_state_version);
const XMLNodeList& children (child->children());
XMLNodeList::const_iterator i = children.begin();
if ((c = _click_io->set_state (**i, Stateful::loading_state_version)) == 0) {
++i;
if (i != children.end()) {
c = _click_gain->set_state (**i, Stateful::loading_state_version);
}
}
}
if (c == 0) {
_clicking = Config->get_clicking ();

View File

@ -20,6 +20,7 @@
#include <list>
#include <cerrno>
#include "ardour/amp.h"
#include "ardour/ardour.h"
#include "ardour/audio_buffer.h"
#include "ardour/buffer_set.h"
@ -118,9 +119,9 @@ Session::click (framepos_t start, framecnt_t nframes)
}
copy = min (clk->duration - clk->offset, nframes - internal_offset);
memcpy (buf + internal_offset, &clk->data[clk->offset], copy * sizeof (Sample));
clk->offset += copy;
if (clk->offset >= clk->duration) {
@ -131,6 +132,7 @@ Session::click (framepos_t start, framecnt_t nframes)
}
}
_click_gain->run (bufs, 0, 0, nframes, false);
_click_io->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0);
}

View File

@ -1167,15 +1167,16 @@ Session::state(bool full_state)
}
if (_click_io) {
child = node->add_child ("Click");
child->add_child_nocopy (_click_io->state (full_state));
XMLNode* gain_child = node->add_child ("Click");
gain_child->add_child_nocopy (_click_io->state (full_state));
gain_child->add_child_nocopy (_click_gain->state (full_state));
}
if (full_state) {
child = node->add_child ("NamedSelections");
XMLNode* ns_child = node->add_child ("NamedSelections");
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
if (full_state) {
child->add_child_nocopy ((*i)->get_state());
ns_child->add_child_nocopy ((*i)->get_state());
}
}
}
@ -1409,7 +1410,13 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "Click")) == 0) {
warning << _("Session: XML state has no click section") << endmsg;
} else if (_click_io) {
_click_io->set_state (*child, version);
const XMLNodeList& children (child->children());
XMLNodeList::const_iterator i = children.begin();
_click_io->set_state (**i, version);
++i;
if (i != children.end()) {
_click_gain->set_state (**i, version);
}
}
if ((child = find_named_node (node, "ControlProtocols")) != 0) {
@ -3481,6 +3488,12 @@ Session::config_changed (std::string p, bool ours)
_clicking = false;
}
} else if (p == "click-gain") {
if (_click_gain) {
_click_gain->set_gain (Config->get_click_gain(), this);
}
} else if (p == "send-mtc") {
if (Config->get_send_mtc ()) {