Add BasicUI::locations()

Towards removing the direct use of Session by surfaces.
This commit is contained in:
David Robillard 2021-06-15 22:20:59 -04:00
parent fdc24b6594
commit 3e101dd895
11 changed files with 34 additions and 16 deletions

View file

@ -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 (transport_sample()));
timepos_t pos = 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 (transport_sample()));
timepos_t pos = locations()->first_mark_after (timepos_t (transport_sample()));
if (pos.positive() || pos.zero()) {
locate (pos.samples());

View file

@ -852,3 +852,15 @@ BasicUI::master_out () const
{
return _session->master_out ();
}
const Locations*
BasicUI::locations () const
{
return _session->locations ();
}
Locations*
BasicUI::locations ()
{
return _session->locations ();
}

View file

@ -38,6 +38,7 @@
namespace ARDOUR {
class Locations;
class Session;
class SessionConfiguration;
class Stripable;
@ -181,7 +182,12 @@ class LIBCONTROLCP_API BasicUI {
boost::shared_ptr<Stripable> monitor_out () const;
boost::shared_ptr<Stripable> master_out () const;
protected:
/* Locations */
const Locations* locations () const;
Locations* locations ();
protected:
Session* _session;
};

View file

@ -571,11 +571,11 @@ FaderPort8::button_encoder ()
* the current position and we're not rolling.
*/
samplepos_t where = _session->audible_sample();
if (_session->transport_stopped_or_stopping() && _session->locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
if (_session->transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return;
}
_session->locations()->next_available_name (markername,"mark");
locations()->next_available_name (markername,"mark");
add_marker (markername);
}
break;

View file

@ -168,7 +168,7 @@ void
FaderPort8::notify_loop_state_changed ()
{
bool looping = false;
Location* looploc = _session->locations ()->auto_loop_location ();
Location* looploc = locations ()->auto_loop_location ();
if (looploc && get_play_loop ()) {
looping = true;
}

View file

@ -485,11 +485,11 @@ MackieControlProtocol::marker_release (Button &)
samplepos_t where = _session->audible_sample();
if (_session->transport_stopped_or_stopping() && _session->locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
if (_session->transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return off;
}
_session->locations()->next_available_name (markername,"mark");
locations()->next_available_name (markername,"mark");
add_marker (markername);
return off;

View file

@ -139,7 +139,7 @@ void
Maschine2::notify_loop_state_changed ()
{
bool looping = false;
Location* looploc = _session->locations ()->auto_loop_location ();
Location* looploc = locations ()->auto_loop_location ();
if (looploc && get_play_loop ()) {
looping = true;
}

View file

@ -1305,7 +1305,7 @@ OSC::osc_toggle_roll (bool ret2strt)
} else {
if (get_play_loop() && Config->get_loop_is_mode()) {
locate (_session->locations()->auto_loop_location()->start().samples(), MustRoll);
locate (locations()->auto_loop_location()->start().samples(), MustRoll);
} else {
_session->request_roll (TRS_UI);
}
@ -3139,7 +3139,7 @@ OSC::set_marker (const char* types, lo_arg **argv, int argc, lo_message msg)
PBD::warning << "Wrong number of parameters, one only." << endmsg;
return -1;
}
const Locations::LocationList& ll (_session->locations ()->list ());
const Locations::LocationList& ll (locations ()->list ());
uint32_t marker = 0;
switch (types[0]) {

View file

@ -427,7 +427,7 @@ void
OSCGlobalObserver::marks_changed ()
{
lm.clear();
const Locations::LocationList& ll (session->locations ()->list ());
const Locations::LocationList& ll (_osc.locations ()->list ());
// get Locations that are marks
for (Locations::LocationList::const_iterator l = ll.begin(); l != ll.end(); ++l) {
if ((*l)->is_session_range ()) {

View file

@ -181,7 +181,7 @@ TranzportControlProtocol::update_state ()
void
TranzportControlProtocol::prev_marker ()
{
Location *location = session->locations()->first_location_before (transport_sample());
Location *location = 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 (transport_sample());
Location *location = locations()->first_location_after (transport_sample());
if (location) {
locate (location->start());

View file

@ -458,11 +458,11 @@ US2400Protocol::marker_release (Button &)
samplepos_t where = _session->audible_sample();
if (_session->transport_stopped_or_stopping() && _session->locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
if (_session->transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return off;
}
_session->locations()->next_available_name (markername,"mark");
locations()->next_available_name (markername,"mark");
add_marker (markername);
return off;