mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
fix import of MIDI files
git-svn-id: svn://localhost/ardour2/branches/3.0@6782 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0015553c4a
commit
9bdb9836b5
1 changed files with 11 additions and 4 deletions
|
|
@ -235,9 +235,10 @@ create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boost::shared_ptr<AudioFileSource> afs;
|
boost::shared_ptr<AudioFileSource> afs;
|
||||||
afs = boost::dynamic_pointer_cast<AudioFileSource>(source);
|
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(source)) != 0) {
|
||||||
afs->set_timeline_position(timeline_position);
|
afs->set_timeline_position(timeline_position);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,6 +334,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
|
||||||
uint64_t t = 0;
|
uint64_t t = 0;
|
||||||
uint32_t delta_t = 0;
|
uint32_t delta_t = 0;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
|
bool first = true;
|
||||||
|
|
||||||
while (!status.cancel) {
|
while (!status.cancel) {
|
||||||
size = buf_size;
|
size = buf_size;
|
||||||
|
|
@ -351,6 +353,11 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
smfs->mark_streaming_write_started ();
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
smfs->append_event_unlocked_beats(Evoral::Event<double>(0,
|
smfs->append_event_unlocked_beats(Evoral::Event<double>(0,
|
||||||
(double)t / (double)source->ppqn(),
|
(double)t / (double)source->ppqn(),
|
||||||
size,
|
size,
|
||||||
|
|
@ -364,7 +371,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status,
|
||||||
const double length_beats = ceil(t / (double)source->ppqn());
|
const double length_beats = ceil(t / (double)source->ppqn());
|
||||||
BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
|
BeatsFramesConverter converter(smfs->session().tempo_map(), pos);
|
||||||
smfs->update_length(pos, converter.to(length_beats));
|
smfs->update_length(pos, converter.to(length_beats));
|
||||||
smfs->end_write();
|
smfs->mark_streaming_write_completed ();
|
||||||
|
|
||||||
if (status.cancel) {
|
if (status.cancel) {
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue