13
0

triggerbox: setup_stretcher must be called for stretch_mode to have any effect

This commit is contained in:
Ben Loftis 2022-02-12 11:12:08 -06:00
parent d20dfe8f88
commit 563dc9ae21
2 changed files with 15 additions and 2 deletions

View File

@ -336,6 +336,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
virtual double segment_tempo() const = 0;
virtual void set_segment_tempo (double t) = 0;
virtual void setup_stretcher () = 0;
Temporal::Meter meter() const { return _meter; }
void set_velocity_gain (gain_t g) {_pending_velocity_gain=g;}
@ -492,10 +494,11 @@ class LIBARDOUR_API AudioTrigger : public Trigger {
samplecnt_t to_pad;
samplecnt_t to_drop;
virtual void setup_stretcher ();
void drop_data ();
int load_data (boost::shared_ptr<AudioRegion>);
void estimate_tempo ();
void setup_stretcher ();
void reset_stretcher ();
void _startup (BufferSet&, pframes_t dest_offset, Temporal::BBT_Offset const &);
};
@ -546,9 +549,10 @@ class LIBARDOUR_API MIDITrigger : public Trigger {
bool patch_change_set (uint8_t channel) const;
/* theoretically, MIDI files can have a dedicated tempo outside the session tempo map (*un-stretched*) but this is currently unimplemented */
/* boilerplate tempo functions are provided here so we don't have to do constant dynamic_cast checks to use the tempo API */
/* boilerplate tempo functions are provided here so we don't have to do constant dynamic_cast checks to use the tempo+stretch APIs */
virtual double segment_tempo() const {return 120.0;}
virtual void set_segment_tempo (double t) {}
virtual void setup_stretcher () {}
void set_channel_map (int channel, int target);
void unset_channel_map (int channel);

View File

@ -265,6 +265,8 @@ Trigger::update_properties ()
while ((g = ui_state.generation.load()) != last_property_generation) {
StretchMode old_stretch = _stretch_mode;
std::cerr << "prop copy for " << index() << endl;
_launch_style = ui_state.launch_style;
@ -283,6 +285,13 @@ Trigger::update_properties ()
_stretch_mode = ui_state.stretch_mode;
_color = ui_state.color;
/* @paul: is this safe to do here ?*/
/* the UI only allows changing stretch_mode when the clip is stopped,
* and you can't d+d or create a new clip while it's playing, so I think it's OK */
if (_stretch_mode != old_stretch) {
setup_stretcher ();
}
/* during construction of a new trigger, the ui_state.name is initialized and queued
* ...but in the interim, we have likely been assigned a name from a region in a separate thread
* ...so don't overwrite our name if ui_state.name is empty