[Summary] Reworked master track behavior according to PRD

This commit is contained in:
GZharun 2014-12-02 16:57:40 +02:00
parent 33349b260d
commit dd78cce7b7
10 changed files with 56 additions and 130 deletions

View file

@ -50,6 +50,7 @@ vector<RefPtr<Gtk::Action> > ActionManager::write_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::actions_forbiden_for_master_track;
vector<RefPtr<Gtk::Action> > ActionManager::point_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::time_selection_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::line_selection_sensitive_actions;

View file

@ -38,6 +38,7 @@ namespace ActionManager {
extern std::vector<Glib::RefPtr<Gtk::Action> > plugin_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > track_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > actions_forbiden_for_master_track;
extern std::vector<Glib::RefPtr<Gtk::Action> > point_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > time_selection_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > line_selection_sensitive_actions;

View file

@ -133,7 +133,7 @@ CompactMeterStrip::update_tooltip ()
boost::shared_ptr<AudioTrack> t;
t = boost::dynamic_pointer_cast<AudioTrack>( _route );
if( t!=NULL && t->is_master_track () )
if( t != NULL && t->is_master_track () )
{
this->set_tooltip_text (_route->name () + "\n" + record_status);
} else

View file

@ -5069,13 +5069,9 @@ Editor::add_routes (RouteList& routes)
throw unknown_type();
}
if (rtv->is_master_track() ) {
new_views.push_front (rtv);
track_views.push_front (rtv);
} else {
new_views.push_back (rtv);
track_views.push_back (rtv);
}
new_views.push_back (rtv);
track_views.push_back (rtv);
rtv->effective_gain_display ();

View file

@ -1725,7 +1725,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void time_selection_changed ();
void update_time_selection_display ();
void track_selection_changed ();
bool non_master_track_selected ();
bool track_selected ();
void output_connection_mode_changed ();
void region_selection_changed ();
sigc::connection editor_regions_selection_changed_connection;

View file

@ -279,6 +279,7 @@ Editor::register_actions ()
act = reg_sens (editor_actions, "DeleteSelectedTracks", _("Delete Selected"), sigc::mem_fun(ARDOUR_UI::instance(), &ARDOUR_UI::delete_selected_tracks));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::actions_forbiden_for_master_track.push_back (act);
act = reg_sens (editor_actions, "move-selected-tracks-up", _("Move Up"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), true));
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "move-selected-tracks-down", _("Move Down"), sigc::bind (sigc::mem_fun(*_routes, &EditorRoutes::move_selected_tracks), false));

View file

