mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 12:46:32 +01:00
MIDI regions attempt to get their tempo & meter from their source file
This commit is contained in:
parent
f3fd8d6e40
commit
06751f64b4
1 changed files with 5 additions and 1 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
#include "pbd/basename.h"
|
#include "pbd/basename.h"
|
||||||
#include "pbd/types_convert.h"
|
#include "pbd/types_convert.h"
|
||||||
|
|
||||||
|
#include "ardour/file_source.h"
|
||||||
#include "ardour/automation_control.h"
|
#include "ardour/automation_control.h"
|
||||||
#include "ardour/midi_cursor.h"
|
#include "ardour/midi_cursor.h"
|
||||||
#include "ardour/midi_model.h"
|
#include "ardour/midi_model.h"
|
||||||
|
|
@ -98,6 +99,7 @@ MidiRegion::MidiRegion (std::shared_ptr<const MidiRegion> other, timecnt_t const
|
||||||
: Region (other, offset)
|
: Region (other, offset)
|
||||||
, _ignore_shift (false)
|
, _ignore_shift (false)
|
||||||
{
|
{
|
||||||
|
set_tempo_stuff_from_source ();
|
||||||
|
|
||||||
assert(_name.val().find("/") == string::npos);
|
assert(_name.val().find("/") == string::npos);
|
||||||
midi_source(0)->ModelChanged.connect_same_thread (_source_connection, std::bind (&MidiRegion::model_changed, this));
|
midi_source(0)->ModelChanged.connect_same_thread (_source_connection, std::bind (&MidiRegion::model_changed, this));
|
||||||
|
|
@ -118,7 +120,9 @@ MidiRegion::set_tempo_stuff_from_source ()
|
||||||
Temporal::TempoMap::SharedPtr new_map (smf->tempo_map (provided));
|
Temporal::TempoMap::SharedPtr new_map (smf->tempo_map (provided));
|
||||||
|
|
||||||
if (!provided) {
|
if (!provided) {
|
||||||
new_map.reset (new Temporal::TempoMap());
|
_tempo = Temporal::Tempo (120, 4);
|
||||||
|
_meter = Temporal::Meter (4, 4);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Temporal::TempoPoint const tp (new_map->tempo_at (start()));
|
Temporal::TempoPoint const tp (new_map->tempo_at (start()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue