Add BasicUI::audible_sample()

Towards removing the direct use of Session by surfaces.
This commit is contained in:
David Robillard 2021-06-16 02:09:55 -04:00
parent 453fac0df7
commit 8cbff2b202
9 changed files with 23 additions and 11 deletions

View file

@ -883,6 +883,12 @@ BasicUI::click_gain ()
return _session->click_gain ();
}
samplepos_t
BasicUI::audible_sample (bool* const latent_locate) const
{
return _session->audible_sample (latent_locate);
}
const Locations*
BasicUI::locations () const
{

View file

@ -211,6 +211,10 @@ public:
boost::shared_ptr<Amp> click_gain();
/* Time */
samplepos_t audible_sample (bool* latent_locate = NULL) const;
/* Locations */
const Locations* locations () const;

View file

@ -570,7 +570,7 @@ FaderPort8::button_encoder ()
/* Don't add another mark if one exists within 1/100th of a second of
* the current position and we're not rolling.
*/
samplepos_t where = _session->audible_sample();
samplepos_t where = audible_sample();
if (transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return;
}

View file

@ -1611,7 +1611,7 @@ GenericMidiControlProtocol::maybe_start_touch (boost::shared_ptr<Controllable> c
{
boost::shared_ptr<AutomationControl> actl = boost::dynamic_pointer_cast<AutomationControl> (controllable);
if (actl) {
actl->start_touch (timepos_t (_session->audible_sample ()));
actl->start_touch (timepos_t (audible_sample ()));
}
}

View file

@ -483,7 +483,7 @@ MackieControlProtocol::marker_release (Button &)
* the current position and we're not rolling.
*/
samplepos_t where = _session->audible_sample();
samplepos_t where = audible_sample();
if (transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return off;

View file

@ -438,7 +438,7 @@ MixLayout::strip_vpot_touch (int n, bool touching)
if (stripable[n]) {
boost::shared_ptr<AutomationControl> ac = stripable[n]->gain_control();
if (ac) {
const timepos_t now (session.audible_sample());
const timepos_t now (p2.audible_sample());
if (touching) {
ac->start_touch (now);
} else {

View file

@ -37,10 +37,12 @@
#include "ardour/async_midi_port.h"
#include "ardour/audioengine.h"
#include "ardour/debug.h"
#include "ardour/midiport_manager.h"
#include "ardour/midi_track.h"
#include "ardour/midi_port.h"
#include "ardour/session.h"
#include "ardour/midi_track.h"
#include "ardour/midiport_manager.h"
#include "ardour/rc_configuration.h"
#include "ardour/session_configuration.h"
#include "ardour/session_event.h"
#include "ardour/tempo.h"
#include "ardour/types_convert.h"
@ -1077,7 +1079,7 @@ Push2::other_vpot_touch (int n, bool touching)
if (master) {
boost::shared_ptr<AutomationControl> ac = master->gain_control();
if (ac) {
const timepos_t now (_session->audible_sample());
const timepos_t now (audible_sample());
if (touching) {
ac->start_touch (now);
} else {

View file

@ -573,7 +573,7 @@ TrackMixLayout::strip_vpot_touch (int n, bool touching)
{
boost::shared_ptr<AutomationControl> ac = knobs[n]->controllable();
if (ac) {
const timepos_t now (session.audible_sample());
const timepos_t now (p2.audible_sample());
if (touching) {
ac->start_touch (now);
} else {
@ -595,7 +595,7 @@ TrackMixLayout::update_meters ()
void
TrackMixLayout::update_clocks ()
{
samplepos_t pos = session.audible_sample();
samplepos_t pos = p2.audible_sample();
bool negative = false;
if (pos < 0) {

View file

@ -456,7 +456,7 @@ US2400Protocol::marker_release (Button &)
* the current position and we're not rolling.
*/
samplepos_t where = _session->audible_sample();
samplepos_t where = audible_sample();
if (transport_stopped_or_stopping() && locations()->mark_at (timepos_t (where), timecnt_t (_session->sample_rate() / 100.0))) {
return off;