2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2015-10-04 14:51:05 -04:00
|
|
|
Copyright (C) 2006 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it
|
|
|
|
and/or modify it under the terms of the GNU Lesser
|
|
|
|
General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "pbd/pthread_utils.h"
|
2012-04-11 16:18:01 -04:00
|
|
|
#include "pbd/memento_command.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/location.h"
|
2016-01-15 17:40:46 -05:00
|
|
|
#include "ardour/tempo.h"
|
2016-06-16 23:31:11 -04:00
|
|
|
#include "ardour/utils.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "control_protocol/basic_ui.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
BasicUI::BasicUI (Session& s)
|
|
|
|
: session (&s)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BasicUI::BasicUI ()
|
|
|
|
: session (0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BasicUI::~BasicUI ()
|
|
|
|
{
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::register_thread (std::string name)
|
|
|
|
{
|
2009-12-04 14:24:09 -05:00
|
|
|
std::string pool_name = name;
|
|
|
|
pool_name += " events";
|
|
|
|
|
|
|
|
SessionEvent::create_per_thread_pool (pool_name, 64);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
void
|
2015-10-04 14:51:05 -04:00
|
|
|
BasicUI::access_action ( std::string action_path )
|
2008-09-10 11:03:30 -04:00
|
|
|
{
|
|
|
|
int split_at = action_path.find( "/" );
|
|
|
|
std::string group = action_path.substr( 0, split_at );
|
|
|
|
std::string item = action_path.substr( split_at + 1 );
|
|
|
|
|
|
|
|
AccessAction( group, item );
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void
|
2015-10-04 14:51:05 -04:00
|
|
|
BasicUI::loop_toggle ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2016-04-30 10:54:32 -04:00
|
|
|
if (!session) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Location * looploc = session->locations()->auto_loop_location();
|
|
|
|
|
|
|
|
if (!looploc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
if (session->get_play_loop()) {
|
2016-04-30 10:54:32 -04:00
|
|
|
|
|
|
|
/* looping enabled, our job is to disable it */
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
session->request_play_loop (false);
|
2016-04-30 10:54:32 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2016-04-30 10:54:32 -04:00
|
|
|
|
|
|
|
/* looping not enabled, our job is to enable it.
|
|
|
|
|
|
|
|
loop-is-NOT-mode: this action always starts the transport rolling.
|
|
|
|
loop-IS-mode: this action simply sets the loop play mechanism, but
|
|
|
|
does not start transport.
|
|
|
|
*/
|
|
|
|
if (Config->get_loop_is_mode()) {
|
|
|
|
session->request_play_loop (true, false);
|
|
|
|
} else {
|
|
|
|
session->request_play_loop (true, true);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
2016-04-30 10:54:32 -04:00
|
|
|
|
|
|
|
//show the loop markers
|
|
|
|
looploc->set_hidden (false, this);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2015-04-13 10:20:40 -04:00
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
BasicUI::loop_location (samplepos_t start, samplepos_t end)
|
2015-04-13 10:20:40 -04:00
|
|
|
{
|
|
|
|
Location* tll;
|
|
|
|
if ((tll = session->locations()->auto_loop_location()) == 0) {
|
|
|
|
Location* loc = new Location (*session, start, end, _("Loop"), Location::IsAutoLoop);
|
|
|
|
session->locations()->add (loc, true);
|
|
|
|
session->set_auto_loop_location (loc);
|
|
|
|
} else {
|
|
|
|
tll->set_hidden (false, this);
|
|
|
|
tll->set (start, end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void
|
2016-06-17 15:47:47 -04:00
|
|
|
BasicUI::goto_start (bool and_roll)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2016-06-17 15:47:47 -04:00
|
|
|
session->goto_start (and_roll);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2015-11-24 23:40:54 -05:00
|
|
|
void
|
|
|
|
BasicUI::goto_zero ()
|
|
|
|
{
|
|
|
|
session->request_locate (0);
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void
|
|
|
|
BasicUI::goto_end ()
|
|
|
|
{
|
|
|
|
session->goto_end ();
|
|
|
|
}
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
void
|
2012-04-11 16:18:01 -04:00
|
|
|
BasicUI::add_marker (const std::string& markername)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t where = session->audible_sample();
|
2012-04-11 16:18:01 -04:00
|
|
|
Location *location = new Location (*session, where, where, markername, Location::IsMark);
|
|
|
|
session->begin_reversible_command (_("add marker"));
|
|
|
|
XMLNode &before = session->locations()->get_state();
|
|
|
|
session->locations()->add (location, true);
|
|
|
|
XMLNode &after = session->locations()->get_state();
|
|
|
|
session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
|
|
|
|
session->commit_reversible_command ();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2016-01-15 17:40:46 -05:00
|
|
|
void
|
|
|
|
BasicUI::remove_marker_at_playhead ()
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
//set up for undo
|
|
|
|
XMLNode &before = session->locations()->get_state();
|
|
|
|
bool removed = false;
|
|
|
|
|
|
|
|
//find location(s) at this time
|
|
|
|
Locations::LocationList locs;
|
2017-09-18 12:39:17 -04:00
|
|
|
session->locations()->find_all_between (session->audible_sample(), session->audible_sample()+1, locs, Location::Flags(0));
|
2016-01-15 17:40:46 -05:00
|
|
|
for (Locations::LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
|
|
|
|
if ((*i)->is_mark()) {
|
|
|
|
session->locations()->remove (*i);
|
|
|
|
removed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//store undo
|
|
|
|
if (removed) {
|
|
|
|
session->begin_reversible_command (_("remove marker"));
|
|
|
|
XMLNode &after = session->locations()->get_state();
|
|
|
|
session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
|
|
|
|
session->commit_reversible_command ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void
|
|
|
|
BasicUI::rewind ()
|
|
|
|
{
|
2012-04-11 16:10:10 -04:00
|
|
|
session->request_transport_speed (session->transport_speed() - 1.5);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::ffwd ()
|
|
|
|
{
|
2012-04-10 22:30:35 -04:00
|
|
|
session->request_transport_speed (session->transport_speed() + 1.5);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::transport_stop ()
|
|
|
|
{
|
|
|
|
session->request_transport_speed (0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::transport_play (bool from_last_start)
|
|
|
|
{
|
2016-05-09 08:14:33 -04:00
|
|
|
if (!session) {
|
|
|
|
return;
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-05-09 08:14:33 -04:00
|
|
|
if (session->is_auditioning()) {
|
|
|
|
return;
|
2015-10-04 14:51:05 -04:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-05-09 08:14:33 -04:00
|
|
|
#if 0
|
|
|
|
if (session->config.get_external_sync()) {
|
|
|
|
switch (Config->get_sync_source()) {
|
|
|
|
case Engine:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* transport controlled by the master */
|
|
|
|
return;
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2016-05-09 08:14:33 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
bool rolling = session->transport_rolling();
|
|
|
|
|
|
|
|
if (session->get_play_loop()) {
|
|
|
|
|
|
|
|
/* If loop playback is not a mode, then we should cancel
|
|
|
|
it when this action is requested. If it is a mode
|
|
|
|
we just leave it in place.
|
|
|
|
*/
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-09 08:14:33 -04:00
|
|
|
if (!Config->get_loop_is_mode()) {
|
|
|
|
/* XXX it is not possible to just leave seamless loop and keep
|
|
|
|
playing at present (nov 4th 2009)
|
|
|
|
*/
|
|
|
|
if (!Config->get_seamless_loop()) {
|
|
|
|
/* stop loop playback and stop rolling */
|
|
|
|
session->request_play_loop (false, true);
|
|
|
|
} else if (rolling) {
|
|
|
|
/* stop loop playback but keep rolling */
|
|
|
|
session->request_play_loop (false, false);
|
|
|
|
}
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-05-09 08:14:33 -04:00
|
|
|
} else if (session->get_play_range () ) {
|
|
|
|
/* stop playing a range if we currently are */
|
|
|
|
session->request_play_range (0, true);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2016-05-09 08:14:33 -04:00
|
|
|
if (!rolling) {
|
|
|
|
session->request_transport_speed (1.0f);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::rec_enable_toggle ()
|
|
|
|
{
|
|
|
|
switch (session->record_status()) {
|
|
|
|
case Session::Disabled:
|
|
|
|
if (session->ntracks() == 0) {
|
|
|
|
// string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.");
|
|
|
|
// MessageDialog msg (*editor, txt);
|
|
|
|
// msg.run ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
session->maybe_enable_record ();
|
|
|
|
break;
|
|
|
|
case Session::Recording:
|
|
|
|
case Session::Enabled:
|
2016-02-02 09:03:41 -05:00
|
|
|
session->disable_record (false, true);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-19 15:00:03 -05:00
|
|
|
void
|
|
|
|
BasicUI::all_tracks_rec_in ()
|
|
|
|
{
|
|
|
|
session->set_all_tracks_record_enabled (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::all_tracks_rec_out ()
|
|
|
|
{
|
|
|
|
session->set_all_tracks_record_enabled (false);
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void
|
|
|
|
BasicUI::save_state ()
|
|
|
|
{
|
|
|
|
session->save_state ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::prev_marker ()
|
|
|
|
{
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t pos = session->locations()->first_mark_before (session->transport_sample());
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-01-17 08:19:16 -05:00
|
|
|
if (pos >= 0) {
|
|
|
|
session->request_locate (pos, session->transport_rolling());
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
|
|
|
session->goto_start ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::next_marker ()
|
|
|
|
{
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t pos = session->locations()->first_mark_after (session->transport_sample());
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2013-01-17 08:19:16 -05:00
|
|
|
if (pos >= 0) {
|
|
|
|
session->request_locate (pos, session->transport_rolling());
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2013-01-17 08:19:16 -05:00
|
|
|
session->goto_end();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-01-09 04:18:24 -05:00
|
|
|
BasicUI::set_transport_speed (double speed)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
session->request_transport_speed (speed);
|
|
|
|
}
|
|
|
|
|
2009-01-09 04:18:24 -05:00
|
|
|
double
|
2008-06-02 17:41:35 -04:00
|
|
|
BasicUI::get_transport_speed ()
|
|
|
|
{
|
|
|
|
return session->transport_speed ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::undo ()
|
|
|
|
{
|
2017-06-25 15:21:56 -04:00
|
|
|
access_action ("Editor/undo");
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::redo ()
|
|
|
|
{
|
2017-06-25 15:21:56 -04:00
|
|
|
access_action ("Editor/redo");
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_all_rec_enables ()
|
|
|
|
{
|
|
|
|
if (session->get_record_enabled()) {
|
2009-12-07 16:37:35 -05:00
|
|
|
// session->record_disenable_all ();
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2009-12-07 16:37:35 -05:00
|
|
|
// session->record_enable_all ();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_punch_in ()
|
|
|
|
{
|
2009-05-13 20:13:27 -04:00
|
|
|
session->config.set_punch_in (!session->config.get_punch_in());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_punch_out ()
|
|
|
|
{
|
2009-05-13 20:13:27 -04:00
|
|
|
session->config.set_punch_out (!session->config.get_punch_out());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BasicUI::get_record_enabled ()
|
|
|
|
{
|
|
|
|
return session->get_record_enabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::set_record_enable (bool yn)
|
|
|
|
{
|
|
|
|
if (yn) {
|
|
|
|
session->maybe_enable_record ();
|
|
|
|
} else {
|
|
|
|
session->disable_record (false, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t
|
|
|
|
BasicUI::transport_sample ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2017-09-18 12:39:17 -04:00
|
|
|
return session->transport_sample();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
BasicUI::locate (samplepos_t where, bool roll_after_locate)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
session->request_locate (where, roll_after_locate);
|
|
|
|
}
|
|
|
|
|
2016-01-15 17:40:46 -05:00
|
|
|
void
|
|
|
|
BasicUI::jump_by_seconds (double secs)
|
|
|
|
{
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t current = session->transport_sample();
|
|
|
|
double s = (double) current / (double) session->nominal_sample_rate();
|
2016-05-09 08:14:33 -04:00
|
|
|
|
2016-01-15 17:40:46 -05:00
|
|
|
s+= secs;
|
2017-05-15 20:49:05 -04:00
|
|
|
if (s < 0) {
|
|
|
|
s = 0;
|
|
|
|
}
|
2017-09-18 12:39:17 -04:00
|
|
|
s = s * session->nominal_sample_rate();
|
2016-05-09 08:14:33 -04:00
|
|
|
|
2016-01-15 17:40:46 -05:00
|
|
|
session->request_locate ( floor(s) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::jump_by_bars (double bars)
|
|
|
|
{
|
|
|
|
TempoMap& tmap (session->tempo_map());
|
2017-09-18 12:39:17 -04:00
|
|
|
Timecode::BBT_Time bbt (tmap.bbt_at_sample (session->transport_sample()));
|
2016-01-15 17:40:46 -05:00
|
|
|
|
|
|
|
bars += bbt.bars;
|
2017-05-15 21:04:37 -04:00
|
|
|
if (bars < 0) {
|
|
|
|
bars = 0;
|
|
|
|
}
|
2016-05-09 08:14:33 -04:00
|
|
|
|
2016-01-15 17:40:46 -05:00
|
|
|
AnyTime any;
|
|
|
|
any.type = AnyTime::BBT;
|
|
|
|
any.bbt.bars = bars;
|
2016-05-09 08:14:33 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
session->request_locate ( session->convert_to_samples (any) );
|
2016-01-15 17:40:46 -05:00
|
|
|
}
|
|
|
|
|
2017-03-18 17:14:02 -04:00
|
|
|
void
|
|
|
|
BasicUI::toggle_monitor_mute ()
|
|
|
|
{
|
|
|
|
if (session->monitor_out()) {
|
|
|
|
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
|
|
|
|
if (mon->cut_all ()) {
|
|
|
|
mon->set_cut_all (false);
|
|
|
|
} else {
|
|
|
|
mon->set_cut_all (true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_monitor_dim ()
|
|
|
|
{
|
|
|
|
if (session->monitor_out()) {
|
|
|
|
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
|
|
|
|
if (mon->dim_all ()) {
|
|
|
|
mon->set_dim_all (false);
|
|
|
|
} else {
|
|
|
|
mon->set_dim_all (true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_monitor_mono ()
|
|
|
|
{
|
|
|
|
if (session->monitor_out()) {
|
|
|
|
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
|
|
|
|
if (mon->mono()) {
|
|
|
|
mon->set_mono (false);
|
|
|
|
} else {
|
|
|
|
mon->set_mono (true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-19 10:27:24 -04:00
|
|
|
void
|
|
|
|
BasicUI::midi_panic ()
|
|
|
|
{
|
|
|
|
session->midi_panic ();
|
|
|
|
}
|
|
|
|
|
2017-03-20 02:09:45 -04:00
|
|
|
void
|
|
|
|
BasicUI::toggle_click ()
|
|
|
|
{
|
|
|
|
bool state = !Config->get_clicking();
|
|
|
|
Config->set_clicking (state);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::toggle_roll ()
|
|
|
|
{
|
|
|
|
if (session->transport_rolling()) {
|
|
|
|
transport_stop ();
|
|
|
|
} else {
|
|
|
|
transport_play (false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::stop_forget ()
|
|
|
|
{
|
|
|
|
session->request_stop (true, true);
|
|
|
|
}
|
|
|
|
|
2017-01-28 12:47:38 -05:00
|
|
|
void BasicUI::mark_in () { access_action("Common/start-range-from-playhead"); }
|
|
|
|
void BasicUI::mark_out () { access_action("Common/finish-range-from-playhead"); }
|
2016-01-16 20:32:00 -05:00
|
|
|
|
2017-04-01 10:56:56 -04:00
|
|
|
void BasicUI::set_punch_range () { access_action("Editor/set-punch-from-edit-range"); }
|
|
|
|
void BasicUI::set_loop_range () { access_action("Editor/set-loop-from-edit-range"); }
|
|
|
|
void BasicUI::set_session_range () { access_action("Editor/set-session-from-edit-range"); }
|
2016-01-16 20:32:00 -05:00
|
|
|
|
|
|
|
void BasicUI::quick_snapshot_stay () { access_action("Main/QuickSnapshotStay"); }
|
|
|
|
void BasicUI::quick_snapshot_switch () { access_action("Main/QuickSnapshotSwitch"); }
|
|
|
|
|
|
|
|
void BasicUI::fit_1_track() { access_action("Editor/fit_1_track"); }
|
|
|
|
void BasicUI::fit_2_tracks() { access_action("Editor/fit_2_tracks"); }
|
|
|
|
void BasicUI::fit_4_tracks() { access_action("Editor/fit_4_tracks"); }
|
|
|
|
void BasicUI::fit_8_tracks() { access_action("Editor/fit_8_tracks"); }
|
|
|
|
void BasicUI::fit_16_tracks() { access_action("Editor/fit_16_tracks"); }
|
|
|
|
void BasicUI::fit_32_tracks() { access_action("Editor/fit_32_tracks"); }
|
|
|
|
void BasicUI::fit_all_tracks() { access_action("Editor/fit_all_tracks"); }
|
|
|
|
|
|
|
|
void BasicUI::zoom_10_ms() { access_action("Editor/zoom_10_ms"); }
|
|
|
|
void BasicUI::zoom_100_ms() { access_action("Editor/zoom_100_ms"); }
|
|
|
|
void BasicUI::zoom_1_sec() { access_action("Editor/zoom_1_sec"); }
|
|
|
|
void BasicUI::zoom_10_sec() { access_action("Editor/zoom_10_sec"); }
|
|
|
|
void BasicUI::zoom_1_min() { access_action("Editor/zoom_1_min"); }
|
|
|
|
void BasicUI::zoom_5_min() { access_action("Editor/zoom_5_min"); }
|
|
|
|
void BasicUI::zoom_10_min() { access_action("Editor/zoom_10_min"); }
|
2016-01-16 21:33:04 -05:00
|
|
|
void BasicUI::zoom_to_session() { access_action("Editor/zoom-to-session"); }
|
|
|
|
void BasicUI::temporal_zoom_in() { access_action("Editor/temporal-zoom-in"); }
|
|
|
|
void BasicUI::temporal_zoom_out() { access_action("Editor/temporal-zoom-out"); }
|
|
|
|
|
|
|
|
void BasicUI::scroll_up_1_track() { access_action("Editor/step-tracks-up"); }
|
|
|
|
void BasicUI::scroll_dn_1_track() { access_action("Editor/step-tracks-down"); }
|
|
|
|
void BasicUI::scroll_up_1_page() { access_action("Editor/scroll-tracks-up"); }
|
|
|
|
void BasicUI::scroll_dn_1_page() { access_action("Editor/scroll-tracks-down"); }
|
2016-01-16 13:33:49 -05:00
|
|
|
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
bool
|
|
|
|
BasicUI::locating ()
|
|
|
|
{
|
|
|
|
return session->locate_pending();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
BasicUI::locked ()
|
|
|
|
{
|
|
|
|
return session->transport_locked ();
|
|
|
|
}
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
ARDOUR::samplecnt_t
|
2009-10-26 10:38:58 -04:00
|
|
|
BasicUI::timecode_frames_per_hour ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-10-26 10:38:58 -04:00
|
|
|
return session->timecode_frames_per_hour ();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
BasicUI::timecode_time (samplepos_t where, Timecode::Time& timecode)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-10-26 10:38:58 -04:00
|
|
|
session->timecode_time (where, *((Timecode::Time *) &timecode));
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
BasicUI::timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2010-12-01 12:51:17 -05:00
|
|
|
session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
BasicUI::sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2010-12-01 12:51:17 -05:00
|
|
|
session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-12-09 22:25:32 -05:00
|
|
|
|
2016-06-16 23:31:11 -04:00
|
|
|
void
|
|
|
|
BasicUI::cancel_all_solo ()
|
|
|
|
{
|
|
|
|
if (session) {
|
2016-06-16 23:31:31 -04:00
|
|
|
session->cancel_all_solo ();
|
2016-06-16 23:31:11 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-17 01:55:36 -04:00
|
|
|
struct SortLocationsByPosition {
|
|
|
|
bool operator() (Location* a, Location* b) {
|
|
|
|
return a->start() < b->start();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::goto_nth_marker (int n)
|
|
|
|
{
|
|
|
|
if (!session) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Locations::LocationList& l (session->locations()->list());
|
|
|
|
Locations::LocationList ordered;
|
|
|
|
ordered = l;
|
|
|
|
|
|
|
|
SortLocationsByPosition cmp;
|
|
|
|
ordered.sort (cmp);
|
|
|
|
|
|
|
|
for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
|
|
|
|
if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_session_range()) {
|
|
|
|
if (n == 0) {
|
|
|
|
session->request_locate ((*i)->start(), session->transport_rolling());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
--n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
#if 0
|
2010-01-04 09:53:44 -05:00
|
|
|
this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality
|
2010-01-01 13:14:32 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::solo_release (boost::shared_ptr<Route> r)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BasicUI::solo_press (boost::shared_ptr<Route> r, bool momentary, bool global, bool exclusive, bool isolate, bool solo_group)
|
|
|
|
{
|
|
|
|
if (momentary) {
|
|
|
|
_solo_release = new SoloMuteRelease (_route->soloed());
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (global) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (_solo_release) {
|
|
|
|
_solo_release->routes = _session->get_routes ();
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (Config->get_solo_control_is_listen_control()) {
|
|
|
|
_session->set_listen (_session->get_routes(), !_route->listening(), Session::rt_cleanup, true);
|
|
|
|
} else {
|
|
|
|
_session->set_solo (_session->get_routes(), !_route->soloed(), Session::rt_cleanup, true);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
} else if (exclusive) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (_solo_release) {
|
|
|
|
_solo_release->exclusive = true;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
boost::shared_ptr<RouteList> routes = _session->get_routes();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
|
|
|
|
if ((*i)->soloed ()) {
|
|
|
|
_solo_release->routes_on->push_back (*i);
|
|
|
|
} else {
|
|
|
|
_solo_release->routes_off->push_back (*i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (Config->get_solo_control_is_listen_control()) {
|
|
|
|
/* ??? we need a just_one_listen() method */
|
|
|
|
} else {
|
|
|
|
_session->set_just_one_solo (_route, true);
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
} else if (isolate) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
// shift-click: toggle solo isolated status
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
_route->set_solo_isolated (!_route->solo_isolated(), this);
|
|
|
|
delete _solo_release;
|
|
|
|
_solo_release = 0;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
} else if (solo_group) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
/* Primary-button1: solo mix group.
|
|
|
|
NOTE: Primary-button2 is MIDI learn.
|
|
|
|
*/
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (_route->route_group()) {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (_solo_release) {
|
|
|
|
_solo_release->routes = _route->route_group()->route_list();
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (Config->get_solo_control_is_listen_control()) {
|
|
|
|
_session->set_listen (_route->route_group()->route_list(), !_route->listening(), Session::rt_cleanup, true);
|
|
|
|
} else {
|
|
|
|
_session->set_solo (_route->route_group()->route_list(), !_route->soloed(), Session::rt_cleanup, true);
|
|
|
|
}
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
} else {
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
/* click: solo this route */
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
|
|
|
rl->push_back (route());
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (_solo_release) {
|
|
|
|
_solo_release->routes = rl;
|
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2010-01-01 13:14:32 -05:00
|
|
|
if (Config->get_solo_control_is_listen_control()) {
|
|
|
|
_session->set_listen (rl, !_route->listening());
|
|
|
|
} else {
|
|
|
|
_session->set_solo (rl, !_route->soloed());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|