@ -29,7 +29,6 @@
#include "ardour/debug.h"
#include "ardour/route.h"
#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
#include "ardour/session.h"
@ -1474,17 +1473,7 @@ EditorRoutes::move_selected_tracks (bool up)
++leading;
while (leading != view_routes.end()) {
//skip master track if it's in scope
bool master_track_in_scope = false;
AudioTrack* atr_l = dynamic_cast<AudioTrack*>(leading->second.get() );
AudioTrack* atr_t = dynamic_cast<AudioTrack*>(trailing->second.get() );
if ((atr_l && atr_l->is_master_track() ) || (atr_t && atr_t->is_master_track() ) ) {
master_track_in_scope = true;
}
if (_editor->selection->selected (leading->first) && !master_track_in_scope ) {
if (_editor->selection->selected (leading->first)) {
view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
leading = view_routes.erase (leading);
} else {
@ -1509,16 +1498,7 @@ EditorRoutes::move_selected_tracks (bool up)
while (1) {
//skip master track if it's in scope
bool master_track_in_scope = false;
AudioTrack* atr_l = dynamic_cast<AudioTrack*>(leading->second.get() );
AudioTrack* atr_t = dynamic_cast<AudioTrack*>(trailing->second.get() );
if ((atr_l && atr_l->is_master_track() ) || (atr_t && atr_t->is_master_track() ) ) {
master_track_in_scope = true;
}
if (_editor->selection->selected (leading->first) && !master_track_in_scope ) {
if (_editor->selection->selected (leading->first)) {
list<ViewRoute>::iterator tmp;
/* need to insert *after* trailing, not *before* it,
@ -1610,18 +1590,13 @@ EditorRoutes::move_selected_tracks_relatively (const PBD::ID& source_track_id, c
// selected tracks: add to the move list but if it's not a target
if (selection.selected(tv) &&
route->id() != target_track_id &&
!rtv->is_master_track() ) {
route->id() != target_track_id ) {
routes_to_move.push_back(route);
continue;
}
// master track should always be the first
if (rtv->is_master_track() ) {
routes.push_front(route);
} else {
routes.push_back (route);
}
// other tracks
routes.push_back (route);
}
RouteList::iterator insert_position;

View file

@ -944,24 +944,11 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* /*ev*/, StreamView*
Otherwise return false
*/
bool
Editor::non_master_track_selected ()
Editor::track_selected ()
{
if( selection->tracks.empty() )
return false;
if( selection->tracks.size() >=2 )
if( !selection->tracks.empty() )
return true;
TimeAxisView* tv = selection->tracks.front();
RouteTimeAxisView* rtv = dynamic_cast <RouteTimeAxisView*> (tv);
if (rtv) {
AudioTrack* atr = dynamic_cast <AudioTrack*> (rtv->route().get() );
if (atr && _session && atr->is_master_track() )
return false;
else
return true;
}
return false;
}
@ -970,26 +957,6 @@ Editor::track_selection_changed ()
{
if (!selection->tracks.empty() ) {
set_selected_mixer_strip (*(selection->tracks.front()));
// the commented out implementation shows master bus in the inspector
// when master track is selected. Requirements chenged for this case
/*
bool master_bus_set = false;
TimeAxisView* tv = selection->tracks.front();
RouteTimeAxisView* rtv = dynamic_cast <RouteTimeAxisView*> (tv);
if (rtv) {
AudioTrack* atr = dynamic_cast <AudioTrack*> (rtv->route().get() );
if (atr && _session && atr->is_master_track() ) {
TimeAxisView* master_bus_tv = axis_view_from_route (_session->master_out() );
if (master_bus_tv) {
set_selected_mixer_strip (*master_bus_tv);
master_bus_set = true;
}
}
}
if (!master_bus_set) {
set_selected_mixer_strip(*tv);
}*/
} else {
@ -1024,6 +991,7 @@ Editor::track_selection_changed ()
}
}
bool master_track_selected = false;
RouteNotificationListPtr routes (new RouteNotificationList);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
@ -1048,14 +1016,27 @@ Editor::track_selection_changed ()
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
if (rtav) {
routes->push_back (rtav->route());
boost::shared_ptr<AudioTrack> atr = boost::dynamic_pointer_cast<AudioTrack> (rtav->route());
if (atr && atr->is_master_track() ) {
master_track_selected = true;
}
}
}
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, non_master_track_selected());
// check if we should enable track selectin sensitive actions
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, track_selected() );
// check if we should disable actions forbiden when only master track is selected
if( master_track_selected &&
track_selected() &&
selection->tracks.size() < 2 ) {
ActionManager::set_sensitive (ActionManager::actions_forbiden_for_master_track, false);
}
/* notify control protocols */
ControlProtocol::TrackSelectionChanged (routes);
}

View file

@ -172,12 +172,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
track()->PlaylistChanged.connect (*this, invalidator (*this), ui_bind(&RouteTimeAxisView::update_playlist_tip, this), gui_context());
}
if (is_master_track() ) {
// do not display number for master track
_number_is_hidden = true;
} else {
enable_header_dnd ();
}
enable_header_dnd ();
playlist_button.set_visible(is_track() && track()->mode() == ARDOUR::Normal);

View file

@ -385,11 +385,6 @@ Session::Session (AudioEngine &eng,
EngineStateController::instance()->set_session(this);
// Waves Tracks: always create master track
if ( ARDOUR::Profile->get_trx () ) {
create_master_track();
}
/* Waves Tracks: fill session with tracks basing on the amount of inputs.
* each available input must have corresponding track when session starts.
*/
@ -431,6 +426,11 @@ Session::Session (AudioEngine &eng,
}
}
// Waves Tracks: always create master track at the end
if ( ARDOUR::Profile->get_trx () ) {
create_master_track();
}
_is_new = false;
SessionLoaded();
@ -2326,35 +2326,28 @@ Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool r
continue;
}
if (*rIter == _master_track && !reconnect_master ) {
continue;
}
if (reconnectIputs) {
(*rIter)->input()->disconnect (this); //GZ: check this; could be heavy
if (*rIter != _master_track) { // do not connect master to phys inputs ever
for (uint32_t route_input_n = 0; route_input_n < (*rIter)->n_inputs().get(DataType::AUDIO); ++route_input_n) {
for (uint32_t route_input_n = 0; route_input_n < (*rIter)->n_inputs().get(DataType::AUDIO); ++route_input_n) {
if (Config->get_input_auto_connect() & AutoConnectPhysical) {
if (Config->get_input_auto_connect() & AutoConnectPhysical) {
if ( input_n == physinputs.size() ) {
break;
}
string port = physinputs[input_n];
if (port.empty() ) {
error << "Physical Input number "<< input_n << " is unavailable and cannot be connected" << endmsg;
}
//GZ: check this; could be heavy
(*rIter)->input()->connect ((*rIter)->input()->ports().port(DataType::AUDIO, route_input_n), port, this);
++input_n;
if ( input_n == physinputs.size() ) {
break;
}
string port = physinputs[input_n];
if (port.empty() ) {
error << "Physical Input number "<< input_n << " is unavailable and cannot be connected" << endmsg;
}
//GZ: check this; could be heavy
(*rIter)->input()->connect ((*rIter)->input()->ports().port(DataType::AUDIO, route_input_n), port, this);
++input_n;
}
}
}
if (reconnectOutputs) {
@ -2385,16 +2378,10 @@ Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool r
error << error << "Master bus is not available" << endmsg;
break;
}
if (!_master_track) {
error << error << "Master track is not available" << endmsg;
break;
}
}
for (uint32_t route_output_n = 0; route_output_n < (*rIter)->n_outputs().get(DataType::AUDIO); ++route_output_n) {
if ((Config->get_output_auto_connect() & AutoConnectPhysical) &&
*rIter != _master_track ) {
if ((Config->get_output_auto_connect() & AutoConnectPhysical) ) {
if ( output_n == physoutputs.size() ) {
break;
@ -2427,17 +2414,6 @@ Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool r
//GZ: check this; could be heavy
(*rIter)->output()->connect ((*rIter)->output()->ports().port(DataType::AUDIO, route_output_n), port, this);
// connect to master track
if (*rIter != _master_track) { // do not connect Master Track to itself
port = _master_track->input()->ports().port(DataType::AUDIO, route_output_n)->name();
if (port.empty() ) {
error << "MasterTrack Input number "<< route_output_n << " is unavailable and cannot be connected" << endmsg;
}
//GZ: check this; could be heavy
(*rIter)->output()->connect ((*rIter)->output()->ports().port(DataType::AUDIO, route_output_n), port, this);
}
}
}
}
@ -2678,8 +2654,8 @@ Session::create_master_track ()
return true;
}
// master track I/O is stereo
uint32_t input_channels = _master_out->n_inputs().get(DataType::AUDIO);
// use the same amount of autputs because master track will be connected to master bus
uint32_t output_channels = input_channels;
std::string track_name = "Master Track";
@ -2688,7 +2664,7 @@ Session::create_master_track ()
boost::shared_ptr<AudioTrack> track;
try {
track.reset (new AudioTrack (*this, track_name, Route::MasterTrack, Normal));
track.reset (new AudioTrack (*this, track_name, Route::MasterTrack, Normal) );
if (track->init ()) {
return false;