Auditioner: round-up midi region length to seconds, at least 2 seconds long
This commit is contained in:
parent
7321248916
commit
a435d4d18e
@ -412,6 +412,14 @@ Auditioner::audition_region (boost::shared_ptr<Region> region, bool loop)
|
|||||||
midi_region = (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (region, false)));
|
midi_region = (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (region, false)));
|
||||||
midi_region->set_position (_import_position);
|
midi_region->set_position (_import_position);
|
||||||
|
|
||||||
|
/* avoid truncated notes: round up the length of midi regions to seconds, at least 2 seconds long */
|
||||||
|
/* TODO: maybe round up to the nearest bar like it's done in import.cc write_midi_data_to_new_files */
|
||||||
|
samplecnt_t smpl = midi_region->length_samples();
|
||||||
|
double seconds = smpl/_session.sample_rate();
|
||||||
|
seconds = min (2.0, ceil(seconds));
|
||||||
|
timecnt_t new_len( seconds * _session.sample_rate() );
|
||||||
|
midi_region->set_length(new_len);
|
||||||
|
|
||||||
_disk_reader->audio_playlist()->drop_regions();
|
_disk_reader->audio_playlist()->drop_regions();
|
||||||
|
|
||||||
_disk_reader->midi_playlist()->drop_regions ();
|
_disk_reader->midi_playlist()->drop_regions ();
|
||||||
|
Loading…
Reference in New Issue
Block a user