mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
incorporating new tempo map API
This commit is contained in:
parent
f67029bd02
commit
749a49c278
26 changed files with 234 additions and 293 deletions
|
|
@ -380,21 +380,21 @@ ARDOUR_UI::parameter_changed (std::string p)
|
|||
if (editor) editor->toggle_meter_updating();
|
||||
} else if (p == "primary-clock-delta-mode") {
|
||||
if (UIConfiguration::instance().get_primary_clock_delta_mode() != NoDelta) {
|
||||
primary_clock->set_is_duration (true);
|
||||
primary_clock->set_is_duration (true, timepos_t());
|
||||
primary_clock->set_editable (false);
|
||||
primary_clock->set_widget_name ("transport delta");
|
||||
} else {
|
||||
primary_clock->set_is_duration (false);
|
||||
primary_clock->set_is_duration (false, timepos_t());
|
||||
primary_clock->set_editable (true);
|
||||
primary_clock->set_widget_name ("transport");
|
||||
}
|
||||
} else if (p == "secondary-clock-delta-mode") {
|
||||
if (UIConfiguration::instance().get_secondary_clock_delta_mode() != NoDelta) {
|
||||
secondary_clock->set_is_duration (true);
|
||||
secondary_clock->set_is_duration (true, timepos_t());
|
||||
secondary_clock->set_editable (false);
|
||||
secondary_clock->set_widget_name ("secondary delta");
|
||||
} else {
|
||||
secondary_clock->set_is_duration (false);
|
||||
secondary_clock->set_is_duration (false, timepos_t());
|
||||
secondary_clock->set_editable (true);
|
||||
secondary_clock->set_widget_name ("secondary");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1335,7 +1335,6 @@ AudioClock::set_session (Session *s)
|
|||
Config->ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
|
||||
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
|
||||
_session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this, _1), gui_context());
|
||||
_session->tempo_map().MetricPositionChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this, _1), gui_context());
|
||||
|
||||
XMLNode* node = _session->extra_xml (X_("ClockModes"));
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
|
|||
void locate ();
|
||||
void set_mode (Mode, bool noemit = false);
|
||||
void set_bbt_reference (Temporal::timepos_t const &);
|
||||
void set_is_duration (bool);
|
||||
void set_is_duration (bool, Temporal::timepos_t const &);
|
||||
|
||||
void copy_text_to_clipboard () const;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ using namespace Gtk;
|
|||
using namespace Glib;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
using PBD::internationalize;
|
||||
using PBD::atoi;
|
||||
|
|
@ -1372,8 +1373,8 @@ Editor::set_session (Session *t)
|
|||
_session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Editor::add_vcas, this, _1), gui_context());
|
||||
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Editor::add_routes, this, _1), gui_context());
|
||||
_session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_title, this), gui_context());
|
||||
_session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_changed, this, _1), gui_context());
|
||||
_session->tempo_map().MetricPositionChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempometric_position_changed, this, _1), gui_context());
|
||||
_session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_property_changed, this, _1), gui_context());
|
||||
_session->tempo_map().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::tempo_map_changed, this), gui_context());
|
||||
_session->Located.connect (_session_connections, invalidator (*this), boost::bind (&Editor::located, this), gui_context());
|
||||
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::parameter_changed, this, _1), gui_context());
|
||||
_session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Editor::session_state_saved, this, _1), gui_context());
|
||||
|
|
@ -3967,10 +3968,14 @@ Editor::cycle_zoom_focus ()
|
|||
void
|
||||
Editor::update_grid ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_grid_type == GridTypeNone) {
|
||||
hide_grid_lines ();
|
||||
} else if (grid_musical()) {
|
||||
std::vector<TempoMap::BBTPoint> grid;
|
||||
Temporal::TempoMapPoints grid;
|
||||
if (bbt_ruler_scale != bbt_show_many) {
|
||||
compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ namespace ARDOUR {
|
|||
class Region;
|
||||
class RouteGroup;
|
||||
class Session;
|
||||
class TempoSection;
|
||||
class Track;
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +352,7 @@ public:
|
|||
void mixer_strip_width_changed ();
|
||||
void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
|
||||
void show_track_in_display (TimeAxisView* tv, bool move_into_view = false);
|
||||
void tempo_curve_selected (ARDOUR::TempoSection* ts, bool yn);
|
||||
void tempo_curve_selected (Temporal::TempoPoint* ts, bool yn);
|
||||
|
||||
/* nudge is initiated by transport controls owned by ARDOUR_UI */
|
||||
|
||||
|
|
@ -569,10 +568,10 @@ public:
|
|||
|
||||
/* Ruler metrics methods */
|
||||
|
||||
void metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
|
||||
void metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
|
||||
void metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
|
||||
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
|
||||
void metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||
void metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||
void metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||
|
||||
/* editing operations that need to be public */
|
||||
void mouse_add_new_marker (Temporal::timepos_t where, bool is_cd=false);
|
||||
|
|
@ -586,8 +585,8 @@ public:
|
|||
|
||||
void mouse_add_new_tempo_event (Temporal::timepos_t where);
|
||||
void mouse_add_new_meter_event (Temporal::timepos_t where);
|
||||
void edit_tempo_section (ARDOUR::TempoSection*);
|
||||
void edit_meter_section (ARDOUR::MeterSection*);
|
||||
void edit_tempo_section (Temporal::TempoPoint*);
|
||||
void edit_meter_section (Temporal::MeterPoint*);
|
||||
|
||||
bool should_ripple () const;
|
||||
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, samplepos_t, samplecnt_t, ARDOUR::RegionList* exclude, bool add_to_command);
|
||||
|
|
@ -1740,8 +1739,8 @@ private:
|
|||
|
||||
void remove_tempo_marker (ArdourCanvas::Item*);
|
||||
void remove_meter_marker (ArdourCanvas::Item*);
|
||||
gint real_remove_tempo_marker (ARDOUR::TempoSection*);
|
||||
gint real_remove_meter_marker (ARDOUR::MeterSection*);
|
||||
gint real_remove_tempo_marker (Temporal::TempoPoint*);
|
||||
gint real_remove_meter_marker (Temporal::MeterPoint*);
|
||||
|
||||
void edit_tempo_marker (TempoMarker&);
|
||||
void edit_meter_marker (MeterMarker&);
|
||||
|
|
@ -1756,7 +1755,6 @@ private:
|
|||
void marker_menu_remove ();
|
||||
void marker_menu_rename ();
|
||||
void rename_marker (ArdourMarker* marker);
|
||||
void toggle_marker_lock_style ();
|
||||
void toggle_tempo_clamped ();
|
||||
void toggle_tempo_type ();
|
||||
void ramp_to_next_tempo ();
|
||||
|
|
@ -1805,11 +1803,12 @@ private:
|
|||
Curves tempo_curves;
|
||||
|
||||
void remove_metric_marks ();
|
||||
void draw_metric_marks (const Temporal::TempoMap::Metrics& metrics);
|
||||
void draw_metric_marks (Temporal::TempoMap::Metrics& metrics);
|
||||
|
||||
void compute_current_bbt_points (std::vector<Temporal::Point>& grid, samplepos_t left, samplepos_t right);
|
||||
void compute_current_bbt_points (Temporal::TempoMapPoints& grid, samplepos_t left, samplepos_t right);
|
||||
|
||||
void tempo_map_changed (const PBD::PropertyChange&);
|
||||
void tempo_map_property_changed (const PBD::PropertyChange&);
|
||||
void tempo_map_changed ();
|
||||
void tempometric_position_changed (const PBD::PropertyChange&);
|
||||
|
||||
void redisplay_grid (bool immediate_redraw);
|
||||
|
|
|
|||
|
|
@ -3994,7 +3994,7 @@ TempoEndDrag::TempoEndDrag (Editor* e, ArdourCanvas::Item* i)
|
|||
DEBUG_TRACE (DEBUG::Drags, "New TempoEndDrag\n");
|
||||
TempoMarker* marker = reinterpret_cast<TempoMarker*> (_item->get_data ("marker"));
|
||||
_tempo = &marker->tempo();
|
||||
_grab_qn = _tempo->pulse() * 4.0;
|
||||
_grab_qn = _tempo->beats();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@ public:
|
|||
|
||||
private:
|
||||
MeterMarker* _marker;
|
||||
ARDOUR::MeterSection* _real_section;
|
||||
Temporal::MeterPoint* _real_section;
|
||||
|
||||
bool _copy;
|
||||
Editing::GridType _old_grid_type;
|
||||
|
|
@ -871,7 +871,7 @@ public:
|
|||
|
||||
private:
|
||||
TempoMarker* _marker;
|
||||
ARDOUR::TempoSection* _real_section;
|
||||
Temporal::TempoPoint* _real_section;
|
||||
|
||||
bool _copy;
|
||||
bool _movable;
|
||||
|
|
@ -903,7 +903,7 @@ public:
|
|||
|
||||
private:
|
||||
double _grab_qn;
|
||||
ARDOUR::TempoSection* _tempo;
|
||||
Temporal::TempoPoint* _tempo;
|
||||
XMLNode* _before_state;
|
||||
bool _drag_valid;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/location.h"
|
||||
#include "ardour/profile.h"
|
||||
|
|
@ -57,6 +59,7 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace Temporal;
|
||||
|
||||
void
|
||||
Editor::clear_marker_display ()
|
||||
|
|
@ -880,14 +883,14 @@ Editor::tempo_or_meter_marker_context_menu (GdkEventButton* ev, ArdourCanvas::It
|
|||
bool can_remove = false;
|
||||
|
||||
if (mm) {
|
||||
can_remove = !mm->meter().initial ();
|
||||
can_remove = !mm->meter().map().is_initial (mm->meter());
|
||||
build_meter_marker_menu (mm, can_remove);
|
||||
meter_marker_menu->popup (1, ev->time);
|
||||
} else if (tm) {
|
||||
if (!tm->tempo().active()) {
|
||||
return;
|
||||
}
|
||||
can_remove = !tm->tempo().initial() && !tm->tempo().locked_to_meter();
|
||||
can_remove = !tm->tempo().map().is_initial(tm->tempo()) && !tm->tempo().locked_to_meter();
|
||||
build_tempo_marker_menu (tm, can_remove);
|
||||
tempo_marker_menu->popup (1, ev->time);
|
||||
} else {
|
||||
|
|
@ -1065,7 +1068,7 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove)
|
|||
MenuList& items = tempo_marker_menu->items();
|
||||
tempo_marker_menu->set_name ("ArdourContextMenu");
|
||||
|
||||
if (!loc->tempo().initial()) {
|
||||
if (!loc->tempo().map().is_initial(loc->tempo())) {
|
||||
if (loc->tempo().clamped()) {
|
||||
items.push_back (MenuElem (_("Don't Continue"), sigc::mem_fun(*this, &Editor::toggle_tempo_clamped)));
|
||||
} else {
|
||||
|
|
@ -1073,23 +1076,15 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove)
|
|||
}
|
||||
}
|
||||
|
||||
if (loc->tempo().type() == TempoSection::Ramp) {
|
||||
if (loc->tempo().type() == Tempo::Ramped) {
|
||||
items.push_back (MenuElem (_("Set Constant"), sigc::mem_fun(*this, &Editor::toggle_tempo_type)));
|
||||
}
|
||||
|
||||
TempoSection* next_ts = _session->tempo_map().next_tempo_section (&loc->tempo());
|
||||
Temporal::Tempo const * next_ts = _session->tempo_map().next_tempo (loc->tempo());
|
||||
if (next_ts && next_ts->note_types_per_minute() != loc->tempo().end_note_types_per_minute()) {
|
||||
items.push_back (MenuElem (_("Ramp to Next"), sigc::mem_fun(*this, &Editor::ramp_to_next_tempo)));
|
||||
}
|
||||
|
||||
if (loc->tempo().position_lock_style() == AudioTime && can_remove) {
|
||||
items.push_back (SeparatorElem());
|
||||
items.push_back (MenuElem (_("Lock to Music"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style)));
|
||||
} else if (can_remove) {
|
||||
items.push_back (SeparatorElem());
|
||||
items.push_back (MenuElem (_("Lock to Audio"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style)));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
items.push_back (MenuElem (_("Edit..."), sigc::mem_fun(*this, &Editor::marker_menu_edit)));
|
||||
|
|
@ -1108,12 +1103,6 @@ Editor::build_meter_marker_menu (MeterMarker* loc, bool can_remove)
|
|||
MenuList& items = meter_marker_menu->items();
|
||||
meter_marker_menu->set_name ("ArdourContextMenu");
|
||||
|
||||
if (loc->meter().position_lock_style() == AudioTime && can_remove) {
|
||||
items.push_back (MenuElem (_("Lock to Music"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style)));
|
||||
} else if (can_remove) {
|
||||
items.push_back (MenuElem (_("Lock to Audio"), sigc::mem_fun(*this, &Editor::toggle_marker_lock_style)));
|
||||
}
|
||||
|
||||
items.push_back (MenuElem (_("Edit..."), sigc::mem_fun(*this, &Editor::marker_menu_edit)));
|
||||
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &Editor::marker_menu_remove)));
|
||||
|
||||
|
|
@ -1499,45 +1488,6 @@ Editor::marker_menu_remove ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_marker_lock_style ()
|
||||
{
|
||||
MeterMarker* mm;
|
||||
TempoMarker* tm;
|
||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||
|
||||
if (mm) {
|
||||
begin_reversible_command (_("change meter lock style"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
MeterSection* msp = &mm->meter();
|
||||
|
||||
const Meter meter (msp->divisions_per_bar(), msp->note_divisor());
|
||||
const Temporal::BBT_Time bbt (msp->bbt());
|
||||
const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
||||
|
||||
_session->tempo_map().replace_meter (*msp, meter, bbt, msp->sample(), pls);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
} else if (tm) {
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
|
||||
const double pulse = tsp->pulse();
|
||||
const samplepos_t sample = tsp->sample();
|
||||
const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
||||
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute());
|
||||
|
||||
begin_reversible_command (_("change tempo lock style"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
_session->tempo_map().replace_tempo (*tsp, tempo, pulse, sample, pls);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
/* actally just resets the ts to constant using initial tempo */
|
||||
void
|
||||
Editor::toggle_tempo_type ()
|
||||
|
|
@ -1547,20 +1497,15 @@ Editor::toggle_tempo_type ()
|
|||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||
|
||||
if (tm) {
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
|
||||
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type());
|
||||
const double pulse = tsp->pulse();
|
||||
const samplepos_t sample = tsp->sample();
|
||||
const PositionLockStyle pls = tsp->position_lock_style();
|
||||
Temporal::TempoPoint & tempo = tm->tempo();
|
||||
|
||||
begin_reversible_command (_("set tempo to constant"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
_session->tempo_map().replace_tempo (*tsp, tempo, pulse, sample, pls);
|
||||
_session->tempo_map().set_ramped (tempo, !tempo.ramped());
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
_session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
|
@ -1576,48 +1521,38 @@ Editor::toggle_tempo_clamped ()
|
|||
begin_reversible_command (_("Clamp Tempo"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
TempoSection* prev = _session->tempo_map().previous_tempo_section (tsp);
|
||||
Temporal::Tempo & tempo (tm->tempo());
|
||||
if (tempo.set_clamped (!tempo.clamped())) {
|
||||
|
||||
if (prev) {
|
||||
/* set to the end tempo of the previous section */
|
||||
Tempo new_tempo (prev->end_note_types_per_minute(), prev->note_type(), tsp->end_note_types_per_minute());
|
||||
_session->tempo_map().gui_change_tempo (tsp, new_tempo);
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
} else {
|
||||
abort_reversible_command ();
|
||||
}
|
||||
|
||||
tsp->set_clamped (!tsp->clamped());
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::ramp_to_next_tempo ()
|
||||
{
|
||||
|
||||
TempoMarker* tm;
|
||||
MeterMarker* mm;
|
||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||
|
||||
if (tm) {
|
||||
TempoMap& tmap (_session->tempo_map());
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
TempoSection* next_ts = tmap.next_tempo_section (&tm->tempo());
|
||||
if (next_ts) {
|
||||
const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), next_ts->note_types_per_minute());
|
||||
const double pulse = tsp->pulse();
|
||||
const samplepos_t sample = tsp->sample();
|
||||
const PositionLockStyle pls = tsp->position_lock_style();
|
||||
|
||||
begin_reversible_command (_("ramp to next tempo"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
tmap.replace_tempo (*tsp, tempo, pulse, sample, pls);
|
||||
begin_reversible_command (_("ramp to next tempo"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
Temporal::TempoPoint & tempo (tm->tempo());
|
||||
if (_session->tempo_map().set_ramped (tempo, !tempo.ramped())) {
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
_session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
} else {
|
||||
abort_reversible_command ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
using Gtkmm2ext::Keyboard;
|
||||
|
||||
bool
|
||||
|
|
@ -1932,7 +1934,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
break;
|
||||
}
|
||||
entered_marker = m_marker;
|
||||
if (m_marker->meter().position_lock_style() == MusicTime) {
|
||||
if (m_marker->meter().map().time_domain() == BeatTime) {
|
||||
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker"));
|
||||
} else {
|
||||
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker music"));
|
||||
|
|
@ -1944,7 +1946,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
break;
|
||||
}
|
||||
entered_marker = t_marker;
|
||||
if (t_marker->tempo().position_lock_style() == MusicTime) {
|
||||
if (t_marker->tempo().map().time_domain() == BeatTime) {
|
||||
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker"));
|
||||
} else {
|
||||
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker music"));
|
||||
|
|
@ -2060,7 +2062,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
|
|||
break;
|
||||
}
|
||||
entered_marker = 0;
|
||||
if (m_marker->meter().position_lock_style() == MusicTime) {
|
||||
if (m_marker->meter().map().time_domain() == BeatTime) {
|
||||
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker music"));
|
||||
} else {
|
||||
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker"));
|
||||
|
|
@ -2072,7 +2074,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
|
|||
break;
|
||||
}
|
||||
entered_marker = 0;
|
||||
if (t_marker->tempo().position_lock_style() == MusicTime) {
|
||||
if (t_marker->tempo().map().time_domain() == BeatTime) {
|
||||
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker music"));
|
||||
} else {
|
||||
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker"));
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ using namespace Gtk;
|
|||
using namespace Gtkmm2ext;
|
||||
using namespace ArdourWidgets;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
using Gtkmm2ext::Keyboard;
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ using namespace PBD;
|
|||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
using Gtkmm2ext::Keyboard;
|
||||
|
||||
//#define SHOW_REGION_EXTRAS
|
||||
|
|
@ -615,7 +617,7 @@ EditorRegions::format_position (timepos_t const & p, char* buf, size_t bufsize,
|
|||
|
||||
switch (ARDOUR_UI::instance ()->primary_clock->mode ()) {
|
||||
case AudioClock::BBT:
|
||||
bbt = _session->tempo_map ().bbt_at_sample (pos);
|
||||
bbt = _session->tempo_map ().bbt_at (pos);
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks);
|
||||
} else {
|
||||
|
|
@ -773,7 +775,9 @@ EditorRegions::populate_row_length (boost::shared_ptr<Region> region, TreeModel:
|
|||
|
||||
if (ARDOUR_UI::instance ()->primary_clock->mode () == AudioClock::BBT) {
|
||||
TempoMap& map (_session->tempo_map ());
|
||||
Temporal::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample ()) - map.beat_at_sample (region->first_sample ()));
|
||||
#warning NUTEMPO we need TempoMap::full_duration() to work with BBT Time here
|
||||
Temporal::BBT_Time bbt; /* uninitialized until full duration works */
|
||||
// Temporal::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample ()) - map.beat_at_sample (region->first_sample ()));
|
||||
snprintf (buf, sizeof (buf), "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks);
|
||||
} else {
|
||||
format_position (timepos_t (region->nt_length ()), buf, sizeof (buf));
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
/* the order here must match the "metric" enums in editor.h */
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ class TimecodeMetric : public ArdourCanvas::Ruler::Metric
|
|||
public:
|
||||
TimecodeMetric (Editor* e) : _editor (e) {}
|
||||
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, double lower, double upper, int maxchars) const {
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, int maxchars) const {
|
||||
_editor->metric_get_timecode (marks, lower, upper, maxchars);
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ class SamplesMetric : public ArdourCanvas::Ruler::Metric
|
|||
public:
|
||||
SamplesMetric (Editor* e) : _editor (e) {}
|
||||
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, double lower, double upper, int maxchars) const {
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, int maxchars) const {
|
||||
_editor->metric_get_samples (marks, lower, upper, maxchars);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ class BBTMetric : public ArdourCanvas::Ruler::Metric
|
|||
public:
|
||||
BBTMetric (Editor* e) : _editor (e) {}
|
||||
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, double lower, double upper, int maxchars) const {
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, int maxchars) const {
|
||||
_editor->metric_get_bbt (marks, lower, upper, maxchars);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +113,7 @@ class MinsecMetric : public ArdourCanvas::Ruler::Metric
|
|||
public:
|
||||
MinsecMetric (Editor* e) : _editor (e) {}
|
||||
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, double lower, double upper, int maxchars) const {
|
||||
void get_marks (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, int maxchars) const {
|
||||
_editor->metric_get_minsec (marks, lower, upper, maxchars);
|
||||
}
|
||||
|
||||
|
|
@ -801,7 +802,7 @@ Editor::set_timecode_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
|
||||
Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t /*upper*/, gint /*maxchars*/)
|
||||
{
|
||||
samplepos_t pos;
|
||||
samplecnt_t spacer;
|
||||
|
|
@ -977,20 +978,19 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector<TempoMap::BBTPoint>::const_iterator i;
|
||||
std::vector<Temporal::Point>::const_iterator i;
|
||||
Temporal::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
|
||||
|
||||
double floor_lower_beat = floor(std::max (0.0, _session->tempo_map().beat_at_sample (lower)));
|
||||
Beats floor_lower_beat = std::max (Beats(), _session->tempo_map().quarter_note_at (lower)).round_down_to_beat ();
|
||||
|
||||
if (floor_lower_beat < 0.0) {
|
||||
floor_lower_beat = 0.0;
|
||||
}
|
||||
|
||||
const samplecnt_t beat_before_lower_pos = _session->tempo_map().sample_at_beat (floor_lower_beat);
|
||||
const samplecnt_t beat_after_upper_pos = _session->tempo_map().sample_at_beat (floor (std::max (0.0, _session->tempo_map().beat_at_sample (upper))) + 1.0);
|
||||
const samplepos_t beat_before_lower_pos = _session->tempo_map().sample_at (floor_lower_beat, _session->sample_rate());
|
||||
const samplepos_t beat_after_upper_pos = _session->tempo_map().sample_at ((std::max (Beats(), _session->tempo_map().quarter_note_at (upper)).round_down_to_beat()) + Beats (1, 0), _session->sample_rate());
|
||||
|
||||
_session->bbt_time (beat_before_lower_pos, lower_beat);
|
||||
_session->bbt_time (beat_after_upper_pos, upper_beat);
|
||||
_session->bbt_time (timepos_t (beat_before_lower_pos), lower_beat);
|
||||
_session->bbt_time (timepos_t (beat_after_upper_pos), upper_beat);
|
||||
uint32_t beats = 0;
|
||||
|
||||
bbt_bar_helper_on = false;
|
||||
|
|
@ -1000,11 +1000,12 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||
bbt_ruler_scale = bbt_show_many;
|
||||
|
||||
const double ceil_upper_beat = floor (std::max (0.0, _session->tempo_map().beat_at_sample (upper))) + 1.0;
|
||||
|
||||
if (ceil_upper_beat == floor_lower_beat) {
|
||||
return;
|
||||
}
|
||||
|
||||
bbt_bars = _session->tempo_map().bbt_at_beat (ceil_upper_beat).bars - _session->tempo_map().bbt_at_beat (floor_lower_beat).bars;
|
||||
bbt_bars = _session->tempo_map().bbt_at (ceil_upper_beat).bars - _session->tempo_map().bbt_at (floor_lower_beat).bars;
|
||||
|
||||
double ruler_line_granularity = UIConfiguration::instance().get_ruler_granularity (); //in pixels
|
||||
ruler_line_granularity = _visible_canvas_width / (ruler_line_granularity*5); //fudge factor '5' probably related to (4+1 beats)/measure, I think
|
||||
|
|
@ -1074,13 +1075,13 @@ edit_last_mark_label (std::vector<ArdourCanvas::Ruler::Mark>& marks, const std::
|
|||
}
|
||||
|
||||
void
|
||||
Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble upper, gint /*maxchars*/)
|
||||
Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, gint /*maxchars*/)
|
||||
{
|
||||
if (_session == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<TempoMap::BBTPoint>::const_iterator i;
|
||||
Temporal::TempoMapPoints::const_iterator i;
|
||||
|
||||
char buf[64];
|
||||
gint n = 0;
|
||||
|
|
@ -1094,8 +1095,9 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
|
|||
bool i_am_accented = false;
|
||||
bool helper_active = false;
|
||||
ArdourCanvas::Ruler::Mark mark;
|
||||
const samplecnt_t sr (_session->sample_rate());
|
||||
|
||||
std::vector<TempoMap::BBTPoint> grid;
|
||||
Temporal::TempoMapPoints grid;
|
||||
|
||||
compute_current_bbt_points (grid, lower, upper);
|
||||
|
||||
|
|
@ -1241,7 +1243,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
|
|||
}
|
||||
}
|
||||
mark.label = buf;
|
||||
mark.position = (*i).sample;
|
||||
mark.position = (*i).sample(sr);
|
||||
marks.push_back (mark);
|
||||
++n;
|
||||
}
|
||||
|
|
@ -1300,12 +1302,12 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
|
|||
|
||||
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
|
||||
|
||||
if ((*i).sample < lower && (bbt_bar_helper_on)) {
|
||||
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
||||
if ((*i).sample (sr) < lower && (bbt_bar_helper_on)) {
|
||||
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bbt().bars, (*i).bbt().beats);
|
||||
edit_last_mark_label (marks, buf);
|
||||
} else {
|
||||
|
||||
if ((*i).is_bar()) {
|
||||
if ((*i).bbt().is_bar()) {
|
||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
||||
} else if (((*i).beat % 2 == 1)) {
|
||||
|
|
@ -1341,24 +1343,24 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
|
|||
|
||||
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
|
||||
|
||||
if ((*i).sample < lower && (bbt_bar_helper_on)) {
|
||||
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
|
||||
if ((*i).sample (sr) < lower && (bbt_bar_helper_on)) {
|
||||
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bbt().bars, (*i).bbt().beats);
|
||||
edit_last_mark_label (marks, buf);
|
||||
helper_active = true;
|
||||
} else {
|
||||
|
||||
if ((*i).is_bar()) {
|
||||
if ((*i).bbt().is_bar()) {
|
||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
|
||||
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bbt().bars);
|
||||
} else {
|
||||
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
||||
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
|
||||
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bbt().beats);
|
||||
}
|
||||
if (((*i).sample < bbt_position_of_helper) && helper_active) {
|
||||
if (((*i).sample(sr) < bbt_position_of_helper) && helper_active) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
mark.label = buf;
|
||||
mark.position = (*i).sample;
|
||||
mark.position = (*i).sample (sr);
|
||||
marks.push_back (mark);
|
||||
n++;
|
||||
}
|
||||
|
|
@ -1370,10 +1372,10 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
|
|||
t = 0;
|
||||
while (tick < Temporal::ticks_per_beat && (n < bbt_nmarks)) {
|
||||
|
||||
next_beat.beats = (*i).beat;
|
||||
next_beat.bars = (*i).bar;
|
||||
next_beat.beats = (*i).bbt().beats;
|
||||
next_beat.bars = (*i).bbt().bars;
|
||||
next_beat.ticks = tick;
|
||||
pos = _session->tempo_map().sample_at_bbt (next_beat);
|
||||
pos = _session->tempo_map().sample_at (next_beat, sr);
|
||||
|
||||
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
|
||||
i_am_accented = true;
|
||||
|
|
@ -1588,7 +1590,7 @@ Editor::set_samples_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
|
||||
Editor::metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t /*upper*/, gint /*maxchars*/)
|
||||
{
|
||||
samplepos_t pos;
|
||||
samplepos_t const ilower = (samplepos_t) floor (lower);
|
||||
|
|
@ -1765,7 +1767,7 @@ Editor::set_minsec_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble upper, gint /*maxchars*/)
|
||||
Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, gint /*maxchars*/)
|
||||
{
|
||||
samplepos_t pos;
|
||||
samplepos_t spacer;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ using namespace PBD;
|
|||
using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace Editing;
|
||||
using namespace Temporal;
|
||||
|
||||
void
|
||||
Editor::remove_metric_marks ()
|
||||
|
|
@ -84,33 +85,32 @@ Editor::remove_metric_marks ()
|
|||
}
|
||||
struct CurveComparator {
|
||||
bool operator() (TempoCurve const * a, TempoCurve const * b) {
|
||||
return a->tempo().sample() < b->tempo().sample();
|
||||
return a->tempo().sclock() < b->tempo().sclock();
|
||||
}
|
||||
};
|
||||
void
|
||||
Editor::draw_metric_marks (const Metrics& metrics)
|
||||
Editor::draw_metric_marks (TempoMap::Metrics& metrics)
|
||||
{
|
||||
char buf[64];
|
||||
TempoSection* prev_ts = 0;
|
||||
TempoPoint* prev_ts = 0;
|
||||
double max_tempo = 0.0;
|
||||
double min_tempo = DBL_MAX;
|
||||
const samplecnt_t sr (_session->sample_rate());
|
||||
|
||||
remove_metric_marks (); // also clears tempo curves
|
||||
|
||||
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
||||
const MeterSection *ms;
|
||||
TempoSection *ts;
|
||||
for (TempoMap::Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
||||
Temporal::MeterPoint *ms;
|
||||
Temporal::TempoPoint *ts;
|
||||
|
||||
if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
|
||||
snprintf (buf, sizeof(buf), "%g/%g", ms->divisions_per_bar(), ms->note_divisor ());
|
||||
if (ms->position_lock_style() == MusicTime) {
|
||||
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker music"), buf,
|
||||
*(const_cast<MeterSection*>(ms))));
|
||||
if ((ms = dynamic_cast<Temporal::MeterPoint*>(*i)) != 0) {
|
||||
snprintf (buf, sizeof(buf), "%d/%d", ms->divisions_per_bar(), ms->note_value ());
|
||||
if (ms->map().time_domain() == BeatTime) {
|
||||
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker music"), buf, *ms));
|
||||
} else {
|
||||
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker"), buf,
|
||||
*(const_cast<MeterSection*>(ms))));
|
||||
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker"), buf, *ms));
|
||||
}
|
||||
} else if ((ts = dynamic_cast<TempoSection*>(*i)) != 0) {
|
||||
} else if ((ts = dynamic_cast<Temporal::TempoPoint*>(*i)) != 0) {
|
||||
|
||||
max_tempo = max (max_tempo, ts->note_types_per_minute());
|
||||
max_tempo = max (max_tempo, ts->end_note_types_per_minute());
|
||||
|
|
@ -118,16 +118,14 @@ Editor::draw_metric_marks (const Metrics& metrics)
|
|||
min_tempo = min (min_tempo, ts->end_note_types_per_minute());
|
||||
uint32_t const tc_color = UIConfiguration::instance().color ("tempo curve");
|
||||
|
||||
tempo_curves.push_back (new TempoCurve (*this, *tempo_group, tc_color,
|
||||
*(const_cast<TempoSection*>(ts)), ts->sample(), false));
|
||||
tempo_curves.push_back (new TempoCurve (*this, *tempo_group, tc_color, *ts, ts->sample (sr), false));
|
||||
|
||||
const std::string tname (X_(""));
|
||||
if (ts->position_lock_style() == MusicTime) {
|
||||
metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker music"), tname,
|
||||
*(const_cast<TempoSection*>(ts))));
|
||||
if (ts->map().time_domain() == BeatTime) {
|
||||
metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker music"), tname, *ts));
|
||||
|
||||
} else {
|
||||
metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), tname,
|
||||
*(const_cast<TempoSection*>(ts))));
|
||||
metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), tname, *ts));
|
||||
}
|
||||
if (prev_ts && abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 1.0) {
|
||||
metric_marks.back()->set_points_color (UIConfiguration::instance().color ("tempo marker music"));
|
||||
|
|
@ -154,9 +152,9 @@ Editor::draw_metric_marks (const Metrics& metrics)
|
|||
(*x)->set_min_tempo (min_tempo);
|
||||
++tmp;
|
||||
if (tmp != tempo_curves.end()) {
|
||||
(*x)->set_position ((*x)->tempo().sample(), (*tmp)->tempo().sample());
|
||||
(*x)->set_position ((*x)->tempo().sample(sr), (*tmp)->tempo().sample(sr));
|
||||
} else {
|
||||
(*x)->set_position ((*x)->tempo().sample(), UINT32_MAX);
|
||||
(*x)->set_position ((*x)->tempo().sample(sr), UINT32_MAX);
|
||||
}
|
||||
|
||||
if (!(*x)->tempo().active()) {
|
||||
|
|
@ -177,9 +175,14 @@ Editor::draw_metric_marks (const Metrics& metrics)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::tempo_map_property_changed (const PropertyChange& /*ignored*/)
|
||||
{
|
||||
tempo_map_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::tempo_map_changed (const PropertyChange& /*ignored*/)
|
||||
Editor::tempo_map_changed ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
|
|
@ -204,22 +207,21 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
|
|||
|
||||
ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed);
|
||||
|
||||
TempoSection* prev_ts = 0;
|
||||
Temporal::TempoPoint* prev_ts = 0;
|
||||
double max_tempo = 0.0;
|
||||
double min_tempo = DBL_MAX;
|
||||
const samplecnt_t sr (_session->sample_rate());
|
||||
|
||||
#warning NUTEMPO needs new tempo map API
|
||||
#if 0
|
||||
for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) {
|
||||
TempoMarker* tempo_marker;
|
||||
MeterMarker* meter_marker;
|
||||
TempoSection *ts;
|
||||
const MeterSection *ms;
|
||||
Temporal::TempoPoint *ts;
|
||||
Temporal::MeterPoint *ms;
|
||||
|
||||
if ((tempo_marker = dynamic_cast<TempoMarker*> (*x)) != 0) {
|
||||
if ((ts = &tempo_marker->tempo()) != 0) {
|
||||
|
||||
tempo_marker->set_position (ts->sample ());
|
||||
tempo_marker->set_position (timepos_t (ts->sample (sr)));
|
||||
|
||||
if (prev_ts && abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 1.0) {
|
||||
tempo_marker->set_points_color (UIConfiguration::instance().color ("tempo marker music"));
|
||||
|
|
@ -237,7 +239,7 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
|
|||
}
|
||||
if ((meter_marker = dynamic_cast<MeterMarker*> (*x)) != 0) {
|
||||
if ((ms = &meter_marker->meter()) != 0) {
|
||||
meter_marker->set_position (ms->sample ());
|
||||
meter_marker->set_position (timepos_t (ms->sample (sr)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -258,9 +260,9 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
|
|||
(*x)->set_min_tempo (min_tempo);
|
||||
++tmp;
|
||||
if (tmp != tempo_curves.end()) {
|
||||
(*x)->set_position ((*x)->tempo().sample(), (*tmp)->tempo().sample());
|
||||
(*x)->set_position ((*x)->tempo().sample(sr), (*tmp)->tempo().sample(sr));
|
||||
} else {
|
||||
(*x)->set_position ((*x)->tempo().sample(), UINT32_MAX);
|
||||
(*x)->set_position ((*x)->tempo().sample(sr), UINT32_MAX);
|
||||
}
|
||||
|
||||
if (!(*x)->tempo().active()) {
|
||||
|
|
@ -284,7 +286,6 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
|
|||
update_tempo_based_rulers ();
|
||||
|
||||
maybe_draw_grid_lines ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -305,7 +306,7 @@ Editor::redisplay_grid (bool immediate_redraw)
|
|||
}
|
||||
}
|
||||
void
|
||||
Editor::tempo_curve_selected (TempoSection* ts, bool yn)
|
||||
Editor::tempo_curve_selected (Temporal::TempoPoint* ts, bool yn)
|
||||
{
|
||||
if (ts == 0) {
|
||||
return;
|
||||
|
|
@ -325,7 +326,7 @@ Editor::tempo_curve_selected (TempoSection* ts, bool yn)
|
|||
|
||||
/* computes a grid starting a beat before and ending a beat after leftmost and rightmost respectively */
|
||||
void
|
||||
Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, samplepos_t leftmost, samplepos_t rightmost)
|
||||
Editor::compute_current_bbt_points (Temporal::TempoMapPoints& grid, samplepos_t leftmost, samplepos_t rightmost)
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
|
|
@ -333,7 +334,9 @@ Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, sampl
|
|||
|
||||
/* prevent negative values of leftmost from creeping into tempomap
|
||||
*/
|
||||
const double lower_beat = floor (max (0.0, _session->tempo_map().beat_at_sample (leftmost))) - 1.0;
|
||||
const Beats lower_beat = max (Beats (), _session->tempo_map().quarter_note_at (leftmost)).round_down_to_beat() - Beats (1, 0);
|
||||
const samplecnt_t sr (_session->sample_rate());
|
||||
|
||||
switch (bbt_ruler_scale) {
|
||||
|
||||
case bbt_show_quarters:
|
||||
|
|
@ -342,28 +345,28 @@ Editor::compute_current_bbt_points (std::vector<TempoMap::BBTPoint>& grid, sampl
|
|||
case bbt_show_thirtyseconds:
|
||||
case bbt_show_sixtyfourths:
|
||||
case bbt_show_onetwentyeighths:
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0);
|
||||
break;
|
||||
|
||||
case bbt_show_1:
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 1);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 1);
|
||||
break;
|
||||
|
||||
case bbt_show_4:
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 4);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 4);
|
||||
break;
|
||||
|
||||
case bbt_show_16:
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 16);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 16);
|
||||
break;
|
||||
|
||||
case bbt_show_64:
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 64);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 64);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* bbt_show_many */
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().sample_at_beat (lower_beat), (samplepos_t) 0), rightmost, 128);
|
||||
_session->tempo_map().get_grid (grid, max (_session->tempo_map().superclock_at (lower_beat), (superclock_t) 0), rightmost, 128);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -498,7 +501,7 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::edit_meter_section (MeterSection* section)
|
||||
Editor::edit_meter_section (Temporal::MeterPoint* section)
|
||||
{
|
||||
MeterDialog meter_dialog (_session->tempo_map(), *section, _("done"));
|
||||
|
||||
|
|
@ -517,13 +520,11 @@ Editor::edit_meter_section (MeterSection* section)
|
|||
|
||||
Temporal::BBT_Time when;
|
||||
meter_dialog.get_bbt_time (when);
|
||||
const samplepos_t sample = _session->tempo_map().sample_at_bbt (when);
|
||||
const PositionLockStyle pls = (meter_dialog.get_lock_style() == AudioTime) ? AudioTime : MusicTime;
|
||||
|
||||
begin_reversible_command (_("replace meter mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
_session->tempo_map().replace_meter (*section, meter, when, sample, pls);
|
||||
_session->tempo_map().set_meter (meter, when);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
|
|
@ -531,7 +532,7 @@ Editor::edit_meter_section (MeterSection* section)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::edit_tempo_section (TempoSection* section)
|
||||
Editor::edit_tempo_section (TempoPoint* section)
|
||||
{
|
||||
TempoDialog tempo_dialog (_session->tempo_map(), *section, _("done"));
|
||||
|
||||
|
|
@ -554,13 +555,7 @@ Editor::edit_tempo_section (TempoSection* section)
|
|||
begin_reversible_command (_("replace tempo mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
|
||||
if (tempo_dialog.get_lock_style() == AudioTime) {
|
||||
samplepos_t const f = _session->tempo_map().predict_tempo_position (section, when).second;
|
||||
_session->tempo_map().replace_tempo (*section, tempo, 0.0, f, AudioTime);
|
||||
} else {
|
||||
double const p = _session->tempo_map().predict_tempo_position (section, when).first;
|
||||
_session->tempo_map().replace_tempo (*section, tempo, p, 0, MusicTime);
|
||||
}
|
||||
_session->tempo_map().set_tempo (tempo, when);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
|
|
@ -580,11 +575,11 @@ Editor::edit_meter_marker (MeterMarker& mm)
|
|||
}
|
||||
|
||||
gint
|
||||
Editor::real_remove_tempo_marker (TempoSection *section)
|
||||
Editor::real_remove_tempo_marker (TempoPoint *section)
|
||||
{
|
||||
begin_reversible_command (_("remove tempo mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
_session->tempo_map().remove_tempo (*section, true);
|
||||
_session->tempo_map().remove_tempo (*section);
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
|
@ -608,17 +603,17 @@ Editor::remove_meter_marker (ArdourCanvas::Item* item)
|
|||
abort(); /*NOTREACHED*/
|
||||
}
|
||||
|
||||
if (!meter_marker->meter().initial()) {
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::real_remove_meter_marker), &meter_marker->meter()));
|
||||
if (!meter_marker->meter().map().is_initial(meter_marker->meter())) {
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::real_remove_meter_marker), &meter_marker->meter()));
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
Editor::real_remove_meter_marker (MeterSection *section)
|
||||
Editor::real_remove_meter_marker (Temporal::MeterPoint *section)
|
||||
{
|
||||
begin_reversible_command (_("remove tempo mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
_session->tempo_map().remove_meter (*section, true);
|
||||
_session->tempo_map().remove_meter (*section);
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ ExportTimespanSelector::bbt_str (samplepos_t samples) const
|
|||
|
||||
std::ostringstream oss;
|
||||
Temporal::BBT_Time time;
|
||||
_session->bbt_time (samples, time);
|
||||
_session->bbt_time (timepos_t (samples), time);
|
||||
|
||||
time.print_padded (oss);
|
||||
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ ArdourMarker::set_right_label_limit (double p)
|
|||
/***********************************************************************/
|
||||
|
||||
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
|
||||
ARDOUR::TempoSection& temp)
|
||||
Temporal::TempoPoint& temp)
|
||||
#warning NUTEMPO needs new tempo map
|
||||
// : ArdourMarker (editor, parent, rgba, text, Tempo, temp.sample(), false),
|
||||
: ArdourMarker (editor, parent, rgba, text, Tempo, timepos_t (), false),
|
||||
|
|
@ -668,7 +668,7 @@ TempoMarker::update_height_mark (const double ratio)
|
|||
/***********************************************************************/
|
||||
|
||||
MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
|
||||
ARDOUR::MeterSection& m)
|
||||
Temporal::MeterPoint& m)
|
||||
|
||||
#warning NUTEMPO needs new tempo map
|
||||
// : ArdourMarker (editor, parent, rgba, text, Meter, m.sample(), false),
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
#include "canvas/fwd.h"
|
||||
#include "canvas/types.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class TempoSection;
|
||||
class MeterSection;
|
||||
namespace Temporal {
|
||||
class TempoPoint;
|
||||
class MeterPoint;
|
||||
}
|
||||
|
||||
class PublicEditor;
|
||||
|
|
@ -157,26 +157,26 @@ private:
|
|||
class TempoMarker : public ArdourMarker
|
||||
{
|
||||
public:
|
||||
TempoMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&);
|
||||
TempoMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Temporal::TempoPoint&);
|
||||
~TempoMarker ();
|
||||
|
||||
ARDOUR::TempoSection& tempo() const { return _tempo; }
|
||||
Temporal::TempoPoint& tempo() const { return _tempo; }
|
||||
|
||||
void update_height_mark (const double ratio);
|
||||
private:
|
||||
ARDOUR::TempoSection& _tempo;
|
||||
Temporal::TempoPoint& _tempo;
|
||||
};
|
||||
|
||||
class MeterMarker : public ArdourMarker
|
||||
{
|
||||
public:
|
||||
MeterMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&);
|
||||
MeterMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Temporal::MeterPoint&);
|
||||
~MeterMarker ();
|
||||
|
||||
ARDOUR::MeterSection& meter() const { return _meter; }
|
||||
Temporal::MeterPoint& meter() const { return _meter; }
|
||||
|
||||
private:
|
||||
ARDOUR::MeterSection& _meter;
|
||||
Temporal::MeterPoint& _meter;
|
||||
};
|
||||
|
||||
#endif /* __gtk_ardour_marker_h__ */
|
||||
|
|
|
|||
|
|
@ -273,9 +273,9 @@ MiniTimeline::format_time (samplepos_t when)
|
|||
case AudioClock::BBT:
|
||||
{
|
||||
char buf[64];
|
||||
Temporal::BBT_Time BBT = _session->tempo_map().bbt_at_sample (when);
|
||||
Temporal::BBT_Time BBT = _session->tempo_map().bbt_at (when);
|
||||
snprintf (buf, sizeof (buf), "%03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32,
|
||||
BBT.bars, BBT.beats, BBT.ticks);
|
||||
BBT.bars, BBT.beats, BBT.ticks);
|
||||
_layout->set_text (buf);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -518,8 +518,8 @@ public:
|
|||
|
||||
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 edit_tempo_section (ARDOUR::TempoSection*) = 0;
|
||||
virtual void edit_meter_section (ARDOUR::MeterSection*) = 0;
|
||||
virtual void edit_tempo_section (Temporal::TempoPoint*) = 0;
|
||||
virtual void edit_meter_section (Temporal::MeterPoint*) = 0;
|
||||
|
||||
virtual bool should_ripple () const = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
|
|||
|
||||
_fade_length->set_session (s);
|
||||
_fade_length->set_mode (AudioClock::Samples);
|
||||
_fade_length->set_is_duration (true);
|
||||
_fade_length->set_is_duration (true, timepos_t());
|
||||
_fade_length->set_duration (timecnt_t (_fade_length_value), true);
|
||||
|
||||
hbox->pack_start (*table);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
*/
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
#include "ardour/tempo.h"
|
||||
|
||||
#include "temporal/tempo.h"
|
||||
|
||||
#include "canvas/rectangle.h"
|
||||
#include "canvas/container.h"
|
||||
|
|
@ -37,6 +38,8 @@
|
|||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace Temporal;
|
||||
|
||||
PBD::Signal1<void,TempoCurve*> TempoCurve::CatchDeletion;
|
||||
|
||||
static double curve_height = 13.0;
|
||||
|
|
@ -46,7 +49,7 @@ void TempoCurve::setup_sizes(const double timebar_height)
|
|||
curve_height = floor (timebar_height) - 2.5;
|
||||
}
|
||||
/* ignores Tempo note type - only note_types_per_minute is potentially curved */
|
||||
TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, ARDOUR::TempoSection& temp, samplepos_t sample, bool handle_events)
|
||||
TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, TempoPoint& temp, samplepos_t sample, bool handle_events)
|
||||
|
||||
: editor (ed)
|
||||
, _parent (&parent)
|
||||
|
|
@ -82,7 +85,7 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint
|
|||
_start_text->set_color (RGBA_TO_UINT (255,255,255,255));
|
||||
_end_text->set_color (RGBA_TO_UINT (255,255,255,255));
|
||||
char buf[10];
|
||||
snprintf (buf, sizeof (buf), "%.3f/%.0f", _tempo.note_types_per_minute(), _tempo.note_type());
|
||||
snprintf (buf, sizeof (buf), "%.3f/%d", _tempo.note_types_per_minute(), _tempo.note_type());
|
||||
_start_text->set (buf);
|
||||
snprintf (buf, sizeof (buf), "%.3f", _tempo.end_note_types_per_minute());
|
||||
_end_text->set (buf);
|
||||
|
|
@ -152,7 +155,7 @@ TempoCurve::set_position (samplepos_t sample, samplepos_t end_sample)
|
|||
points->push_back (ArdourCanvas::Duple (0.0, y_pos));
|
||||
points->push_back (ArdourCanvas::Duple (1.0, y_pos));
|
||||
|
||||
} else if (_tempo.type() == ARDOUR::TempoSection::Constant || _tempo.c() == 0.0) {
|
||||
} else if (!_tempo.ramped()) {
|
||||
const double tempo_at = _tempo.note_types_per_minute();
|
||||
const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height);
|
||||
|
||||
|
|
@ -164,7 +167,7 @@ TempoCurve::set_position (samplepos_t sample, samplepos_t end_sample)
|
|||
samplepos_t current_sample = sample;
|
||||
|
||||
while (current_sample < end_sample) {
|
||||
const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_sample (current_sample)).note_types_per_minute();
|
||||
const double tempo_at = _tempo.note_types_per_minute_at_DOUBLE (timepos_t (current_sample));
|
||||
const double y_pos = std::max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
|
||||
|
||||
points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_sample - sample), std::min (y_pos, curve_height)));
|
||||
|
|
@ -172,7 +175,7 @@ TempoCurve::set_position (samplepos_t sample, samplepos_t end_sample)
|
|||
current_sample += sample_step;
|
||||
}
|
||||
|
||||
const double tempo_at = _tempo.tempo_at_minute (_tempo.minute_at_sample (end_sample)).note_types_per_minute();
|
||||
const double tempo_at = _tempo.note_types_per_minute();
|
||||
const double y_pos = std::max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
|
||||
|
||||
points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (end_sample - sample), std::min (y_pos, curve_height)));
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@
|
|||
#include "canvas/framed_curve.h"
|
||||
#include "canvas/text.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class TempoSection;
|
||||
namespace Temporal {
|
||||
class TempoPoint;
|
||||
}
|
||||
class PublicEditor;
|
||||
|
||||
class TempoCurve : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
TempoCurve (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, ARDOUR::TempoSection& temp, samplepos_t sample, bool handle_events);
|
||||
TempoCurve (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, Temporal::TempoPoint& temp, samplepos_t sample, bool handle_events);
|
||||
~TempoCurve ();
|
||||
|
||||
static PBD::Signal1<void,TempoCurve*> CatchDeletion;
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
void hide ();
|
||||
void show ();
|
||||
|
||||
ARDOUR::TempoSection& tempo () const { return _tempo; }
|
||||
Temporal::TempoPoint& tempo () const { return _tempo; }
|
||||
|
||||
void set_max_tempo (const double& max) { _max_tempo = max; }
|
||||
void set_min_tempo (const double& min) { _min_tempo = min; }
|
||||
|
|
@ -91,7 +91,7 @@ private:
|
|||
double _min_tempo;
|
||||
double _max_tempo;
|
||||
|
||||
ARDOUR::TempoSection& _tempo;
|
||||
Temporal::TempoPoint& _tempo;
|
||||
ArdourCanvas::Text* _start_text;
|
||||
ArdourCanvas::Text* _end_text;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "pbd/error.h"
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
|
||||
#include "tempo_dialog.h"
|
||||
|
|
@ -136,9 +138,9 @@ TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, d
|
|||
|
||||
strings.clear();
|
||||
|
||||
tempo_types.insert (make_pair (_("ramped"), TempoSection::Ramp));
|
||||
tempo_types.insert (make_pair (_("ramped"), Tempo::Ramped));
|
||||
strings.push_back (_("ramped"));
|
||||
tempo_types.insert (make_pair (_("constant"), TempoSection::Constant));
|
||||
tempo_types.insert (make_pair (_("constant"), Tempo::Constant));
|
||||
strings.push_back (_("constant"));
|
||||
set_popdown_strings (tempo_type, strings);
|
||||
TempoTypes::iterator tt;
|
||||
|
|
@ -154,7 +156,7 @@ TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, d
|
|||
|
||||
strings.clear();
|
||||
|
||||
lock_styles.insert (make_pair (_("music"), MusicTime));
|
||||
lock_styles.insert (make_pair (_("music"), BeatTime));
|
||||
strings.push_back (_("music"));
|
||||
lock_styles.insert (make_pair (_("audio"), AudioTime));
|
||||
strings.push_back (_("audio"));
|
||||
|
|
@ -316,13 +318,10 @@ TempoDialog::bpm_button_release (GdkEventButton*)
|
|||
bool
|
||||
TempoDialog::entry_key_release (GdkEventKey*)
|
||||
{
|
||||
Temporal::BBT_Time bbt;
|
||||
get_bbt_time (bbt);
|
||||
|
||||
if (_section && is_user_input_valid()) {
|
||||
set_response_sensitive (RESPONSE_ACCEPT, _map->can_solve_bbt (_section, bbt));
|
||||
if (is_user_input_valid()) {
|
||||
set_response_sensitive (RESPONSE_ACCEPT, true);
|
||||
} else {
|
||||
set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
|
||||
set_response_sensitive (RESPONSE_ACCEPT, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -337,7 +336,7 @@ TempoDialog::get_bpm ()
|
|||
double
|
||||
TempoDialog::get_end_bpm ()
|
||||
{
|
||||
if (get_tempo_type() == TempoSection::Constant) {
|
||||
if (get_tempo_type() == Tempo::Constant) {
|
||||
return bpm_spinner.get_value ();
|
||||
}
|
||||
|
||||
|
|
@ -373,27 +372,27 @@ TempoDialog::get_note_type ()
|
|||
return x->second;
|
||||
}
|
||||
|
||||
TempoSection::Type
|
||||
Tempo::Type
|
||||
TempoDialog::get_tempo_type ()
|
||||
{
|
||||
TempoTypes::iterator x = tempo_types.find (tempo_type.get_active_text());
|
||||
|
||||
if (x == tempo_types.end()) {
|
||||
error << string_compose(_("incomprehensible tempo type (%1)"), tempo_type.get_active_text()) << endmsg;
|
||||
return TempoSection::Constant;
|
||||
return Tempo::Constant;
|
||||
}
|
||||
|
||||
return x->second;
|
||||
}
|
||||
|
||||
PositionLockStyle
|
||||
TimeDomain
|
||||
TempoDialog::get_lock_style ()
|
||||
{
|
||||
LockStyles::iterator x = lock_styles.find (lock_style.get_active_text());
|
||||
|
||||
if (x == lock_styles.end()) {
|
||||
error << string_compose(_("incomprehensible lock style (%1)"), lock_style.get_active_text()) << endmsg;
|
||||
return MusicTime;
|
||||
return BeatTime;
|
||||
}
|
||||
|
||||
return x->second;
|
||||
|
|
@ -408,7 +407,7 @@ TempoDialog::pulse_change ()
|
|||
void
|
||||
TempoDialog::tempo_type_change ()
|
||||
{
|
||||
if (get_tempo_type() == TempoSection::Constant) {
|
||||
if (get_tempo_type() == Tempo::Constant) {
|
||||
end_bpm_spinner.hide ();
|
||||
_end_bpm_label.hide();
|
||||
} else {
|
||||
|
|
@ -502,19 +501,14 @@ MeterDialog::MeterDialog (TempoMap& map, samplepos_t sample, const string&)
|
|||
#endif
|
||||
}
|
||||
|
||||
MeterDialog::MeterDialog (TempoMap& map, MeterSection& section, const string&)
|
||||
MeterDialog::MeterDialog (TempoMap& map, Temporal::MeterPoint& section, const string&)
|
||||
: ArdourDialog (_("Edit Meter"))
|
||||
{
|
||||
#warning NUTEMPO needs new map API
|
||||
#if 0
|
||||
Temporal::BBT_Time when (map.bbt_at_sample (section.sample()));
|
||||
|
||||
init (when, section.divisions_per_bar(), section.note_divisor(), section.initial(), section.position_lock_style());
|
||||
#endif
|
||||
init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), section.map().time_domain());
|
||||
}
|
||||
|
||||
void
|
||||
MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, bool initial, PositionLockStyle style)
|
||||
MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, bool initial, TimeDomain style)
|
||||
{
|
||||
char buf[64];
|
||||
vector<string> strings;
|
||||
|
|
@ -559,7 +553,7 @@ MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, b
|
|||
|
||||
strings.clear();
|
||||
|
||||
lock_styles.insert (make_pair (_("music"), MusicTime));
|
||||
lock_styles.insert (make_pair (_("music"), BeatTime));
|
||||
strings.push_back (_("music"));
|
||||
lock_styles.insert (make_pair (_("audio"), AudioTime));
|
||||
strings.push_back (_("audio"));
|
||||
|
|
@ -722,14 +716,14 @@ MeterDialog::get_note_type ()
|
|||
return x->second;
|
||||
}
|
||||
|
||||
PositionLockStyle
|
||||
TimeDomain
|
||||
MeterDialog::get_lock_style ()
|
||||
{
|
||||
LockStyles::iterator x = lock_styles.find (lock_style.get_active_text());
|
||||
|
||||
if (x == lock_styles.end()) {
|
||||
error << string_compose(_("incomprehensible meter lock style (%1)"), lock_style.get_active_text()) << endmsg;
|
||||
return MusicTime;
|
||||
return BeatTime;
|
||||
}
|
||||
|
||||
return x->second;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace Temporal;
|
||||
|
||||
VerboseCursor::VerboseCursor (Editor* editor)
|
||||
: _editor (editor)
|
||||
|
|
@ -112,7 +113,7 @@ VerboseCursor::set_time (samplepos_t sample)
|
|||
|
||||
switch (m) {
|
||||
case AudioClock::BBT:
|
||||
_editor->_session->bbt_time (sample, bbt);
|
||||
_editor->_session->bbt_time (timepos_t (sample), bbt);
|
||||
snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
|
||||
break;
|
||||
|
||||
|
|
@ -144,7 +145,7 @@ VerboseCursor::set_duration (samplepos_t start, samplepos_t end)
|
|||
Timecode::Time timecode;
|
||||
Temporal::BBT_Time sbbt;
|
||||
Temporal::BBT_Time ebbt;
|
||||
Meter meter_at_start (_editor->_session->tempo_map().meter_at_sample (start));
|
||||
Meter& meter_at_start (_editor->_session->tempo_map().metric_at (start).meter());
|
||||
|
||||
if (_editor->_session == 0) {
|
||||
return;
|
||||
|
|
@ -155,8 +156,8 @@ VerboseCursor::set_duration (samplepos_t start, samplepos_t end)
|
|||
switch (m) {
|
||||
case AudioClock::BBT:
|
||||
{
|
||||
_editor->_session->bbt_time (start, sbbt);
|
||||
_editor->_session->bbt_time (end, ebbt);
|
||||
_editor->_session->bbt_time (timepos_t (start), sbbt);
|
||||
_editor->_session->bbt_time (timepos_t (end), ebbt);
|
||||
|
||||
/* subtract */
|
||||
/* XXX this computation won't work well if the
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
/* lower and upper and sample positions, which are also canvas coordinates
|
||||
*/
|
||||
|
||||
virtual void get_marks (std::vector<Mark>&, double lower, double upper, int maxchars) const = 0;
|
||||
virtual void get_marks (std::vector<Mark>&, int64_t lower, int64_t upper, int maxchars) const = 0;
|
||||
};
|
||||
|
||||
Ruler (Canvas*, const Metric& m);
|
||||
|
|
@ -65,7 +65,7 @@ public:
|
|||
delete _font_description;
|
||||
}
|
||||
|
||||
void set_range (double lower, double upper);
|
||||
void set_range (int64_t lower, int64_t upper);
|
||||
void set_font_description (Pango::FontDescription);
|
||||
void set_second_font_description (Pango::FontDescription);
|
||||
void set_metric (const Metric&);
|
||||
|
|
@ -77,10 +77,10 @@ public:
|
|||
private:
|
||||
const Metric* _metric;
|
||||
|
||||
/* lower and upper and sample positions, which are also canvas coordinates */
|
||||
/* lower and upper and bounds for ruler */
|
||||
|
||||
Coord _lower;
|
||||
Coord _upper;
|
||||
int64_t _lower;
|
||||
int64_t _upper;
|
||||
double _divide_height;
|
||||
Gtkmm2ext::Color _divider_color_top;
|
||||
Gtkmm2ext::Color _divider_color_bottom;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ Ruler::Ruler (Item* parent, const Metric& m, Rect const& r)
|
|||
}
|
||||
|
||||
void
|
||||
Ruler::set_range (double l, double u)
|
||||
Ruler::set_range (int64_t l, int64_t u)
|
||||
{
|
||||
begin_visual_change ();
|
||||
_lower = l;
|
||||
|
|
|
|||
|
|
@ -82,10 +82,8 @@ class LIBTEMPORAL_API Point {
|
|||
superclock_t sclock() const { return _sclock; }
|
||||
Beats const & beats() const { return _quarters; }
|
||||
BBT_Time const & bbt() const { return _bbt; }
|
||||
samplepos_t sample(samplecnt_t sr) const { return superclock_to_samples (sclock(), sr); }
|
||||
|
||||
#if 0
|
||||
samplepos_t sample() const;
|
||||
#endif
|
||||
timepos_t time() const;
|
||||
|
||||
struct sclock_comparator {
|
||||
|
|
@ -383,11 +381,15 @@ class LIBTEMPORAL_API TempoPoint : public Tempo, public Point
|
|||
Beats quarters_at (superclock_t sc) const;
|
||||
|
||||
superclock_t superclocks_per_note_type_at (timepos_t const &) const;
|
||||
#ifdef ALLOW_DOUBLE_TEMPO_MATH
|
||||
double note_types_per_minute_at (timepos_t const & pos) const {
|
||||
return Tempo::sc_to_double_npm (superclocks_per_note_type_at (pos));
|
||||
|
||||
/* This method should be used only for display purposes, and even
|
||||
* then, only when absolutely necessary. It returns a double
|
||||
* representation of the tempo, and we do not want to be using such
|
||||
* representations ever, if we could.
|
||||
*/
|
||||
double note_types_per_minute_at_DOUBLE (timepos_t const & pos) const {
|
||||
return (superclock_ticks_per_second * 60.0) / superclocks_per_note_type_at (pos);
|
||||
}
|
||||
#endif
|
||||
|
||||
XMLNode& get_state () const;
|
||||
int set_state (XMLNode const&, int version);
|
||||
|
|
@ -688,15 +690,14 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
|
|||
Beats quarter_note_at (BBT_Time const &) const;
|
||||
Beats quarter_note_at (timepos_t const &) const;
|
||||
|
||||
#if 0
|
||||
samplepos_t sample_at (Beats const &) const;
|
||||
samplepos_t sample_at (BBT_Time const &) const;
|
||||
samplepos_t sample_at (timepos_t const &) const;
|
||||
#endif
|
||||
superclock_t superclock_at (Beats const &) const;
|
||||
superclock_t superclock_at (BBT_Time const &) const;
|
||||
superclock_t superclock_at (timepos_t const &) const;
|
||||
|
||||
samplepos_t sample_at (Beats const & b, samplecnt_t sr) const { return superclock_to_samples (superclock_at (b), sr); }
|
||||
samplepos_t sample_at (BBT_Time const & b, samplecnt_t sr) const { return superclock_to_samples (superclock_at (b), sr); }
|
||||
samplepos_t sample_at (timepos_t const & t, samplecnt_t sr) const { return superclock_to_samples (superclock_at (t), sr); }
|
||||
|
||||
#if 0
|
||||
int update_music_times (int gen, samplepos_t, Beats & b, BBT_Time & bbt, bool force);
|
||||
int update_samples_and_beat_times (int gen, BBT_Time const & bbt, samplepos_t & pos, Beats & b, bool force);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue