mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-10 15:36:24 +01:00
Replace direct use of Session::transport_sample() in surfaces
This commit is contained in:
parent
e7a769d608
commit
3318f4e54c
17 changed files with 33 additions and 46 deletions
|
|
@ -240,7 +240,7 @@ CC121::set_controllable (boost::shared_ptr<AutomationControl> ac, float delta)
|
|||
if (!ac || delta == 0) {
|
||||
return;
|
||||
}
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
ac->set_interface ((ac->internal_to_interface (ac->get_value(), true) + delta), true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ ContourDesignControlProtocol::handle_button_release (unsigned short btn)
|
|||
void
|
||||
ContourDesignControlProtocol::prev_marker_keep_rolling ()
|
||||
{
|
||||
timepos_t pos = _session->locations()->first_mark_before (timepos_t (_session->transport_sample()));
|
||||
timepos_t pos = _session->locations()->first_mark_before (timepos_t (transport_sample()));
|
||||
|
||||
if (pos.positive() || pos.zero()) {
|
||||
locate (pos.samples());
|
||||
|
|
@ -571,7 +571,7 @@ ContourDesignControlProtocol::prev_marker_keep_rolling ()
|
|||
void
|
||||
ContourDesignControlProtocol::next_marker_keep_rolling ()
|
||||
{
|
||||
timepos_t pos = _session->locations()->first_mark_after (timepos_t (_session->transport_sample()));
|
||||
timepos_t pos = _session->locations()->first_mark_after (timepos_t (transport_sample()));
|
||||
|
||||
if (pos.positive() || pos.zero()) {
|
||||
locate (pos.samples());
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ BasicUI::set_record_enable (bool yn)
|
|||
}
|
||||
|
||||
samplepos_t
|
||||
BasicUI::transport_sample ()
|
||||
BasicUI::transport_sample () const
|
||||
{
|
||||
return _session->transport_sample();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class LIBCONTROLCP_API BasicUI {
|
|||
void jump_by_bars (int bars, LocateTransportDisposition ltd = RollIfAppropriate);
|
||||
void jump_by_beats (int beats, LocateTransportDisposition ltd = RollIfAppropriate);
|
||||
|
||||
samplepos_t transport_sample ();
|
||||
samplepos_t transport_sample () const;
|
||||
void locate (samplepos_t sample, LocateTransportDisposition ltd = RollIfAppropriate);
|
||||
void locate (samplepos_t sample, bool);
|
||||
bool locating ();
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ FaderPort8::button_solo_clear ()
|
|||
if (!ac) {
|
||||
continue;
|
||||
}
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
cl->push_back (ac);
|
||||
}
|
||||
if (!cl->empty()) {
|
||||
|
|
@ -370,7 +370,7 @@ FaderPort8::button_mute_clear ()
|
|||
continue;
|
||||
}
|
||||
cl->push_back (ac);
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
}
|
||||
if (!cl->empty()) {
|
||||
_session->set_controls (cl, 1.0, PBD::Controllable::NoGroup);
|
||||
|
|
@ -410,7 +410,7 @@ FaderPort8::handle_encoder_pan (int steps)
|
|||
ac = s->pan_azimuth_control ();
|
||||
}
|
||||
if (ac) {
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
if (steps == 0) {
|
||||
ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
|
||||
} else {
|
||||
|
|
@ -434,7 +434,7 @@ FaderPort8::handle_encoder_link (int steps)
|
|||
}
|
||||
|
||||
double v = ac->internal_to_interface (ac->get_value(), true);
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
|
||||
if (steps == 0) {
|
||||
ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
|
||||
|
|
@ -554,7 +554,7 @@ FaderPort8::button_encoder ()
|
|||
ac = _session->master_out()->gain_control ();
|
||||
}
|
||||
if (ac) {
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
ac->set_value (ac->normal(), PBD::Controllable::NoGroup);
|
||||
}
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ FaderPort8::encoder_navigate (bool neg, int steps)
|
|||
if (ac) {
|
||||
double v = ac->internal_to_interface (ac->get_value());
|
||||
v = std::max (0.0, std::min (1.0, v + steps * (neg ? -.01 : .01)));
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
ac->set_value (ac->interface_to_internal(v), PBD::Controllable::NoGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ FaderPort8::periodic ()
|
|||
_timecode = Timecode::timecode_format_time(TC);
|
||||
|
||||
char buf[16];
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (timepos_t (_session->transport_sample ()));
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (timepos_t (transport_sample ()));
|
||||
snprintf (buf, sizeof (buf),
|
||||
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
|
||||
BBT.bars % 100, BBT.beats %100,
|
||||
|
|
@ -1718,7 +1718,7 @@ FaderPort8::select_strip (boost::weak_ptr<Stripable> ws)
|
|||
if (s == first_selected_stripable () && !shift_mod ()) {
|
||||
if (_ctrls.fader_mode () == ModeTrack) {
|
||||
boost::shared_ptr<AutomationControl> ac = s->gain_control ();
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (transport_sample()));
|
||||
ac->set_value (ac->normal (), PBD::Controllable::UseGroup);
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ private:
|
|||
std::string _musical_time;
|
||||
std::string const& timecode () const { return _timecode; }
|
||||
std::string const& musical_time () const { return _musical_time; }
|
||||
samplepos_t transport_sample () const { return ARDOUR::ControlProtocol::transport_sample (); }
|
||||
|
||||
int _timer_divider;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include "ardour/types.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#ifdef FADERPORT16
|
||||
|
|
@ -57,6 +58,7 @@ public:
|
|||
virtual size_t tx_midi (std::vector<uint8_t> const&) const = 0;
|
||||
virtual std::string const& timecode () const = 0;
|
||||
virtual std::string const& musical_time () const = 0;
|
||||
virtual samplepos_t transport_sample () const = 0;
|
||||
virtual bool shift_mod () const = 0;
|
||||
virtual bool show_meters () const = 0;
|
||||
virtual bool show_panner () const = 0;
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ FP8Strip::midi_touch (bool t)
|
|||
if (!ac) {
|
||||
return false;
|
||||
}
|
||||
timepos_t now (ac->session().transport_sample());
|
||||
timepos_t now (_base.transport_sample());
|
||||
if (t) {
|
||||
ac->start_touch (now);
|
||||
} else {
|
||||
|
|
@ -376,7 +376,7 @@ FP8Strip::midi_fader (float val)
|
|||
if (!ac) {
|
||||
return false;
|
||||
}
|
||||
ac->start_touch (timepos_t (ac->session().transport_sample()));
|
||||
ac->start_touch (timepos_t (_base.transport_sample()));
|
||||
ac->set_value (ac->interface_to_internal (val), group_mode ());
|
||||
return true;
|
||||
}
|
||||
|
|
@ -401,7 +401,7 @@ FP8Strip::set_mute (bool on)
|
|||
if (!_mute_ctrl) {
|
||||
return;
|
||||
}
|
||||
_mute_ctrl->start_touch (timepos_t (_mute_ctrl->session().transport_sample()));
|
||||
_mute_ctrl->start_touch (timepos_t (_base.transport_sample()));
|
||||
_mute_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ FP8Strip::set_solo (bool on)
|
|||
if (!_solo_ctrl) {
|
||||
return;
|
||||
}
|
||||
_solo_ctrl->start_touch (timepos_t (_solo_ctrl->session().transport_sample()));
|
||||
_solo_ctrl->start_touch (timepos_t (_base.transport_sample()));
|
||||
PBD::Controllable::GroupControlDisposition gcd = group_mode ();
|
||||
Session& s = const_cast<Session&> (_solo_ctrl->session());
|
||||
s.set_control (_solo_ctrl, on ? 1.0 : 0.0, gcd);
|
||||
|
|
@ -434,7 +434,7 @@ FP8Strip::set_select ()
|
|||
assert (!_x_select_ctrl);
|
||||
_select_plugin_functor ();
|
||||
} else if (_x_select_ctrl) {
|
||||
_x_select_ctrl->start_touch (timepos_t (_x_select_ctrl->session().transport_sample()));
|
||||
_x_select_ctrl->start_touch (timepos_t (_base.transport_sample()));
|
||||
const bool on = !select_button ().is_active();
|
||||
_x_select_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ TranzportControlProtocol::show_bbt (samplepos_t where)
|
|||
void
|
||||
TranzportControlProtocol::show_transport_time ()
|
||||
{
|
||||
show_bbt (session->transport_sample ());
|
||||
show_bbt (transport_sample ());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ MackieControlProtocol::update_timecode_display()
|
|||
string timecode;
|
||||
|
||||
// do assignment here so current_sample is fixed
|
||||
samplepos_t current_sample = _session->transport_sample();
|
||||
samplepos_t current_sample = transport_sample();
|
||||
// For large jumps in play head possition do full reset
|
||||
int moved = (current_sample - _sample_last) / _session->sample_rate ();
|
||||
if (moved) {
|
||||
|
|
@ -1957,12 +1957,6 @@ MackieControlProtocol::update_fader_automation_state ()
|
|||
}
|
||||
}
|
||||
|
||||
samplepos_t
|
||||
MackieControlProtocol::transport_sample() const
|
||||
{
|
||||
return _session->transport_sample();
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocol::add_down_select_button (int surface, int strip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -215,8 +215,6 @@ class MackieControlProtocol
|
|||
void update_global_button (int id, Mackie::LedState);
|
||||
void update_global_led (int id, Mackie::LedState);
|
||||
|
||||
samplepos_t transport_sample() const;
|
||||
|
||||
int modifier_state() const { return _modifier_state; }
|
||||
int main_modifier_state() const { return _modifier_state & MAIN_MODIFIER_MASK; }
|
||||
|
||||
|
|
|
|||
|
|
@ -996,37 +996,37 @@ OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv
|
|||
if (strcmp (argv[0]->s, X_("transport_frame")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else if (strcmp (argv[0]->s, X_("transport_speed")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else if (strcmp (argv[0]->s, X_("transport_locked")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else if (strcmp (argv[0]->s, X_("punch_in")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else if (strcmp (argv[0]->s, X_("punch_out")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else if (strcmp (argv[0]->s, X_("rec_enable")) == 0) {
|
||||
|
||||
if (session) {
|
||||
lo_send (addr, retpath, "i", _session->transport_sample());
|
||||
lo_send (addr, retpath, "i", transport_sample ());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -3151,7 +3151,7 @@ OSC::set_marker (const char* types, lo_arg **argv, int argc, lo_message msg)
|
|||
if (strcmp (&argv[0]->s, (*l)->name().c_str()) == 0) {
|
||||
locate ((*l)->start_sample (), MustStop);
|
||||
return 0;
|
||||
} else if ((*l)->start () == _session->transport_sample()) {
|
||||
} else if ((*l)->start () == ControlProtocol::transport_sample ()) {
|
||||
cur_mark = (*l);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ TranzportControlProtocol::update_state ()
|
|||
void
|
||||
TranzportControlProtocol::prev_marker ()
|
||||
{
|
||||
Location *location = session->locations()->first_location_before (session->transport_sample());
|
||||
Location *location = session->locations()->first_location_before (transport_sample());
|
||||
|
||||
if (location) {
|
||||
locate (location->start());
|
||||
|
|
@ -196,7 +196,7 @@ TranzportControlProtocol::prev_marker ()
|
|||
void
|
||||
TranzportControlProtocol::next_marker ()
|
||||
{
|
||||
Location *location = session->locations()->first_location_after (session->transport_sample());
|
||||
Location *location = session->locations()->first_location_after (transport_sample());
|
||||
|
||||
if (location) {
|
||||
locate (location->start());
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ TranzportControlProtocol::show_bbt (samplepos_t where)
|
|||
void
|
||||
TranzportControlProtocol::show_transport_time ()
|
||||
{
|
||||
show_bbt (session->transport_sample ());
|
||||
show_bbt (transport_sample ());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1536,12 +1536,6 @@ US2400Protocol::update_fader_automation_state ()
|
|||
{
|
||||
}
|
||||
|
||||
samplepos_t
|
||||
US2400Protocol::transport_sample() const
|
||||
{
|
||||
return _session->transport_sample();
|
||||
}
|
||||
|
||||
void
|
||||
US2400Protocol::add_down_select_button (int surface, int strip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,8 +198,6 @@ class US2400Protocol
|
|||
void update_global_button (int id, US2400::LedState);
|
||||
void update_global_led (int id, US2400::LedState);
|
||||
|
||||
samplepos_t transport_sample() const;
|
||||
|
||||
int modifier_state() const { return _modifier_state; }
|
||||
int main_modifier_state() const { return _modifier_state & MAIN_MODIFIER_MASK; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue