triggerbox: implement stretch options, save+recall
This commit is contained in:
@@ -251,6 +251,15 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
||||
float midi_velocity_effect() const { return _midi_velocity_effect; }
|
||||
void set_midi_velocity_effect (float);
|
||||
|
||||
enum StretchMode { /* currently mapped to the matching RubberBand::RubberBandStretcher::Option */
|
||||
Crisp,
|
||||
Mixed,
|
||||
Smooth,
|
||||
};
|
||||
|
||||
StretchMode stretch_mode() const { return _stretch_mode; }
|
||||
void set_stretch_mode (StretchMode);
|
||||
|
||||
double apparent_tempo() const { return _apparent_tempo; }
|
||||
double set_tempo (double t);
|
||||
|
||||
@@ -301,6 +310,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
|
||||
PBD::Property<bool> _stretchable;
|
||||
PBD::Property<bool> _isolated;
|
||||
PBD::Property<color_t> _color;
|
||||
PBD::Property<StretchMode> _stretch_mode;
|
||||
|
||||
bool cue_launched;
|
||||
|
||||
@@ -702,6 +712,7 @@ namespace Properties {
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::LaunchStyle> launch_style;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::FollowAction> follow_action0;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::FollowAction> follow_action1;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<Trigger::StretchMode> stretch_mode;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<uint32_t> follow_count;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<int> follow_action_probability;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<float> velocity_effect;
|
||||
@@ -717,6 +728,7 @@ namespace Properties {
|
||||
namespace PBD {
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::FollowAction);
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::LaunchStyle);
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::Trigger::StretchMode);
|
||||
} /* namespace PBD */
|
||||
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ setup_enum_writer ()
|
||||
Trigger::State _TriggerState;
|
||||
Trigger::LaunchStyle _TriggerLaunchStyle;
|
||||
Trigger::FollowAction _TriggerFollowAction;
|
||||
Trigger::StretchMode _TriggerStretchMode;
|
||||
CueBehavior _CueBehavior;
|
||||
|
||||
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
|
||||
@@ -879,6 +880,11 @@ setup_enum_writer ()
|
||||
REGISTER_CLASS_ENUM (Trigger, Repeat);
|
||||
REGISTER (_TriggerLaunchStyle);
|
||||
|
||||
REGISTER_CLASS_ENUM (Trigger, Crisp);
|
||||
REGISTER_CLASS_ENUM (Trigger, Mixed);
|
||||
REGISTER_CLASS_ENUM (Trigger, Smooth);
|
||||
REGISTER (_TriggerStretchMode);
|
||||
|
||||
REGISTER_ENUM (FollowCues);
|
||||
REGISTER_ENUM (ImplicitlyIgnoreCues);
|
||||
REGISTER_BITS (_CueBehavior);
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace ARDOUR {
|
||||
PBD::PropertyDescriptor<gain_t> gain;
|
||||
PBD::PropertyDescriptor<bool> stretchable;
|
||||
PBD::PropertyDescriptor<bool> isolated;
|
||||
PBD::PropertyDescriptor<Trigger::StretchMode> stretch_mode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
|
||||
, _stretchable (Properties::stretchable, true)
|
||||
, _isolated (Properties::isolated, false)
|
||||
, _color (Properties::color, 0xBEBEBEFF)
|
||||
, _stretch_mode (Properties::stretch_mode, Trigger::Crisp)
|
||||
, cue_launched (false)
|
||||
, _barcnt (0.)
|
||||
, _apparent_tempo (0.)
|
||||
@@ -114,6 +116,7 @@ Trigger::Trigger (uint32_t n, TriggerBox& b)
|
||||
add_property (_stretchable);
|
||||
add_property (_isolated);
|
||||
add_property (_color);
|
||||
add_property (_stretch_mode);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -216,6 +219,18 @@ Trigger::set_gain (gain_t g)
|
||||
_box.session().set_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
Trigger::set_stretch_mode (Trigger::StretchMode sm)
|
||||
{
|
||||
if (_stretch_mode == sm) {
|
||||
return;
|
||||
}
|
||||
|
||||
_stretch_mode = sm;
|
||||
PropertyChanged (Properties::stretch_mode);
|
||||
_box.session().set_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
Trigger::set_midi_velocity_effect (float mve)
|
||||
{
|
||||
@@ -1174,10 +1189,16 @@ AudioTrigger::setup_stretcher ()
|
||||
boost::shared_ptr<AudioRegion> ar (boost::dynamic_pointer_cast<AudioRegion> (_region));
|
||||
const uint32_t nchans = std::min (_box.input_streams().n_audio(), ar->n_channels());
|
||||
|
||||
/* XXX maybe get some of these options from region properties (when/if we have them) ? */
|
||||
//map our internal enum to a rubberband option
|
||||
RubberBandStretcher::Option ro;
|
||||
switch (_stretch_mode) {
|
||||
case Trigger::Crisp : ro = RubberBandStretcher::OptionTransientsCrisp; break;
|
||||
case Trigger::Mixed : ro = RubberBandStretcher::OptionTransientsMixed; break;
|
||||
case Trigger::Smooth : ro = RubberBandStretcher::OptionTransientsSmooth; break;
|
||||
}
|
||||
|
||||
RubberBandStretcher::Options options = RubberBandStretcher::Option (RubberBandStretcher::OptionProcessRealTime |
|
||||
RubberBandStretcher::OptionTransientsCrisp);
|
||||
ro);
|
||||
|
||||
delete _stretcher;
|
||||
_stretcher = new RubberBandStretcher (_box.session().sample_rate(), nchans, options, 1.0, 1.0);
|
||||
@@ -1948,6 +1969,8 @@ Trigger::make_property_quarks ()
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretchable = %1\n", Properties::stretchable.property_id));
|
||||
Properties::isolated.property_id = g_quark_from_static_string (X_("isolated"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for isolated = %1\n", Properties::isolated.property_id));
|
||||
Properties::stretch_mode.property_id = g_quark_from_static_string (X_("stretch_mode"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretch_mode = %1\n", Properties::stretch_mode.property_id));
|
||||
}
|
||||
|
||||
const int32_t TriggerBox::default_triggers_per_box = 8;
|
||||
|
||||
Reference in New Issue
Block a user