mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
continued work on using new tempo map API (before switch to RCU)
This commit is contained in:
parent
f7ff656619
commit
7ef11dc698
8 changed files with 31 additions and 40 deletions
|
|
@ -585,8 +585,8 @@ public:
|
||||||
|
|
||||||
void mouse_add_new_tempo_event (Temporal::timepos_t where);
|
void mouse_add_new_tempo_event (Temporal::timepos_t where);
|
||||||
void mouse_add_new_meter_event (Temporal::timepos_t where);
|
void mouse_add_new_meter_event (Temporal::timepos_t where);
|
||||||
void edit_tempo_section (Temporal::TempoPoint*);
|
void edit_tempo_section (Temporal::TempoPoint&);
|
||||||
void edit_meter_section (Temporal::MeterPoint*);
|
void edit_meter_section (Temporal::MeterPoint&);
|
||||||
|
|
||||||
bool should_ripple () const;
|
bool should_ripple () const;
|
||||||
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, samplepos_t, samplecnt_t, ARDOUR::RegionList* exclude, bool add_to_command);
|
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, samplepos_t, samplecnt_t, ARDOUR::RegionList* exclude, bool add_to_command);
|
||||||
|
|
|
||||||
|
|
@ -1042,17 +1042,13 @@ Editor::set_xjadeo_viewoption (int what)
|
||||||
void
|
void
|
||||||
Editor::edit_current_meter ()
|
Editor::edit_current_meter ()
|
||||||
{
|
{
|
||||||
#warning NUTEMPO needs new map API
|
edit_meter_section (_session->tempo_map().metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).meter());
|
||||||
//ARDOUR::MeterSection* ms = const_cast<ARDOUR::MeterSection*>(&_session->tempo_map().meter_section_at_sample (ARDOUR_UI::instance()->primary_clock->absolute_time()));
|
|
||||||
//edit_meter_section (ms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::edit_current_tempo ()
|
Editor::edit_current_tempo ()
|
||||||
{
|
{
|
||||||
#warning NUTEMPO needs new map API
|
edit_tempo_section (_session->tempo_map().metric_at (ARDOUR_UI::instance()->primary_clock->absolute_time()).tempo());
|
||||||
// ARDOUR::TempoSection* ts = const_cast<ARDOUR::TempoSection*>(&_session->tempo_map().tempo_section_at_sample (ARDOUR_UI::instance()->primary_clock->absolute_time()));
|
|
||||||
// edit_tempo_section (ts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<RadioAction>
|
RefPtr<RadioAction>
|
||||||
|
|
|
||||||
|
|
@ -298,18 +298,16 @@ Editor::import_smf_tempo_map (Evoral::SMF const & smf, timepos_t const & pos)
|
||||||
Temporal::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */
|
Temporal::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */
|
||||||
|
|
||||||
if (have_initial_meter) {
|
if (have_initial_meter) {
|
||||||
#warning NUTEMPO check API for this
|
#warning NUTEMPO figure this out when i have a brain
|
||||||
// new_map.add_tempo (tempo, t->time_pulses/ (double)smf.ppqn() / 4.0, 0, BeatTime);
|
// new_map.set_tempo (tempo, Temporal::Beats (t->time_pulses/ (double)smf.ppqn() / 4.0);
|
||||||
if (!(meter == last_meter)) {
|
if (!(meter == last_meter)) {
|
||||||
bbt = new_map.bbt_at (Beats::from_double (t->time_pulses/(double)smf.ppqn()));
|
bbt = new_map.bbt_at (Beats::from_double (t->time_pulses/(double)smf.ppqn()));
|
||||||
#warning NUTEMPO check API for this
|
new_map.set_meter (meter, bbt);
|
||||||
//new_map.add_meter (meter, bbt, 0, MusicTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#warning NUTEMPO needs new tempo map API
|
new_map.set_meter (meter, bbt);
|
||||||
//new_map.replace_meter (new_map.meter_section_at_sample (0), meter, bbt, pos, AudioTime);
|
new_map.set_tempo (tempo, bbt);
|
||||||
//new_map.replace_tempo (new_map.tempo_section_at_sample (0), tempo, 0.0, pos, AudioTime);
|
|
||||||
have_initial_meter = true;
|
have_initial_meter = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1466,9 +1466,9 @@ Editor::marker_menu_edit ()
|
||||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||||
|
|
||||||
if (mm) {
|
if (mm) {
|
||||||
edit_meter_section (&mm->meter());
|
edit_meter_section (mm->meter());
|
||||||
} else if (tm) {
|
} else if (tm) {
|
||||||
edit_tempo_section (&tm->tempo());
|
edit_tempo_section (tm->tempo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@
|
||||||
#include "pbd/whitespace.h"
|
#include "pbd/whitespace.h"
|
||||||
#include "pbd/stateful_diff_command.h"
|
#include "pbd/stateful_diff_command.h"
|
||||||
|
|
||||||
|
#include "temporal/tempo.h"
|
||||||
|
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "widgets/choice.h"
|
#include "widgets/choice.h"
|
||||||
|
|
@ -7080,9 +7082,7 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
|
||||||
{
|
{
|
||||||
timecnt_t length = start.distance (end);
|
timecnt_t length = start.distance (end);
|
||||||
|
|
||||||
#warning NUTEMPO need new map API
|
const Meter& m (_session->tempo_map().meter_at (start));
|
||||||
#if 0
|
|
||||||
const Meter& m (_session->tempo_map().meter_at_sample (start));
|
|
||||||
|
|
||||||
/* length = 1 bar */
|
/* length = 1 bar */
|
||||||
|
|
||||||
|
|
@ -7093,11 +7093,11 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XXXX METER MATH */
|
/* XXXX METER MATH */
|
||||||
double samples_per_beat = length / m.divisions_per_bar();
|
double superclocks_per_beat = length.superclocks() / m.divisions_per_bar();
|
||||||
|
|
||||||
/* beats per minute = */
|
/* beats per minute = */
|
||||||
|
|
||||||
double beats_per_minute = (_session->sample_rate() * 60.0) / samples_per_beat;
|
double beats_per_minute = (superclock_ticks_per_second * 60.0) / superclocks_per_beat;
|
||||||
|
|
||||||
/* now decide whether to:
|
/* now decide whether to:
|
||||||
|
|
||||||
|
|
@ -7106,7 +7106,7 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TempoSection& t (_session->tempo_map().tempo_section_at_sample (start));
|
const TempoPoint& t (_session->tempo_map().tempo_at (start));
|
||||||
|
|
||||||
bool do_global = false;
|
bool do_global = false;
|
||||||
|
|
||||||
|
|
@ -7153,20 +7153,19 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
|
||||||
XMLNode& before (_session->tempo_map().get_state());
|
XMLNode& before (_session->tempo_map().get_state());
|
||||||
|
|
||||||
if (do_global) {
|
if (do_global) {
|
||||||
_session->tempo_map().change_initial_tempo (beats_per_minute, t.note_type(), t.end_note_types_per_minute());
|
_session->tempo_map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), timepos_t());
|
||||||
} else if (t.sample() == start) {
|
} else if (t.time() == start) {
|
||||||
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type(), t.end_note_types_per_minute());
|
_session->tempo_map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), start);
|
||||||
} else {
|
} else {
|
||||||
/* constant tempo */
|
/* constant tempo */
|
||||||
const Tempo tempo (beats_per_minute, t.note_type());
|
const Tempo tempo (beats_per_minute, t.note_type());
|
||||||
_session->tempo_map().add_tempo (tempo, 0.0, start, Temporal::AudioTime);
|
_session->tempo_map().set_tempo (tempo, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode& after (_session->tempo_map().get_state());
|
XMLNode& after (_session->tempo_map().get_state());
|
||||||
|
|
||||||
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||||
commit_reversible_command ();
|
commit_reversible_command ();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -501,9 +501,9 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::edit_meter_section (Temporal::MeterPoint* section)
|
Editor::edit_meter_section (Temporal::MeterPoint& section)
|
||||||
{
|
{
|
||||||
MeterDialog meter_dialog (_session->tempo_map(), *section, _("done"));
|
MeterDialog meter_dialog (_session->tempo_map(), section, _("done"));
|
||||||
|
|
||||||
switch (meter_dialog.run()) {
|
switch (meter_dialog.run()) {
|
||||||
case RESPONSE_ACCEPT:
|
case RESPONSE_ACCEPT:
|
||||||
|
|
@ -532,9 +532,9 @@ Editor::edit_meter_section (Temporal::MeterPoint* section)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::edit_tempo_section (TempoPoint* section)
|
Editor::edit_tempo_section (TempoPoint& section)
|
||||||
{
|
{
|
||||||
TempoDialog tempo_dialog (_session->tempo_map(), *section, _("done"));
|
TempoDialog tempo_dialog (_session->tempo_map(), section, _("done"));
|
||||||
|
|
||||||
switch (tempo_dialog.run ()) {
|
switch (tempo_dialog.run ()) {
|
||||||
case RESPONSE_ACCEPT:
|
case RESPONSE_ACCEPT:
|
||||||
|
|
@ -565,13 +565,13 @@ Editor::edit_tempo_section (TempoPoint* section)
|
||||||
void
|
void
|
||||||
Editor::edit_tempo_marker (TempoMarker& tm)
|
Editor::edit_tempo_marker (TempoMarker& tm)
|
||||||
{
|
{
|
||||||
edit_tempo_section (&tm.tempo());
|
edit_tempo_section (tm.tempo());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::edit_meter_marker (MeterMarker& mm)
|
Editor::edit_meter_marker (MeterMarker& mm)
|
||||||
{
|
{
|
||||||
edit_meter_section (&mm.meter());
|
edit_meter_section (mm.meter());
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
|
|
||||||
|
|
@ -2931,10 +2931,8 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
|
||||||
snapped_x = trackview.editor ().pixel_to_sample (current_x); /* samples */
|
snapped_x = trackview.editor ().pixel_to_sample (current_x); /* samples */
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning NUTEMPO need new tempo map API
|
Temporal::TempoMap& tmap (trackview.session()->tempo_map());
|
||||||
//TempoMap& tmap (trackview.session()->tempo_map());
|
const timepos_t abs_beats (tmap.quarter_note_at (snapped_x));
|
||||||
//const timepos_t abs_beats (tmap.quarter_note_at (snapped_x));
|
|
||||||
const timepos_t abs_beats;
|
|
||||||
const Temporal::Beats beats = _region->absolute_time_to_source_beats (abs_beats);
|
const Temporal::Beats beats = _region->absolute_time_to_source_beats (abs_beats);
|
||||||
Temporal::Beats len = Temporal::Beats();
|
Temporal::Beats len = Temporal::Beats();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -518,8 +518,8 @@ public:
|
||||||
|
|
||||||
virtual void mouse_add_new_tempo_event (Temporal::timepos_t where) = 0;
|
virtual void mouse_add_new_tempo_event (Temporal::timepos_t where) = 0;
|
||||||
virtual void mouse_add_new_meter_event (Temporal::timepos_t where) = 0;
|
virtual void mouse_add_new_meter_event (Temporal::timepos_t where) = 0;
|
||||||
virtual void edit_tempo_section (Temporal::TempoPoint*) = 0;
|
virtual void edit_tempo_section (Temporal::TempoPoint&) = 0;
|
||||||
virtual void edit_meter_section (Temporal::MeterPoint*) = 0;
|
virtual void edit_meter_section (Temporal::MeterPoint&) = 0;
|
||||||
|
|
||||||
virtual bool should_ripple () const = 0;
|
virtual bool should_ripple () const = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue