mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
ControlGroup: fiddle with API for clarity, and add TrimAutomation special case
This commit is contained in:
parent
c4838f5d87
commit
05c6616e32
2 changed files with 30 additions and 25 deletions
|
|
@ -51,12 +51,12 @@ class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGr
|
||||||
|
|
||||||
int add_control (std::shared_ptr<AutomationControl>, bool push = false);
|
int add_control (std::shared_ptr<AutomationControl>, bool push = false);
|
||||||
int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
|
int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
|
||||||
bool push (std::shared_ptr<AutomationControl>);
|
|
||||||
bool pop (std::shared_ptr<AutomationControl>);
|
void pop_all ();
|
||||||
|
|
||||||
ControlList controls () const;
|
ControlList controls () const;
|
||||||
|
|
||||||
void clear ();
|
void clear (bool pop = false);
|
||||||
|
|
||||||
void set_active (bool);
|
void set_active (bool);
|
||||||
bool active() const { return _active; }
|
bool active() const { return _active; }
|
||||||
|
|
@ -101,7 +101,7 @@ class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGr
|
||||||
class LIBARDOUR_API GainControlGroup : public ControlGroup
|
class LIBARDOUR_API GainControlGroup : public ControlGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GainControlGroup();
|
GainControlGroup (ARDOUR::AutomationType = GainAutomation);
|
||||||
|
|
||||||
void set_group_value (std::shared_ptr<AutomationControl>, double val);
|
void set_group_value (std::shared_ptr<AutomationControl>, double val);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ ControlGroup::set_mode (Mode m)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlGroup::clear ()
|
ControlGroup::clear (bool pop)
|
||||||
{
|
{
|
||||||
/* we're giving up on all members, so we don't care about their
|
/* we're giving up on all members, so we don't care about their
|
||||||
* DropReferences signals anymore
|
* DropReferences signals anymore
|
||||||
|
|
@ -77,8 +77,12 @@ ControlGroup::clear ()
|
||||||
|
|
||||||
_controls.clear ();
|
_controls.clear ();
|
||||||
|
|
||||||
for (std::vector<std::shared_ptr<AutomationControl> >::iterator c = controls.begin(); c != controls.end(); ++c) {
|
for (auto & c : controls) {
|
||||||
(*c)->set_group (std::shared_ptr<ControlGroup>());
|
if (pop) {
|
||||||
|
c->pop_group ();
|
||||||
|
} else {
|
||||||
|
c->set_group (std::shared_ptr<ControlGroup>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,7 +221,6 @@ void
|
||||||
ControlGroup::fill_from_selection (CoreSelection const & sel, Evoral::Parameter const & p)
|
ControlGroup::fill_from_selection (CoreSelection const & sel, Evoral::Parameter const & p)
|
||||||
{
|
{
|
||||||
CoreSelection::StripableAutomationControls stripables;
|
CoreSelection::StripableAutomationControls stripables;
|
||||||
Evoral::Parameter gain_p (GainAutomation);
|
|
||||||
|
|
||||||
sel.get_stripables (stripables);
|
sel.get_stripables (stripables);
|
||||||
|
|
||||||
|
|
@ -226,41 +229,43 @@ ControlGroup::fill_from_selection (CoreSelection const & sel, Evoral::Parameter
|
||||||
* their Amp processor which takes a certain kind of ownership of it.
|
* their Amp processor which takes a certain kind of ownership of it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (p == gain_p) {
|
switch (p.type()) {
|
||||||
|
case GainAutomation:
|
||||||
for (auto & s : stripables) {
|
for (auto & s : stripables) {
|
||||||
std::shared_ptr<AutomationControl> ac = s.stripable->gain_control ();
|
std::shared_ptr<AutomationControl> ac = s.stripable->gain_control ();
|
||||||
if (ac) {
|
if (ac) {
|
||||||
push (ac);
|
add_control (ac, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
case TrimAutomation:
|
||||||
|
for (auto & s : stripables) {
|
||||||
|
std::shared_ptr<AutomationControl> ac = s.stripable->trim_control ();
|
||||||
|
if (ac) {
|
||||||
|
add_control (ac, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
for (auto & s : stripables) {
|
for (auto & s : stripables) {
|
||||||
std::shared_ptr<AutomationControl> ac = s.stripable->automation_control (p, true);
|
std::shared_ptr<AutomationControl> ac = s.stripable->automation_control (p, true);
|
||||||
if (ac) {
|
if (ac) {
|
||||||
push (ac);
|
add_control (ac, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
ControlGroup::push (std::shared_ptr<AutomationControl> c)
|
ControlGroup::pop_all ()
|
||||||
{
|
{
|
||||||
add_control (c, true);
|
clear (true);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ControlGroup::pop (std::shared_ptr<AutomationControl> c)
|
|
||||||
{
|
|
||||||
remove_control (c, true);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---- GAIN CONTROL GROUP -----------*/
|
/*---- GAIN CONTROL GROUP -----------*/
|
||||||
|
|
||||||
GainControlGroup::GainControlGroup ()
|
GainControlGroup::GainControlGroup (ARDOUR::AutomationType t)
|
||||||
: ControlGroup (GainAutomation)
|
: ControlGroup (t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue