Merge branch 'LTC'

Conflicts:
	gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj
	libs/ardour/ardour/engine_state_controller.h
	libs/ardour/ardour/session.h
	libs/ardour/ardour/slave.h
	libs/ardour/ltc_slave.cc
	libs/ardour/sse_avx_functions_64bit_win.s
	tools/windows_packaging/TracksLiveSetup/TracksLiveSetup/TracksLiveSetup.isl
This commit is contained in:
YPozdnyakov 2015-05-08 18:01:59 +03:00
parent cfb5b3ebea
commit 0964672cd9
24 changed files with 1118 additions and 212 deletions

View file

@ -274,6 +274,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void update_timecode_source_dropdown_items ();
void set_mtc_indicator_active (bool set_active);
void hide_mtc_indicator ();
void set_ltc_indicator_active (bool set_active);
void hide_ltc_indicator ();
void update_bit_depth_button ();
void update_sample_rate_dropdown ();
@ -809,6 +811,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
Gtk::Image* _mtc_idle_icon;
Gtk::Image* _mtc_sync_icon;
Gtk::Image* _ltc_idle_icon;
Gtk::Image* _ltc_sync_icon;
/** A ProcessThread so that we have some thread-local buffers for use by
* PluginEqGui::impulse_analysis ().

View file

@ -158,6 +158,8 @@ ARDOUR_UI::set_session (Session *s)
_session->MTCSyncStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::set_mtc_indicator_active, this, _1), gui_context());
_session->LTCSyncStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::set_ltc_indicator_active, this, _1), gui_context());
_session->Xrun.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::xrun_handler, this, _1), gui_context());
_session->SoloActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::soloing_changed, this, _1), gui_context());
_session->AuditionActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::auditioning_changed, this, _1), gui_context());
@ -165,7 +167,7 @@ ARDOUR_UI::set_session (Session *s)
_session->locations()->removed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
_session->config.ParameterChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_parameter_changed, this, _1), gui_context ());
_session->MTCInputPortChanged.connect(_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_timecode_source_dropdown_items, this), gui_context ());
_session->MtcOrLtcInputPortChanged.connect(_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_timecode_source_dropdown_items, this), gui_context ());
/* Clocks are on by default after we are connected to a session, so show that here.
*/

View file

@ -77,6 +77,7 @@ using namespace Glib;
//recent session menuitem id
static const std::string recent_session_menuitem_id="recent-session-";
int
ARDOUR_UI::create_editor ()
{
@ -96,6 +97,8 @@ ARDOUR_UI::create_editor ()
_timecode_source_dropdown = &editor->get_waves_dropdown("timecode_selector_dropdown");
_mtc_idle_icon = &editor->get_image("mtc_idle_icon");
_mtc_sync_icon = &editor->get_image("mtc_sync_icon");
_ltc_idle_icon = &editor->get_image("ltc_idle_icon");
_ltc_sync_icon = &editor->get_image("ltc_sync_icon");
_tracks_button = &editor->get_waves_button("tracks_button");
}
@ -149,6 +152,7 @@ ARDOUR_UI::populate_display_format_dropdown ()
_display_format_dropdown->set_text( format );
}
void
ARDOUR_UI::populate_timecode_source_dropdown ()
{
@ -158,61 +162,80 @@ ARDOUR_UI::populate_timecode_source_dropdown ()
timecode_source.clear();
timecode_source.push_back("Internal");
timecode_source.push_back("MTC");
// GZ: Is Not available in current Waves TracksLive version
//timecode_source.push_back("LTC");
timecode_source.push_back("LTC");
for(int i = 0; i < timecode_source.size(); ++i)
{
_timecode_source_dropdown->add_menu_item (timecode_source[i], &timecode_source[i]);
}
if( !_session )
return;
bool use_external_timecode_source = _session->config.get_external_sync ();
if (use_external_timecode_source)
{
if ( Config->get_sync_source() == MTC )
_timecode_source_dropdown->set_text (timecode_source[1]);//"MTC"
// GZ: LTC is not available in current version of Waves TracksLive
/*
else
_timecode_source_dropdown->set_text (timecode_source[2]);//"LTC"
*/
} else {
_timecode_source_dropdown->set_text (timecode_source[0]);//Internal
}
update_timecode_source_dropdown_items();
update_timecode_source_dropdown_items ();
}
void
ARDOUR_UI::update_timecode_source_dropdown_items()
ARDOUR_UI::update_timecode_source_dropdown_items ()
{
if (!_session) {
return;
}
// update visibility of dropdowm items
Gtk::MenuItem* mtc_item = _timecode_source_dropdown->get_item ("MTC");
if (mtc_item) {
if (_session->mtc_input_port()->connected() ) {
mtc_item->set_sensitive(true);
if (_session->mtc_input_port ()->connected () && Config->get_sync_source () == MTC ) {
mtc_item->set_visible (true);
} else {
mtc_item->set_sensitive(false);
mtc_item->set_visible (false);
}
}
Gtk::MenuItem* ltc_item = _timecode_source_dropdown->get_item ("LTC");
if (ltc_item) {
if (_session->ltc_input_port ()->connected () && Config->get_sync_source () == LTC ) {
ltc_item->set_visible (true);
} else {
ltc_item->set_visible (false);
}
}
// set appropriate dropdown item
bool use_external_timecode_source = _session->config.get_external_sync ();
if (use_external_timecode_source)
{
// set appropriate indicator
switch (Config->get_sync_source()) {
case (MTC):
set_mtc_indicator_active (_session->synced_to_mtc() );
_timecode_source_dropdown->set_current_item (1);
break;
case (LTC):
set_ltc_indicator_active (_session->synced_to_ltc() );
_timecode_source_dropdown->set_current_item (2);
break;
default:
fatal << "ARDOUR_UI::update_timecode_source_dropdown_items - unsupported sync tool was used " << endmsg;
}
} else {
// Internal timecode source is used - hide MTC and LTC indicator
hide_mtc_indicator ();
hide_ltc_indicator ();
_timecode_source_dropdown->set_current_item (0); //Internal
}
}
void
ARDOUR_UI::set_mtc_indicator_active (bool set_active)
{
_mtc_sync_icon->set_visible (set_active);
_mtc_idle_icon->set_visible (!set_active);
// we should show just if MTC sync tool was chosen
if (_session->config.get_external_sync () && Config->get_sync_source() == MTC) {
_mtc_sync_icon->set_visible (set_active);
_mtc_idle_icon->set_visible (!set_active);
}
}
void
@ -222,6 +245,24 @@ ARDOUR_UI::hide_mtc_indicator ()
_mtc_idle_icon->set_visible (false);
}
void
ARDOUR_UI::set_ltc_indicator_active (bool set_active)
{
// we should show just if LTC sync tool was chosen
if (_session->config.get_external_sync () && Config->get_sync_source() == LTC) {
_ltc_sync_icon->set_visible (set_active);
_ltc_idle_icon->set_visible (!set_active);
}
}
void
ARDOUR_UI::hide_ltc_indicator ()
{
_ltc_sync_icon->set_visible (false);
_ltc_idle_icon->set_visible (false);
}
void
ARDOUR_UI::on_time_info_box_mode_changed ()
{
@ -296,15 +337,11 @@ ARDOUR_UI::on_timecode_source_dropdown_item_clicked (WavesDropdown* dropdown, in
_session->config.set_external_sync (false);
} else if ( timecode_source == "MTC" )
{
Config->set_sync_source (MTC);
_session->config.set_external_sync (true);
} else if ( timecode_source == "LTC" )
{
_session->config.set_external_sync (true);
}
// GZ: LTC is not available in current version of Waves TracksLive
/* else if ( timecode_source == "LTC" )
{
Config->set_sync_source (LTC);
_session->config.set_external_sync (true);
} */
}
void

View file

@ -313,8 +313,6 @@ ARDOUR_UI::parameter_changed (std::string p)
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (true);
// Internal timecode source is used - hide MTC indicator
hide_mtc_indicator();
} else {
// NO NEED TO HAVE IT: sync_button.set_text (sync_source_to_string (Config->get_sync_source(), true));
@ -322,17 +320,11 @@ ARDOUR_UI::parameter_changed (std::string p)
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (false);
if (MTC == Config->get_sync_source() ) {
// show MTC indicator, but in non lit mode
if (_session) {
set_mtc_indicator_active(_session->synced_to_mtc() );
}
}
}
populate_timecode_source_dropdown ();
} else if (p == "always-play-range") {
}
update_timecode_source_dropdown_items ();
} else if (p == "always-play-range") {
ActionManager::map_some_state ("Transport", "ToggleFollowEdits", &RCConfiguration::get_follow_edits);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -320,6 +320,7 @@
95D9E37F1A8D1B6600A0DA46 /* waves_ambiguous_file_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D9E37D1A8D1B6600A0DA46 /* waves_ambiguous_file_dialog.cc */; };
95D9E3801A8D1B6600A0DA46 /* waves_missing_file_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95D9E37E1A8D1B6600A0DA46 /* waves_missing_file_dialog.cc */; };
95E2A7AB1A8F652F0080BD79 /* waves_radio_item.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95E2A7AA1A8F652F0080BD79 /* waves_radio_item.xml */; };
95E5E9461AE946510000E2CE /* waves_tooltip.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95E5E9451AE946510000E2CE /* waves_tooltip.cc */; };
95F9DFD71A35A8BD0007E953 /* waves_message_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFD61A35A8BD0007E953 /* waves_message_dialog.xml */; };
95F9DFE01A35F3310007E953 /* waves_clean_up_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */; };
95F9DFE11A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */; };
@ -1238,6 +1239,8 @@
95D9E37D1A8D1B6600A0DA46 /* waves_ambiguous_file_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_ambiguous_file_dialog.cc; path = ../waves_ambiguous_file_dialog.cc; sourceTree = "<group>"; };
95D9E37E1A8D1B6600A0DA46 /* waves_missing_file_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_missing_file_dialog.cc; path = ../waves_missing_file_dialog.cc; sourceTree = "<group>"; };
95E2A7AA1A8F652F0080BD79 /* waves_radio_item.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_radio_item.xml; sourceTree = "<group>"; };
95E5E9411AE9462B0000E2CE /* waves_tooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = waves_tooltip.h; path = ../waves_tooltip.h; sourceTree = "<group>"; };
95E5E9451AE946510000E2CE /* waves_tooltip.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = waves_tooltip.cc; path = ../waves_tooltip.cc; sourceTree = "<group>"; };
95ED5FF61A95F285006D39E4 /* route_inspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = route_inspector.h; path = ../route_inspector.h; sourceTree = "<group>"; };
95F9DFD61A35A8BD0007E953 /* waves_message_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_message_dialog.xml; sourceTree = "<group>"; };
95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = waves_clean_up_dialog.xml; sourceTree = "<group>"; };
@ -1333,6 +1336,7 @@
43279040194EFF38003C9FEA /* source */ = {
isa = PBXGroup;
children = (
95E5E9451AE946510000E2CE /* waves_tooltip.cc */,
95D9E37D1A8D1B6600A0DA46 /* waves_ambiguous_file_dialog.cc */,
95D9E37E1A8D1B6600A0DA46 /* waves_missing_file_dialog.cc */,
95D5D1361A8A514300407F98 /* waves_numeric_edit_dialog.cc */,
@ -2027,6 +2031,7 @@
43279480194F00CB003C9FEA /* headers */ = {
isa = PBXGroup;
children = (
95E5E9411AE9462B0000E2CE /* waves_tooltip.h */,
95ED5FF61A95F285006D39E4 /* route_inspector.h */,
95D9E37B1A8D1B5200A0DA46 /* waves_ambiguous_file_dialog.h */,
95D9E37C1A8D1B5200A0DA46 /* waves_missing_file_dialog.h */,
@ -2822,6 +2827,7 @@
95D796131A7BB9E000120A4F /* waves_export_format_selector.cc in Sources */,
95D796111A7BB9E000120A4F /* waves_export_file_notebook.cc in Sources */,
CE294C7A19CAD54500D12768 /* soundcloud_export_selector.cc in Sources */,
95E5E9461AE946510000E2CE /* waves_tooltip.cc in Sources */,
CE294C7B19CAD54500D12768 /* waves_dropdown.cc in Sources */,
CE294C7C19CAD54500D12768 /* waves_grid.cc in Sources */,
CE294C7D19CAD54500D12768 /* waves_zoom_control.cc in Sources */,

View file

@ -1601,10 +1601,10 @@ RCOptionEditor::RCOptionEditor ()
));
add_option (_("Transport"), _sync_source_2997);
add_option (_("Transport"), new OptionEditorHeading (S_("LTC Reader")));
_ltc_port = new ComboStringOption (
_ltc_source_port = new ComboStringOption (
"ltc-source-port",
_("LTC incoming port"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_ltc_source_port),
@ -1614,9 +1614,9 @@ RCOptionEditor::RCOptionEditor ()
vector<string> physical_inputs;
physical_inputs.push_back (_("None"));
AudioEngine::instance()->get_physical_inputs (DataType::AUDIO, physical_inputs);
_ltc_port->set_popdown_strings (physical_inputs);
_ltc_source_port->set_popdown_strings (physical_inputs);
add_option (_("Transport"), _ltc_port);
add_option (_("Transport"), _ltc_source_port);
// TODO; rather disable this button than not compile it..
add_option (_("Transport"), new OptionEditorHeading (S_("LTC Generator")));

View file

@ -50,7 +50,8 @@ private:
BoolOption* _sync_framerate;
BoolOption* _sync_genlock;
BoolOption* _sync_source_2997;
ComboStringOption* _ltc_port;
ComboStringOption* _mtc_source_port;
ComboStringOption* _ltc_source_port;
HSliderOption* _ltc_volume_slider;
Gtk::Adjustment* _ltc_volume_adjustment;
BoolOption* _ltc_send_continuously;

View file

@ -30,6 +30,10 @@ TracksControlPanel::TracksControlPanel ()
, _device_capture_list (get_v_box("device_capture_list"))
, _device_playback_list (get_v_box("device_playback_list"))
, _midi_device_list (get_v_box("midi_device_list"))
, _enable_ltc_generator_vbox (get_v_box("enable_ltc_generator_vbox"))
, _ltc_output_port_vbox (get_v_box("ltc_output_port_vbox"))
, _ltc_generator_level_vbox (get_v_box("ltc_generator_level_vbox"))
, _ltc_send_continuously_hbox (get_h_box("ltc_send_continuously_hbox"))
, _all_inputs_on_button (get_waves_button("all_inputs_on_button"))
, _all_inputs_off_button (get_waves_button("all_inputs_off_button"))
, _all_outputs_on_button (get_waves_button("all_outputs_on_button"))
@ -38,27 +42,32 @@ TracksControlPanel::TracksControlPanel ()
, _midi_settings_tab (get_container ("midi_settings_tab"))
, _session_settings_tab (get_container ("session_settings_tab"))
, _general_settings_tab (get_container ("general_settings_tab"))
, _sync_settings_tab (get_container ("sync_settings_tab"))
, _audio_settings_tab_button (get_waves_button ("audio_settings_tab_button"))
, _midi_settings_tab_button (get_waves_button ("midi_settings_tab_button"))
, _session_settings_tab_button (get_waves_button ("session_settings_tab_button"))
, _general_settings_tab_button (get_waves_button ("general_settings_tab_button"))
, _sync_settings_tab_button (get_waves_button ("sync_settings_tab_button"))
, _ok_button (get_waves_button ("ok_button"))
, _cancel_button (get_waves_button ("cancel_button"))
, _control_panel_button (get_waves_button ("control_panel_button"))
, _no_button (get_waves_button ("no_button"))
, _yes_button (get_waves_button ("yes_button"))
, _enable_ltc_generator_button (get_waves_button ("enable_ltc_generator_button"))
, _ltc_send_continuously_button (get_waves_button ("ltc_send_continuously_button"))
, _engine_dropdown (get_waves_dropdown ("engine_dropdown"))
, _device_dropdown (get_waves_dropdown ("device_dropdown"))
, _sample_rate_dropdown (get_waves_dropdown ("sample_rate_dropdown"))
, _buffer_size_dropdown (get_waves_dropdown ("buffer_size_dropdown"))
, _mtc_in_dropdown (get_waves_dropdown ("mtc_in"))
, _latency_label (get_label("latency_label"))
, _latency_label (get_label("latency_label"))
, _default_open_path (get_label("default_open_path"))
, _ltc_generator_level_label (get_label("ltc_generator_level_label"))
, _multi_out_button(get_waves_button ("multi_out_button"))
, _stereo_out_button(get_waves_button ("stereo_out_button"))
, _name_tracks_after_driver(get_waves_button ("name_tracks_after_driver_button"))
, _reset_tracks_name_to_default(get_waves_button ("reset_tracks_name_to_default_button"))
, _color_adjustment(get_adjustment ("color_adjustment"))
, _color_adjustment (get_adjustment ("color_adjustment"))
, _ltc_generator_level_adjustment (get_adjustment ("ltc_generator_level_adjustment"))
, _color_box(get_container ("color_box"))
, _obey_mmc_commands_button (get_waves_button ("obey_mmc_commands_button"))
, _send_mmc_commands_button (get_waves_button ("send_mmc_commands_button"))
@ -79,7 +88,11 @@ TracksControlPanel::TracksControlPanel ()
, _peak_hold_time_dropdown (get_waves_dropdown ("peak_hold_time_dropdown"))
, _dpm_fall_off_dropdown (get_waves_dropdown ("dpm_fall_off_dropdown"))
, _hard_disk_buffering_dropdown (get_waves_dropdown ("hard_disk_buffering_dropdown"))
, _sync_tool_dropdown (get_waves_dropdown ("sync_tool_dropdown"))
, _mtc_in_dropdown (get_waves_dropdown ("mtc_in"))
, _ltc_in_dropdown (get_waves_dropdown ("ltc_in"))
, _ltc_out_dropdown (get_waves_dropdown ("ltc_out"))
, _sync_input_port_layout (get_layout ("sync_input_port_layout"))
, _have_control (false)
, _ignore_changes (0)
{

View file

@ -48,6 +48,10 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
Gtk::VBox& _device_capture_list;
Gtk::VBox& _device_playback_list;
Gtk::VBox& _midi_device_list;
Gtk::VBox& _enable_ltc_generator_vbox;
Gtk::VBox& _ltc_output_port_vbox;
Gtk::VBox& _ltc_generator_level_vbox;
Gtk::HBox& _ltc_send_continuously_hbox;
WavesButton& _all_inputs_on_button;
WavesButton& _all_inputs_off_button;
WavesButton& _all_outputs_on_button;
@ -56,10 +60,12 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
Gtk::Container& _midi_settings_tab;
Gtk::Container& _session_settings_tab;
Gtk::Container& _general_settings_tab;
Gtk::Container& _sync_settings_tab;
WavesButton& _audio_settings_tab_button;
WavesButton& _midi_settings_tab_button;
WavesButton& _session_settings_tab_button;
WavesButton& _general_settings_tab_button;
WavesButton& _sync_settings_tab_button;
WavesButton& _multi_out_button;
WavesButton& _stereo_out_button;
WavesButton& _ok_button;
@ -71,11 +77,14 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
WavesButton& _name_tracks_after_driver;
WavesButton& _reset_tracks_name_to_default;
Gtk::Adjustment& _color_adjustment;
Gtk::Adjustment& _ltc_generator_level_adjustment;
Gtk::Container& _color_box;
WavesButton& _obey_mmc_commands_button;
WavesButton& _send_mmc_commands_button;
WavesButton& _dc_bias_against_denormals_button;
WavesButton& _copy_imported_files_button;
WavesButton& _enable_ltc_generator_button;
WavesButton& _ltc_send_continuously_button;
Gtk::SpinButton& _inbound_mmc_device_spinbutton;
Gtk::SpinButton& _outbound_mmc_device_spinbutton;
Gtk::SpinButton& _limit_undo_history_spinbutton;
@ -84,7 +93,6 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
WavesDropdown& _device_dropdown;
WavesDropdown& _sample_rate_dropdown;
WavesDropdown& _buffer_size_dropdown;
WavesDropdown& _mtc_in_dropdown;
WavesDropdown& _file_type_dropdown;
WavesDropdown& _bit_depth_dropdown;
WavesDropdown& _frame_rate_dropdown;
@ -95,10 +103,16 @@ class TracksControlPanel : public WavesDialog, public PBD::ScopedConnectionList
WavesDropdown& _peak_hold_time_dropdown;
WavesDropdown& _dpm_fall_off_dropdown;
WavesDropdown& _hard_disk_buffering_dropdown;
WavesDropdown& _sync_tool_dropdown;
WavesDropdown& _mtc_in_dropdown;
WavesDropdown& _ltc_in_dropdown;
WavesDropdown& _ltc_out_dropdown;
Gtk::Label& _latency_label;
Gtk::Label& _default_open_path;
Gtk::Label& _ltc_generator_level_label;
Gtk::Layout& _sync_input_port_layout;
#include "tracks_control_panel.logic.h"
};

View file

@ -82,6 +82,50 @@ namespace {
};
typedef std::vector<MidiDeviceDescriptor> MidiDeviceDescriptorVec;
void dropdown_element_data_cleaner (void* data)
{
free (data);
}
// These functions are used for ltc generator
// transform db to ltc-output-volume
double db_to_volume (double db)
{
return pow (10, db / 20);
}
// ltc-output-volume to db
double volume_to_db (double volume)
{
return 20 * log10 (volume);
}
ARDOUR::SyncSource
SyncSourceTracks_to_SyncSource (int el_number)
{
switch (el_number) {
case TracksControlPanel::MTC:
return ARDOUR::MTC;
case TracksControlPanel::LTC:
return ARDOUR::LTC;
default:
fatal << "Wrong argument in converting from SyncSourceTracks to ARDOUR::SyncSource" << endmsg;
}
}
TracksControlPanel::SyncSourceTracks
SyncSource_to_SyncSourceTracks (ARDOUR::SyncSource sync_source)
{
switch (sync_source) {
case ARDOUR::MTC:
return TracksControlPanel::MTC;
case ARDOUR::LTC:
return TracksControlPanel::LTC;
default:
fatal << "Wrong argument in converting from ARDOUR::SyncSource to TracksControlPanel::SyncSourceTracks" << endmsg;
}
}
}
void
@ -94,6 +138,7 @@ TracksControlPanel::init ()
_midi_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_a_settings_tab_button_clicked));
_session_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_a_settings_tab_button_clicked));
_general_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_a_settings_tab_button_clicked));
_sync_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_a_settings_tab_button_clicked));
_all_inputs_on_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_all_inputs_on_button));
_all_inputs_off_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_all_inputs_off_button));
@ -105,6 +150,9 @@ TracksControlPanel::init ()
_browse_button.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_browse_button));
_enable_ltc_generator_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_enable_ltc_generator_button));
_ltc_send_continuously_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_ltc_send_continuously_button));
EngineStateController::instance ()->EngineRunning.connect (running_connection, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::engine_running, this), gui_context());
EngineStateController::instance ()->EngineStopped.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::engine_stopped, this), gui_context());
EngineStateController::instance ()->EngineHalted.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::engine_stopped, this), gui_context());
@ -118,7 +166,7 @@ TracksControlPanel::init ()
EngineStateController::instance()->MIDIInputConfigChanged.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_midi_input_configuration_changed, this), gui_context());
EngineStateController::instance()->MIDIOutputConfigChanged.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_midi_output_configuration_changed, this), gui_context());
EngineStateController::instance()->MTCInputChanged.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_mtc_input_changed, this, _1), gui_context());
EngineStateController::instance()->DeviceError.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_device_error, this), gui_context());
EngineStateController::instance()->DeviceError.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_device_error, this), gui_context ());
/* Global configuration parameters update */
Config->ParameterChanged.connect (update_connections, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::on_parameter_changed, this, _1), gui_context());
@ -127,23 +175,28 @@ TracksControlPanel::init ()
_device_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_device_dropdown_item_clicked));
_sample_rate_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_sample_rate_dropdown_item_clicked));
_buffer_size_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_buffer_size_dropdown_item_clicked));
_mtc_in_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_mtc_input_chosen));
_mtc_in_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_mtc_in_dropdown_changed));
_ltc_in_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_ltc_in_dropdown_changed));
_sync_tool_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_sync_tool_dropdown_changed));
_ltc_out_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_ltc_out_dropdown_changed));
/* Session configuration parameters update */
_file_type_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_file_type_dropdown_item_clicked));
_bit_depth_dropdown.selected_item_changed.connect (sigc::mem_fun(*this, &TracksControlPanel::on_bit_depth_dropdown_item_clicked));
_frame_rate_dropdown.selected_item_changed.connect (sigc::mem_fun (*this, &TracksControlPanel::on_frame_rate_item_clicked));
_name_tracks_after_driver.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_name_tracks_after_driver));
_reset_tracks_name_to_default.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_reset_tracks_name_to_default));
_name_tracks_after_driver.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_name_tracks_after_driver));
_reset_tracks_name_to_default.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_reset_tracks_name_to_default));
_control_panel_button.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_control_panel_button));
_color_adjustment.signal_value_changed().connect (mem_fun (*this, &TracksControlPanel::color_adjustment_changed));
_control_panel_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_control_panel_button));
_color_adjustment.signal_value_changed ().connect (mem_fun (*this, &TracksControlPanel::color_adjustment_changed));
_ltc_generator_level_adjustment.signal_value_changed ().connect (mem_fun (*this, &TracksControlPanel::ltc_generator_level_adjustment_changed));
_yes_button.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_yes_button));
_no_button.signal_clicked.connect(sigc::mem_fun (*this, &TracksControlPanel::on_no_button));
_yes_button.set_visible(false);
_no_button.set_visible(false);
_yes_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_yes_button));
_no_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_no_button));
_yes_button.set_visible (false);
_no_button.set_visible (false);
populate_engine_dropdown ();
populate_device_dropdown ();
@ -160,19 +213,19 @@ TracksControlPanel::init ()
display_waveform_color_fader ();
// Init session Settings
populate_bit_depth_dropdown();
populate_frame_rate_dropdown();
populate_auto_lock_timer_dropdown();
populate_auto_save_timer_dropdown();
populate_pre_record_buffer_dropdown();
populate_bit_depth_dropdown ();
populate_frame_rate_dropdown ();
populate_auto_lock_timer_dropdown ();
populate_auto_save_timer_dropdown ();
populate_pre_record_buffer_dropdown ();
show_buffer_duration ();
_audio_settings_tab_button.set_active(true);
_audio_settings_tab_button.set_active (true);
display_general_preferences ();
}
DeviceConnectionControl& TracksControlPanel::add_device_capture_control(std::string port_name, bool active, uint16_t capture_number, std::string track_name)
DeviceConnectionControl& TracksControlPanel::add_device_capture_control (std::string port_name, bool active, uint16_t capture_number, std::string track_name)
{
std::string device_capture_name("");
std::string pattern(audio_capture_name_prefix);
@ -206,7 +259,7 @@ DeviceConnectionControl& TracksControlPanel::add_device_playback_control(std::st
return playback_control;
}
MidiDeviceConnectionControl& TracksControlPanel::add_midi_device_control(const std::string& midi_device_name,
MidiDeviceConnectionControl& TracksControlPanel::add_midi_device_control (const std::string& midi_device_name,
const std::string& capture_name, bool capture_active,
const std::string& playback_name, bool playback_active)
{
@ -644,7 +697,7 @@ TracksControlPanel::populate_engine_dropdown()
}
void
TracksControlPanel::populate_device_dropdown()
TracksControlPanel::populate_device_dropdown ()
{
std::vector<AudioBackend::DeviceStatus> all_devices;
EngineStateController::instance()->enumerate_devices (all_devices);
@ -729,41 +782,31 @@ TracksControlPanel::populate_buffer_size_dropdown()
}
void
TracksControlPanel::populate_mtc_in_dropdown()
TracksControlPanel::populate_mtc_in_dropdown ()
{
std::vector<EngineStateController::MidiPortState> midi_states;
static const char* midi_port_name_prefix = "system_midi:";
const char* midi_type_suffix;
bool have_first = false;
EngineStateController::instance()->get_physical_midi_input_states(midi_states);
midi_type_suffix = X_(" capture");
EngineStateController::instance ()->get_physical_midi_input_states (midi_states);
midi_type_suffix = X_ (" capture");
_mtc_in_dropdown.clear_items ();
Gtk::MenuItem& off_item = _mtc_in_dropdown.add_menu_item ("Off", 0);
_mtc_in_dropdown.add_menu_item ("Off", strdup (""), dropdown_element_data_cleaner);
std::vector<EngineStateController::MidiPortState>::const_iterator state_iter;
for (state_iter = midi_states.begin(); state_iter != midi_states.end(); ++state_iter) {
for (state_iter = midi_states.begin (); state_iter != midi_states.end (); ++state_iter) {
// strip the device name from input port name
std::string device_name;
ARDOUR::remove_pattern_from_string(state_iter->name, midi_port_name_prefix, device_name);
ARDOUR::remove_pattern_from_string(device_name, midi_type_suffix, device_name);
ARDOUR::remove_pattern_from_string (state_iter->name, midi_port_name_prefix, device_name);
ARDOUR::remove_pattern_from_string (device_name, midi_type_suffix, device_name);
if (state_iter->active) {
Gtk::MenuItem& new_item = _mtc_in_dropdown.add_menu_item (device_name, strdup(state_iter->name.c_str()) );
if (!have_first && state_iter->mtc_in) {
_mtc_in_dropdown.set_text (new_item.get_label() );
have_first = true;
}
}
_mtc_in_dropdown.add_menu_item (device_name, strdup (state_iter->name.c_str()),dropdown_element_data_cleaner);
}
if (!have_first) {
_mtc_in_dropdown.set_text (off_item.get_label() );
}
display_mtc_in_source ();
}
void
@ -778,7 +821,7 @@ TracksControlPanel::populate_output_mode()
void
TracksControlPanel::populate_input_channels()
TracksControlPanel::populate_input_channels ()
{
cleanup_input_channels_list();
@ -795,16 +838,15 @@ TracksControlPanel::populate_input_channels()
std::string track_name;
if (input_iter->active) {
std::string port_name("");
std::string pattern(audio_capture_name_prefix);
ARDOUR::remove_pattern_from_string(input_iter->name, pattern, port_name);
std::string port_name ("");
std::string pattern (audio_capture_name_prefix);
ARDOUR::remove_pattern_from_string (input_iter->name, pattern, port_name);
number = number_count++;
if (Config->get_tracks_auto_naming() & UseDefaultNames) {
if (Config->get_tracks_auto_naming () & UseDefaultNames) {
track_name = string_compose ("%1 %2", Session::default_trx_track_name_pattern, number);
} else if (Config->get_tracks_auto_naming() & NameAfterDriver) {
} else if (Config->get_tracks_auto_naming () & NameAfterDriver) {
track_name = port_name;
}
}
@ -812,8 +854,31 @@ TracksControlPanel::populate_input_channels()
add_device_capture_control (input_iter->name, input_iter->active, number, track_name);
}
_all_inputs_on_button.set_sensitive(!input_states.empty() );
_all_inputs_off_button.set_sensitive(!input_states.empty() );
_all_inputs_on_button.set_sensitive (!input_states.empty () );
_all_inputs_off_button.set_sensitive (!input_states.empty () );
// if list of audio-in ports was changed, list of ltc-in ports must be also changed
populate_ltc_in_dropdown ();
}
void
TracksControlPanel::populate_ltc_in_dropdown ()
{
_ltc_in_dropdown.clear_items ();
std::vector<EngineStateController::PortState> input_states;
EngineStateController::instance ()->get_physical_audio_input_states (input_states);
std::vector<EngineStateController::PortState>::const_iterator input_iter;
for (input_iter = input_states.begin(); input_iter != input_states.end (); ++input_iter ) {
std::string port_name ("");
std::string pattern (audio_capture_name_prefix);
ARDOUR::remove_pattern_from_string (input_iter->name, pattern, port_name);
_ltc_in_dropdown.add_menu_item (port_name, strdup (input_iter->name.c_str ()), dropdown_element_data_cleaner );
}
display_ltc_in_source ();
}
@ -824,12 +889,12 @@ TracksControlPanel::populate_output_channels()
// process captures (outputs)
std::vector<EngineStateController::PortState> output_states;
EngineStateController::instance()->get_physical_audio_output_states(output_states);
EngineStateController::instance ()->get_physical_audio_output_states (output_states);
std::vector<EngineStateController::PortState>::const_iterator output_iter;
uint16_t number_count = 1;
for (output_iter = output_states.begin(); output_iter != output_states.end(); ++output_iter ) {
for (output_iter = output_states.begin (); output_iter != output_states.end(); ++output_iter ) {
uint16_t number = DeviceConnectionControl::NoNumber;
@ -840,14 +905,37 @@ TracksControlPanel::populate_output_channels()
add_device_playback_control (output_iter->name, output_iter->active, number);
}
bool stereo_out_disabled = (Config->get_output_auto_connect() & AutoConnectPhysical);
_all_outputs_on_button.set_sensitive(!output_states.empty() && stereo_out_disabled );
_all_outputs_off_button.set_sensitive(!output_states.empty() && stereo_out_disabled );
bool stereo_out_disabled = (Config->get_output_auto_connect () & AutoConnectPhysical);
_all_outputs_on_button.set_sensitive(!output_states.empty () && stereo_out_disabled );
_all_outputs_off_button.set_sensitive(!output_states.empty () && stereo_out_disabled );
// if the list of audio-out ports was changed, the list of ltc-out ports must be also changed
populate_ltc_out_dropdown ();
}
void
TracksControlPanel::populate_midi_ports()
TracksControlPanel::populate_ltc_out_dropdown ()
{
_ltc_out_dropdown.clear_items ();
std::vector<EngineStateController::PortState> output_states;
EngineStateController::instance ()->get_physical_audio_output_states (output_states);
std::vector<EngineStateController::PortState>::const_iterator output_iter;
for (output_iter = output_states.begin(); output_iter != output_states.end (); ++output_iter ) {
std::string port_name ("");
std::string pattern (audio_playback_name_prefix);
ARDOUR::remove_pattern_from_string (output_iter->name, pattern, port_name);
_ltc_out_dropdown.add_menu_item (port_name, strdup (output_iter->name.c_str ()), dropdown_element_data_cleaner);
}
display_ltc_output_port ();
}
void
TracksControlPanel::populate_midi_ports ()
{
cleanup_midi_device_list();
@ -897,7 +985,7 @@ TracksControlPanel::populate_midi_ports()
// now add midi device controls
MidiDeviceDescriptorVec::iterator iter;
for (iter = midi_device_descriptors.begin(); iter != midi_device_descriptors.end(); ++iter ) {
add_midi_device_control(iter->name, iter->capture_name, iter->capture_active,
add_midi_device_control (iter->name, iter->capture_name, iter->capture_active,
iter->playback_name, iter->playback_active);
}
}
@ -1098,6 +1186,130 @@ TracksControlPanel::display_denormal_protection ()
_dc_bias_against_denormals_button.set_active_state (Config->get_denormal_protection () ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
void
TracksControlPanel::display_current_sync_tool ()
{
ARDOUR::SyncSource sync_tool_type = Config->get_sync_source ();
_mtc_in_dropdown.set_visible (sync_tool_type == ARDOUR::MTC);
_ltc_in_dropdown.set_visible (sync_tool_type == ARDOUR::LTC
&& !EngineStateController::instance ()->get_ltc_source_port ().empty ());
_sync_input_port_layout.set_visible (_mtc_in_dropdown.get_visible () || _ltc_in_dropdown.get_visible ());
_sync_tool_dropdown.set_current_item (SyncSource_to_SyncSourceTracks (sync_tool_type));
}
void
TracksControlPanel::display_mtc_in_source ()
{
std::string mtc_in_source = EngineStateController::instance ()->get_mtc_source_port ();
int size = _mtc_in_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; ++i) {
char* full_name_of_mtc_input_port = (char*) _mtc_in_dropdown.get_item_data_pv (i);
if (full_name_of_mtc_input_port && full_name_of_mtc_input_port == mtc_in_source ) {
_mtc_in_dropdown.set_current_item (i);
return ;
}
}
}
void
TracksControlPanel::display_ltc_in_source ()
{
std::string ltc_in_source = EngineStateController::instance ()->get_ltc_source_port ();
if (Config->get_sync_source () == ARDOUR::LTC) {
if (ltc_in_source.empty ()) {
_ltc_in_dropdown.set_visible (false);
_sync_input_port_layout.set_visible (false);
return ;
} else {
_ltc_in_dropdown.set_visible (true);
_sync_input_port_layout.set_visible (true);
}
}
int size = _ltc_in_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; ++i) {
char* full_name_of_ltc_input_port = (char*) _ltc_in_dropdown.get_item_data_pv (i);
if (full_name_of_ltc_input_port && full_name_of_ltc_input_port == ltc_in_source ) {
_ltc_in_dropdown.set_current_item (i);
return ;
}
}
}
void
TracksControlPanel::display_ltc_output_port ()
{
// get the list of audio output
std::vector<EngineStateController::PortState> output_states;
EngineStateController::instance ()->get_physical_audio_output_states (output_states);
if (output_states.empty ()) {
// no output audio port
ltc_output_settings_set_visible (false);
return ;
} else {
ltc_output_settings_set_visible (true);
}
std::string ltc_output_port = EngineStateController::instance ()->get_ltc_output_port ();
int size = _ltc_out_dropdown.get_menu ().items ().size ();
for (int i = 0; i < size; ++i) {
char* full_name_of_ltc_output_port = (char*) _ltc_out_dropdown.get_item_data_pv (i);
if (full_name_of_ltc_output_port && full_name_of_ltc_output_port == ltc_output_port ) {
_ltc_out_dropdown.set_current_item (i);
return ;
}
}
}
void
TracksControlPanel::display_enable_ltc_generator ()
{
_enable_ltc_generator_button.set_active_state (Config->get_send_ltc () ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
// if generator is enabled - show its settings
ltc_generator_settings_set_visible (Config->get_send_ltc ());
}
void
TracksControlPanel::display_ltc_send_continuously ()
{
_ltc_send_continuously_button.set_active_state (Config->get_ltc_send_continuously () ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
void
TracksControlPanel::display_ltc_generator_level_fader ()
{
double generator_level_in_db = volume_to_db (Config->get_ltc_output_volume ());
_ltc_generator_level_adjustment.set_value (generator_level_in_db);
std::ostringstream ss;
ss << std::fixed << std::setprecision (1) << generator_level_in_db;
_ltc_generator_level_label.set_text (ss.str ());
}
void
TracksControlPanel::ltc_output_settings_set_visible (bool visible)
{
_enable_ltc_generator_vbox.set_visible (visible);
_ltc_output_port_vbox.set_visible (visible);
// show generator settings only if it's enabled
ltc_generator_settings_set_visible (visible && Config->get_send_ltc ());
}
void
TracksControlPanel::ltc_generator_settings_set_visible (bool visible)
{
_ltc_send_continuously_hbox.set_visible (visible);
_ltc_generator_level_vbox.set_visible (visible);
}
void
TracksControlPanel::display_general_preferences ()
@ -1115,6 +1327,10 @@ TracksControlPanel::display_general_preferences ()
display_history_depth ();
display_saved_history_depth ();
display_denormal_protection ();
display_current_sync_tool ();
display_enable_ltc_generator ();
display_ltc_send_continuously ();
display_ltc_generator_level_fader ();
}
#define RGB_TO_UINT(r,g,b) ((((guint)(r))<<16)|(((guint)(g))<<8)|((guint)(b)))
@ -1202,7 +1418,7 @@ TracksControlPanel::save_general_preferences ()
dbg_msg ("TracksControlPanel::general_preferences ():\nUnexpected meter fall off time!");
break;
}
Config->set_mmc_control (_obey_mmc_commands_button.active_state () == Gtkmm2ext::ExplicitActive);
Config->set_send_mmc (_send_mmc_commands_button.active_state () == Gtkmm2ext::ExplicitActive);
Config->set_only_copy_imported_files (_copy_imported_files_button.active_state () == Gtkmm2ext::ExplicitActive);
@ -1232,8 +1448,8 @@ void TracksControlPanel::on_engine_dropdown_item_clicked (WavesDropdown*, int)
if ( EngineStateController::instance()->set_new_backend_as_current (backend_name) )
{
_have_control = EngineStateController::instance()->is_setup_required ();
populate_device_dropdown();
_have_control = EngineStateController::instance ()->is_setup_required ();
populate_device_dropdown ();
return;
}
@ -1274,15 +1490,17 @@ void
TracksControlPanel::device_changed ()
{
if (_ignore_changes) {
return;
return ;
}
std::string device_name = _device_dropdown.get_text ();
if (EngineStateController::instance()->set_new_device_as_current(device_name) )
if (EngineStateController::instance()->set_new_device_as_current (device_name) )
{
populate_buffer_size_dropdown();
populate_sample_rate_dropdown();
return;
populate_buffer_size_dropdown ();
populate_sample_rate_dropdown ();
// disable LTC generator in case of device change
set_ltc_generator_status (false);
return ;
}
{
@ -1296,6 +1514,7 @@ TracksControlPanel::device_changed ()
set_keep_above (true);
}
void
TracksControlPanel::on_all_inputs_on_button(WavesButton*)
{
@ -1398,6 +1617,13 @@ TracksControlPanel::on_frame_rate_item_clicked (WavesDropdown*, int)
std::string s = _frame_rate_dropdown.get_text();
Timecode::TimecodeFormat timecode_format = string_to_TimecodeFormat(s);
// HOT FIX
// in case of fps change
// set Internal mode
if (_session) {
_session->config.set_external_sync (false);
}
ARDOUR_UI* ardour_ui = ARDOUR_UI::instance();
ardour_ui->set_timecode_format(timecode_format);
}
@ -1435,7 +1661,7 @@ TracksControlPanel::on_sample_rate_dropdown_item_clicked (WavesDropdown*, int)
}
framecnt_t new_sample_rate = get_sample_rate ();
if ( EngineStateController::instance()->set_new_sample_rate_in_controller(new_sample_rate) ) {
if ( EngineStateController::instance()->set_new_sample_rate_in_controller (new_sample_rate) ) {
EngineStateController::instance()->push_current_state_to_backend (false);
} else {
@ -1446,25 +1672,131 @@ TracksControlPanel::on_sample_rate_dropdown_item_clicked (WavesDropdown*, int)
std::string sample_rate_str = ARDOUR_UI_UTILS::rate_as_string (EngineStateController::instance()->get_current_sample_rate() );
WavesMessageDialog msg("", _("Sample rate set to the value which is not supported"));
msg.run();
_sample_rate_dropdown.set_text(sample_rate_str);
_sample_rate_dropdown.set_text (sample_rate_str);
}
show_buffer_duration();
show_buffer_duration ();
}
void
TracksControlPanel::on_mtc_input_chosen (WavesDropdown* dropdown, int el_number)
TracksControlPanel::on_mtc_in_dropdown_changed (WavesDropdown* dropdown, int el_number)
{
char* full_name_of_chosen_port = (char*)dropdown->get_item_data_pv(el_number);
mtc_in_dropdown_change (el_number);
}
void
TracksControlPanel::mtc_in_dropdown_change (int el_number)
{
char* full_name_of_chosen_port = (char*)_mtc_in_dropdown.get_item_data_pv (el_number);
if (full_name_of_chosen_port) {
if (full_name_of_chosen_port == EngineStateController::instance ()->get_mtc_source_port ()) {
return ;
}
EngineStateController::instance ()->set_mtc_source_port (full_name_of_chosen_port);
} else {
EngineStateController::instance ()->set_mtc_source_port ("");
}
}
void
TracksControlPanel::on_ltc_in_dropdown_changed (WavesDropdown* dropdown, int el_number)
{
ltc_in_dropdown_change (el_number);
}
void
TracksControlPanel::ltc_in_dropdown_change (int el_number)
{
char* full_name_of_chosen_port = (char*)_ltc_in_dropdown.get_item_data_pv (el_number);
if (full_name_of_chosen_port) {
if (full_name_of_chosen_port == EngineStateController::instance ()->get_ltc_source_port ()) {
return ;
}
EngineStateController::instance ()->set_ltc_source_port (full_name_of_chosen_port);
} else {
EngineStateController::instance ()->set_ltc_source_port ("");
}
}
void
TracksControlPanel::on_ltc_out_dropdown_changed (WavesDropdown* dropdown, int el_number)
{
char* full_name_of_chosen_port = (char*)_ltc_out_dropdown.get_item_data_pv (el_number);
if (full_name_of_chosen_port) {
EngineStateController::instance()->set_mtc_input((char*) full_name_of_chosen_port);
if (full_name_of_chosen_port == EngineStateController::instance ()->get_ltc_output_port ()) {
return ;
}
EngineStateController::instance ()->set_ltc_output_port (full_name_of_chosen_port);
} else {
EngineStateController::instance()->set_mtc_input("");
EngineStateController::instance ()->set_ltc_output_port ("");
}
}
void
TracksControlPanel::on_sync_tool_dropdown_changed (WavesDropdown* dropdown, int el_number)
{
ARDOUR::SyncSource sync_tool = SyncSourceTracks_to_SyncSource (el_number);
if (sync_tool != Config->get_sync_source ()) {
if (_session) {
// set Internal mode in case of sync tool change
_session->config.set_external_sync (false);
}
Config->set_sync_source (sync_tool);
switch (el_number) {
case (TracksControlPanel::MTC):
EngineStateController::instance()-> set_ltc_source_port ("");
mtc_in_dropdown_change (0);
break;
case (TracksControlPanel::LTC):
EngineStateController::instance()-> set_mtc_source_port ("");
ltc_in_dropdown_change (0);
break;
default:
return ;
}
}
}
void
TracksControlPanel::on_enable_ltc_generator_button (WavesButton*)
{
set_ltc_generator_status (_enable_ltc_generator_button.active_state () == Gtkmm2ext::ExplicitActive);
}
void
TracksControlPanel::set_ltc_generator_status (bool status)
{
Config->set_send_ltc (status);
}
void
TracksControlPanel::on_ltc_send_continuously_button (WavesButton*)
{
Config->set_ltc_send_continuously (_ltc_send_continuously_button.active_state () == Gtkmm2ext::ExplicitActive);
}
void
TracksControlPanel::ltc_generator_level_adjustment_changed ()
{
double generator_level_in_db = _ltc_generator_level_adjustment.get_value (); // -50..0
Config->set_ltc_output_volume (db_to_volume (generator_level_in_db));
}
void
TracksControlPanel::engine_running ()
{
@ -1496,6 +1828,10 @@ TracksControlPanel::on_a_settings_tab_button_clicked (WavesButton* clicked_butto
visible = (&_general_settings_tab_button == clicked_button);
_general_settings_tab.set_visible (visible);
_general_settings_tab_button.set_active(visible);
visible = (&_sync_settings_tab_button == clicked_button);
_sync_settings_tab.set_visible (visible);
_sync_settings_tab_button.set_active(visible);
}
void
@ -1518,6 +1854,11 @@ TracksControlPanel::show_and_open_tab (int tab_id)
visible = (tab_id == PreferencesTab);
_general_settings_tab.set_visible (visible);
_general_settings_tab_button.set_active(visible);
visible = (tab_id == SyncTab);
_sync_settings_tab.set_visible (visible);
_sync_settings_tab_button.set_active(visible);
}
void
@ -1595,7 +1936,8 @@ TracksControlPanel::save_pre_record_buffer()
ARDOUR_UI::config()->set_pre_record_buffer(time);
}
void TracksControlPanel::update_session_config ()
void
TracksControlPanel::update_session_config ()
{
ARDOUR_UI* ardour_ui = ARDOUR_UI::instance();
@ -1689,37 +2031,42 @@ TracksControlPanel::on_key_press_event (GdkEventKey* ev)
return WavesDialog::on_key_press_event (ev);
}
void TracksControlPanel::on_capture_active_changed(DeviceConnectionControl* capture_control, bool active)
void
TracksControlPanel::on_capture_active_changed(DeviceConnectionControl* capture_control, bool active)
{
const char * id_name = (char*)capture_control->get_data(DeviceConnectionControl::id_name);
EngineStateController::instance()->set_physical_audio_input_state(id_name, active);
}
void TracksControlPanel::on_playback_active_changed(DeviceConnectionControl* playback_control, bool active)
void
TracksControlPanel::on_playback_active_changed(DeviceConnectionControl* playback_control, bool active)
{
const char * id_name = (char*)playback_control->get_data(DeviceConnectionControl::id_name);
EngineStateController::instance()->set_physical_audio_output_state(id_name, active);
}
void TracksControlPanel::on_midi_capture_active_changed(MidiDeviceConnectionControl* control, bool active)
void
TracksControlPanel::on_midi_capture_active_changed(MidiDeviceConnectionControl* control, bool active)
{
const char * id_name = (char*)control->get_data(MidiDeviceConnectionControl::capture_id_name);
EngineStateController::instance()->set_physical_midi_input_state(id_name, active);
}
void TracksControlPanel::on_midi_playback_active_changed(MidiDeviceConnectionControl* control, bool active)
void
TracksControlPanel::on_midi_playback_active_changed(MidiDeviceConnectionControl* control, bool active)
{
const char * id_name = (char*)control->get_data(MidiDeviceConnectionControl::playback_id_name);
EngineStateController::instance()->set_physical_midi_output_state(id_name, active);
}
void TracksControlPanel::on_port_registration_update()
void
TracksControlPanel::on_port_registration_update ()
{
populate_input_channels();
populate_output_channels();
populate_midi_ports();
populate_mtc_in_dropdown();
populate_input_channels ();
populate_output_channels ();
populate_midi_ports ();
populate_mtc_in_dropdown ();
}
void
@ -1782,6 +2129,18 @@ TracksControlPanel::on_parameter_changed (const std::string& parameter_name)
display_saved_history_depth ();
} else if (parameter_name == "waveform fill") {
display_waveform_color_fader ();
} else if (parameter_name == "ltc-source-port") {
display_ltc_in_source ();
} else if (parameter_name == "sync-source") {
display_current_sync_tool ();
} else if (parameter_name == "ltc-output-port") {
display_ltc_output_port ();
} else if (parameter_name == "send-ltc") {
display_enable_ltc_generator ();
} else if (parameter_name == "ltc-send-continuously") {
display_ltc_send_continuously ();
} else if (parameter_name == "ltc-output-volume") {
display_ltc_generator_level_fader ();
}
}
@ -1879,7 +2238,7 @@ TracksControlPanel::on_midi_input_configuration_changed ()
}
}
populate_mtc_in_dropdown();
populate_mtc_in_dropdown ();
}
void
@ -1908,7 +2267,7 @@ TracksControlPanel::on_midi_output_configuration_changed ()
void
TracksControlPanel::on_mtc_input_changed (const std::string&)
{
// add actions here
display_mtc_in_source ();
}
std::string

View file

@ -24,10 +24,16 @@
AudioSystemSettingsTab,
MIDISystemSettingsTab,
SessionSettingsTab,
PreferencesTab
PreferencesTab,
SyncTab
};
void show_and_open_tab (int);
enum SyncSourceTracks { // as we use these values in XML let's define them explicitely for easy reading.
MTC = 0,
LTC = 1
};
private:
// attributes
@ -84,18 +90,30 @@
void buffer_size_changed ();
void on_buffer_size_dropdown_item_clicked (WavesDropdown*, int);
void on_sample_rate_dropdown_item_clicked (WavesDropdown*, int);
void on_mtc_input_chosen (WavesDropdown*, int);
void engine_running ();
void engine_stopped ();
void on_file_type_dropdown_item_clicked (WavesDropdown*, int);
void on_bit_depth_dropdown_item_clicked (WavesDropdown*, int);
void on_frame_rate_item_clicked (WavesDropdown*, int);
void populate_engine_dropdown ();
void on_mtc_in_dropdown_changed (WavesDropdown*, int);
void mtc_in_dropdown_change (int);
void on_ltc_in_dropdown_changed (WavesDropdown*, int);
void ltc_in_dropdown_change (int);
void on_sync_tool_dropdown_changed (WavesDropdown*, int);
void on_ltc_out_dropdown_changed (WavesDropdown*, int);
void on_ltc_send_continuously_button (WavesButton*);
void set_ltc_generator_status (bool);
void on_enable_ltc_generator_button (WavesButton*);
void ltc_generator_level_adjustment_changed ();
void populate_engine_dropdown ();
void populate_device_dropdown ();
void populate_sample_rate_dropdown ();
void populate_buffer_size_dropdown ();
void populate_mtc_in_dropdown ();
void populate_ltc_in_dropdown ();
void populate_ltc_out_dropdown ();
void populate_output_mode ();
void populate_input_channels();
void populate_output_channels();
@ -129,6 +147,14 @@
void reject ();
// Merged ARDOUR's preferences
void display_current_sync_tool ();
void display_ltc_in_source ();
void display_mtc_in_source ();
void display_ltc_output_port ();
void display_enable_ltc_generator ();
void display_ltc_send_continuously ();
void display_ltc_generator_level_fader ();
void display_waveform_shape ();
void display_meter_hold ();
void display_meter_falloff ();
@ -144,6 +170,9 @@
void display_general_preferences ();
void save_general_preferences ();
void ltc_output_settings_set_visible (bool);
void ltc_generator_settings_set_visible (bool);
void cleanup_input_channels_list();
void cleanup_output_channels_list();
void cleanup_midi_device_list();

View file

@ -178,6 +178,18 @@
y="4"
visible="false"
noshowall="true"/>
<icon id="ltc_idle_icon"
source="ltc_idle"
x="3"
y="4"
visible="false"
noshowall="true"/>
<icon id="ltc_sync_icon"
source="ltc_sync"
x="3"
y="4"
visible="false"
noshowall="true"/>
</Layout>
<icon source="infobar_center"
box.fill="true"

View file

@ -103,6 +103,21 @@
borderwidth="0 0 1 1"
x="0"
y="0"/>
<EventBox bgnormal="#373737"
width="107"
height="0"/>
<Button id="sync_settings_tab_button"
width="110"
height="65"
text="Sync"
style="generic_control"
fgnormal="#909090"
bgnormal="#303030"
fgactive="#000000"
bgactive="#dcdcdc"
borderwidth="0 0 1 1"
x="0"
y="0"/>
<EventBox bgnormal="#373737"
width="107"
height="0"/>
@ -204,40 +219,6 @@
</VBox>
</HBox>
</ScrolledWindow>
<Layout bgnormal="#373737"
x="21"
y="290"
width="291"
height="19">
<Label style="generic_control"
text="MTC Input"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<Dropdown style="generic_dropdown"
id="mtc_in"
text="MTC IN"
x="21"
y="320"
width="291"
height="20"
normalicon="preference_mtc_dropdown"
activeicon="preference_mtc_dropdown_active"
_prelighticon="preference_mtc_dropdown_prelight"
inactiveicon="preference_mtc_dropdown_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_control"
horzalignment="start"
width="291"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
</Layout>
<Layout id="audio_settings_tab"
bgnormal="#303030"
@ -1039,5 +1020,224 @@
height="557">-->
<!--</ScrolledWindow>-->
</EventBox>
<Layout id="sync_settings_tab"
bgnormal="#303030"
x="113"
y="1"
width="505"
height="557"
visible="false">
<Layout bgnormal="#373737"
x="21"
y="20"
width="291"
height="19">
<Label style="generic_control"
text="Sync Input"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<Dropdown style="generic_dropdown"
id="sync_tool_dropdown"
x="21"
y="40"
width="291"
height="20"
normalicon="preference_mtc_dropdown"
activeicon="preference_mtc_dropdown_active"
_prelighticon="preference_mtc_dropdown_prelight"
inactiveicon="preference_mtc_dropdown_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_control"
horzalignment="start"
width="291"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu">
<Dropdownitem title="MTC"
style="generic_dropdown_item"
data="0"/>
<Dropdownitem title="LTC"
style="generic_dropdown_item"
data="1"/>
</DropdownMenu>
</Dropdown>
<Layout bgnormal="#373737"
id="sync_input_port_layout"
x="21"
y="60"
width="291"
height="19">
<Label style="generic_control"
text="Sync Port"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<Dropdown style="generic_dropdown"
id="mtc_in"
text="MTC IN"
x="21"
y="80"
width="291"
height="20"
normalicon="preference_mtc_dropdown"
activeicon="preference_mtc_dropdown_active"
_prelighticon="preference_mtc_dropdown_prelight"
inactiveicon="preference_mtc_dropdown_inactive"
maxmenuheight="128">
<HBox>
<VBox width="10"/>
<Label style="generic_control"
horzalignment="start"
width="291"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<Dropdown style="generic_dropdown"
id="ltc_in"
text="LTC IN"
x="21"
y="80"
width="291"
height="20"
normalicon="preference_mtc_dropdown"
activeicon="preference_mtc_dropdown_active"
_prelighticon="preference_mtc_dropdown_prelight"
inactiveicon="preference_mtc_dropdown_inactive"
maxmenuheight="128"
visible="false">
<HBox>
<VBox width="10"/>
<Label style="generic_control"
horzalignment="start"
width="291"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<!--UI part for LTC generator-->
<VBox id="enable_ltc_generator_vbox"
x="21"
y="220">
<Layout bgnormal="#373737"
x="21"
y="220"
width="291"
height="19">
<Label style="generic_control"
text="LTC Generator"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<HBox ui.os.windows="false"
x="21" y="240">
<Iconbutton id="enable_ltc_generator_button"
width="20"
height="20"
normalicon="waves_check_box"
activeicon="waves_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Enable LTC generator"
x="17" y="3"/>
</HBox>
</VBox>
<HBox ui.os.windows="false"
id="ltc_send_continuously_hbox"
x="21" y="260">
<Iconbutton id="ltc_send_continuously_button"
width="20"
height="20"
normalicon="waves_check_box"
activeicon="waves_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Send LTC while stopped"
x="17" y="3"/>
</HBox>
<VBox id="ltc_output_port_vbox"
x="21"
y="280">
<Layout bgnormal="#373737"
x="21"
y="280"
width="291"
height="19">
<Label style="generic_control"
text="LTC Output"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<Dropdown style="generic_dropdown"
id="ltc_out"
text="LTC OUT"
x="21"
y="300"
width="291"
height="20"
normalicon="preference_mtc_dropdown"
activeicon="preference_mtc_dropdown_active"
_prelighticon="preference_mtc_dropdown_prelight"
inactiveicon="preference_mtc_dropdown_inactive"
maxmenuheight="128"
visible="true">
<HBox>
<VBox width="10"/>
<Label style="generic_control"
horzalignment="start"
width="291"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
</VBox>
<VBox id="ltc_generator_level_vbox"
x="21"
y="320">
<Layout bgnormal="#373737"
x="21"
y="320"
width="291"
height="19">
<Label style="generic_control"
text="LTC Output level"
fgnormal="#c1c1c1"
winfont ="Arial Bold 12"
macfont ="Helvetica Bold 12"
x="7" y="3"/>
</Layout>
<HBox x="21" y="340">
<Adjustment id="ltc_generator_level_adjustment"
minvalue="-50"
maxvalue="0"
initialvalue="-50"
step="0.1"
pageincrement="1"/>
<Fader adjustment="ltc_generator_level_adjustment"
facesource="waveform_zoom_fader_face"
handlesource="zoom_fader_handle"
activehandlesource="zoom_fader_handle_active"
minposx="6"
minposy="9"
maxposx="66"
maxposy="9"/>
<VBox width="25"/>
<Label id="ltc_generator_level_label"
style="generic_control"
width="25"
height="20"/>
</HBox>
</VBox>
</Layout> <!--end of sync_settings_tab-->
</Layout>
</Dialog>

View file

@ -262,6 +262,7 @@ public:
*/
bool get_physical_audio_output_state(const std::string& port_name);
/** Get vector of all enabled MIDI input port names.
*
* @param[out] channel_states - vector of enabled inputs
@ -272,6 +273,34 @@ public:
* @param[out] channel_states - vector of enabled outputs
*/
void get_physical_midi_output_states (std::vector<MidiPortState>& channel_states);
/** Get name of mtc source port
*
* return name of mtc source port
*/
std::string get_mtc_source_port ();
/** Set ltc source port
*
* @param[in] port - name of ltc source port
*/
void set_ltc_source_port (const std::string& port);
/** Get name of ltc source port
*
* return name of ltc source port
*/
std::string get_ltc_source_port ();
/** Set ltc output port
*
* @param[in] port - name of ltc output port
*/
void set_ltc_output_port (const std::string&);
/** Get name of ltc output port
*
* return name of ltc output port
*/
std::string get_ltc_output_port ();
/** Set state of the specified MIDI input port.
*
@ -324,7 +353,7 @@ public:
* @note There is a sense to choose MIDI TimeCode input only because
* our MIDI TimeCode is propagated to all midi output ports.
*/
void set_mtc_input(const std::string&);
void set_mtc_source_port (const std::string&);
/** Check if AudioEngine setup is required
* @return true if setup is required, otherwise - false
@ -542,8 +571,27 @@ private:
/** make sure that current device parameters are supported and fit session requirements
* @return true if current state is valid and all parameters are supported, otherwise - false
*/
bool _validate_current_device_state();
////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool _validate_current_device_state();
/** change ltc source port in case of the input ports list change
*/
void _update_ltc_source_port ();
/** change ltc source port in case of the output ports list change
*/
void _update_ltc_output_port ();
/** check that port is still existed in the list of input ports
@param[in] port - port name
@return true if current port is existed, otherwise - false
*/
bool _audio_input_port_exists (const std::string& port);
/** check that port is still existed in the list of output ports
@param[in] port - port name
@return true if current port is existed, otherwise - false
*/
bool _audio_output_port_exists (const std::string& port);
////////////////////////////////////////
// callbacks

View file

@ -301,9 +301,12 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
PBD::Signal0<void> IOConnectionsComplete;
/* Record status signals */
/* MTC status signals */
PBD::Signal1<void, bool> MTCSyncStateChanged;
/* LTC status signals */
PBD::Signal1<void, bool> LTCSyncStateChanged;
/* Record status signals */
PBD::Signal0<void> RecordStateChanged;
@ -348,7 +351,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
PBD::Signal1<void,bool> StepEditStatusChange;
/* MTC state signals */
PBD::Signal0<void> MTCInputPortChanged;
PBD::Signal0<void> MtcOrLtcInputPortChanged;
void queue_event (SessionEvent*);
@ -602,7 +605,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void request_sync_source (Slave*);
bool synced_to_engine() const { return config.get_external_sync() && Config->get_sync_source() == Engine; }
bool synced_to_mtc() const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); }
bool synced_to_mtc () const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); }
bool synced_to_ltc () const { return config.get_external_sync() && Config->get_sync_source() == LTC && g_atomic_int_get (const_cast<gint*>(&_ltc_active)); }
double transport_speed() const { return _transport_speed; }
bool transport_stopped() const { return _transport_speed == 0.0f; }
@ -1007,6 +1011,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void reconnect_mtc_ports ();
// reconnect MMC ports
void reconnect_mmc_ports (bool);
// reconnect ltc source port
void reconnect_ltc_input ();
// reconnect ltc output port
void reconnect_ltc_output ();
protected:
friend class AudioEngine;
@ -1080,6 +1088,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void mtc_status_changed (bool);
PBD::ScopedConnection mtc_status_connection;
void ltc_status_changed (bool);
PBD::ScopedConnection ltc_status_connection;
void initialize_latencies ();
void set_worst_io_latencies ();
@ -1119,6 +1129,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
SlaveState _slave_state;
gint _mtc_active;
gint _ltc_active;
framepos_t slave_wait_end;
void reset_slave_state ();
@ -1774,9 +1785,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<IO> _ltc_input;
boost::shared_ptr<IO> _ltc_output;
void reconnect_ltc_input ();
void reconnect_ltc_output ();
/* Scene Changing */
SceneChanger* _scene_changer;

View file

@ -356,6 +356,8 @@ public:
Timecode::TimecodeFormat apparent_timecode_format() const;
std::string approximate_current_position() const;
std::string approximate_current_delta() const;
PBD::Signal1<void, bool> ActiveChanged;
private:
void parse_ltc(const pframes_t, const Sample* const, const framecnt_t);

View file

@ -598,6 +598,86 @@ EngineStateController::_validate_current_device_state()
}
void
EngineStateController::_update_ltc_source_port ()
{
// this method is called if the list of ports is changed
// check that ltc-in port from Config still exists
if (_audio_input_port_exists (get_ltc_source_port ())) {
// audio port, that was saved in Config, exists
return ;
}
//otherwise set first available audio port
if (!_current_state->input_channel_states.empty ()) {
set_ltc_source_port (_current_state->input_channel_states.front ().name);
return ;
}
// no available audio-in ports
set_ltc_source_port ("");
}
void
EngineStateController::_update_ltc_output_port ()
{
// this method is called if the list of ports is changed
// check that ltc-out port from Config still exists
if (_audio_output_port_exists (get_ltc_output_port ())) {
// audio port, that was saved in Config, exists
return ;
}
PortStateList* output_states;
if (Config->get_output_auto_connect() & AutoConnectMaster) {
output_states = &_current_state->stereo_out_channel_states;
} else {
output_states = &_current_state->multi_out_channel_states;
}
//otherwise set first available audio port
if (!output_states->empty ()) {
set_ltc_output_port (output_states->front ().name);
return ;
}
// no available audio-out ports
set_ltc_output_port ("");
}
bool
EngineStateController::_audio_input_port_exists (const std::string& port_name)
{
PortStateList::const_iterator iter = _current_state->input_channel_states.begin ();
for (; iter != _current_state->input_channel_states.end (); ++iter ) {
if (iter->name == port_name)
return true;
}
return false;
}
bool
EngineStateController::_audio_output_port_exists (const std::string& port_name)
{
PortStateList* output_states;
if (Config->get_output_auto_connect() & AutoConnectMaster) {
output_states = &_current_state->stereo_out_channel_states;
} else {
output_states = &_current_state->multi_out_channel_states;
}
PortStateList::const_iterator iter = output_states->begin();
for (; iter != output_states->end (); ++iter ) {
if (iter->name == port_name)
return true;
}
return false;
}
const std::string&
EngineStateController::get_current_backend_name() const
{
@ -789,7 +869,6 @@ EngineStateController::set_new_device_as_current(const std::string& device_name)
}
bool
EngineStateController::set_new_sample_rate_in_controller(framecnt_t sample_rate)
{
@ -1200,7 +1279,7 @@ EngineStateController::set_all_midi_scene_outputs_disconnected()
void
EngineStateController::set_mtc_input(const std::string& port_name)
EngineStateController::set_mtc_source_port (const std::string& port_name)
{
MidiPortStateList::iterator iter = _midi_inputs.begin();
for (; iter != _midi_inputs.end(); ++iter) {
@ -1215,7 +1294,11 @@ EngineStateController::set_mtc_input(const std::string& port_name)
}
}
MTCInputChanged(port_name);
if (_session && port_name.empty ()) {
_session->reconnect_mtc_ports ();
}
MTCInputChanged (port_name);
}
@ -1336,6 +1419,10 @@ EngineStateController::_on_session_loaded ()
_session->reconnect_mtc_ports ();
_session->reconnect_mmc_ports (true);
_session->reconnect_mmc_ports (false);
// This is done during session construction
// _session->reconnect_ltc_input ();
// _session->reconnect_ltc_output ();
framecnt_t desired_sample_rate = _session->nominal_frame_rate ();
if ( desired_sample_rate > 0 && set_new_sample_rate_in_controller(desired_sample_rate) )
@ -1677,9 +1764,15 @@ EngineStateController::_on_ports_registration_update ()
_session->reconnect_mmc_ports (true);
_session->reconnect_mmc_ports (false);
_session->reconnect_ltc_input ();
_session->reconnect_ltc_output ();
}
PortRegistrationChanged(); // emit a signal
_update_ltc_source_port ();
_update_ltc_output_port ();
PortRegistrationChanged (); // emit a signal
}
@ -1703,6 +1796,15 @@ EngineStateController::push_current_state_to_backend(bool start)
if (state_changed) {
if (was_running) {
if (_current_state->device_name != backend->device_name()) {
// device has been changed
// the list of ports has been changed too
// current ltc_source_port and ltc_output_port aren't available
set_ltc_source_port ("");
set_ltc_output_port ("");
}
if (AudioEngine::instance()->stop () ) {
return false;
}
@ -1764,3 +1866,42 @@ EngineStateController::push_current_state_to_backend(bool start)
return true;
}
std::string
EngineStateController::get_mtc_source_port ()
{
MidiPortStateList::const_iterator state_iter = _midi_inputs.begin();
for (; state_iter != _midi_inputs.end(); ++state_iter) {
if (state_iter->available && state_iter->mtc_in) {
return (state_iter->name);
}
}
return "";
}
void
EngineStateController::set_ltc_source_port (const std::string& port)
{
Config->set_ltc_source_port (port);
}
std::string
EngineStateController::get_ltc_source_port ()
{
return Config->get_ltc_source_port ();
}
void
EngineStateController::set_ltc_output_port (const std::string& port)
{
Config->set_ltc_output_port (port);
}
std::string
EngineStateController::get_ltc_output_port ()
{
return Config->get_ltc_output_port ();
}

View file

@ -26,6 +26,7 @@
#include "pbd/pthread_utils.h"
#include "ardour/debug.h"
#include "ardour/profile.h"
#include "ardour/slave.h"
#include "ardour/session.h"
#include "ardour/audioengine.h"
@ -151,6 +152,7 @@ LTC_Slave::reset()
ltc_speed = 0;
engine_dll_initstate = 0;
sync_lock_broken = false;
ActiveChanged (false);
}
void
@ -445,6 +447,11 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
if (delayedlocked < 10) delayedlocked++;
}
else if (engine_dll_initstate != transport_direction && ltc_speed != 0) {
if (Profile->get_trx()) {
ActiveChanged (true);
}
engine_dll_initstate = transport_direction;
init_engine_dll(last_ltc_frame + rint(ltc_speed * double(2 * nframes + now - last_timestamp)),
session.engine().samples_per_cycle());
@ -488,6 +495,10 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
reset();
speed = 0;
pos = session.transport_frame();
if (Profile->get_trx()) {
ActiveChanged (false);
}
return true;
}

View file

@ -201,6 +201,7 @@ Session::Session (AudioEngine &eng,
, have_first_delta_accumulator (false)
, _slave_state (Stopped)
, _mtc_active (false)
, _ltc_active (false)
, post_export_sync (false)
, post_export_position (0)
, _exporting (false)
@ -2564,17 +2565,20 @@ Session::reconnect_mtc_ports()
std::vector<EngineStateController::MidiPortState>::iterator state_iter = midi_port_states.begin();
for (; state_iter != midi_port_states.end(); ++state_iter) {
if (state_iter->active && state_iter->available && state_iter->mtc_in) {
if (state_iter->available && state_iter->mtc_in) {
mtc_in_ptr->connect (state_iter->name);
}
}
if (!_midi_ports->mtc_input_port()->connected() &&
config.get_external_sync () ) {
if (!_midi_ports->mtc_input_port ()->connected () &&
config.get_external_sync () &&
(Config->get_sync_source () == MTC) ) {
config.set_external_sync (false);
}
MTCInputPortChanged(); //emit signal
if ( ARDOUR::Profile->get_trx () ) {
// Tracks need this signal to update timecode_source_dropdown
MtcOrLtcInputPortChanged (); //emit signal
}
}
}
@ -6153,9 +6157,7 @@ Session::ltc_output_port () const
void
Session::reconnect_ltc_input ()
{
// GZ: Waves Tracks - ltc is disabled for this version
if (_ltc_input) {
#if 0
string src = Config->get_ltc_source_port();
_ltc_input->disconnect (this);
@ -6163,24 +6165,25 @@ Session::reconnect_ltc_input ()
if (src != _("None") && !src.empty()) {
_ltc_input->nth (0)->connect (src);
}
#endif
if ( ARDOUR::Profile->get_trx () ) {
// Tracks need this signal to update timecode_source_dropdown
MtcOrLtcInputPortChanged (); //emit signal
}
}
}
void
Session::reconnect_ltc_output ()
{
// GZ: Waves Tracks - ltc is disabled for this version
if (_ltc_output) {
#if 0
string src = Config->get_ltc_sink_port();
string src = Config->get_ltc_output_port();
_ltc_output->disconnect (this);
if (src != _("None") && !src.empty()) {
_ltc_output->nth (0)->connect (src);
}
#endif
}
}

View file

@ -3651,7 +3651,7 @@ Session::config_changed (std::string p, bool ours)
Evoral::ControlList::set_thinning_factor (Config->get_automation_thinning_factor());
} else if (p == "ltc-source-port") {
reconnect_ltc_input ();
} else if (p == "ltc-sink-port") {
} else if (p == "ltc-output-port") {
reconnect_ltc_output ();
} else if (p == "timecode-generator-offset") {
ltc_tx_parse_offset();

View file

@ -1578,6 +1578,13 @@ Session::mtc_status_changed (bool yn)
MTCSyncStateChanged( yn );
}
void
Session::ltc_status_changed (bool yn)
{
g_atomic_int_set (&_ltc_active, yn);
LTCSyncStateChanged( yn );
}
void
Session::use_sync_source (Slave* new_slave)
{
@ -1590,7 +1597,7 @@ Session::use_sync_source (Slave* new_slave)
delete _slave;
_slave = new_slave;
MTC_Slave* mtc_slave = dynamic_cast<MTC_Slave*>(_slave);
MTC_Slave* mtc_slave = dynamic_cast<MTC_Slave*> (_slave);
if (mtc_slave) {
mtc_slave->ActiveChanged.connect_same_thread (mtc_status_connection, boost::bind (&Session::mtc_status_changed, this, _1));
MTCSyncStateChanged(mtc_slave->locked() );
@ -1602,6 +1609,18 @@ Session::use_sync_source (Slave* new_slave)
mtc_status_connection.disconnect ();
}
LTC_Slave* ltc_slave = dynamic_cast<LTC_Slave*> (_slave);
if (ltc_slave) {
ltc_slave->ActiveChanged.connect_same_thread (ltc_status_connection, boost::bind (&Session::ltc_status_changed, this, _1));
LTCSyncStateChanged (ltc_slave->locked() );
} else {
if (g_atomic_int_get (&_ltc_active) ){
g_atomic_int_set (&_ltc_active, 0);
LTCSyncStateChanged( false );
}
ltc_status_connection.disconnect ();
}
DEBUG_TRACE (DEBUG::Slave, string_compose ("set new slave to %1\n", _slave));
// need to queue this for next process() cycle

View file

@ -466,8 +466,12 @@ ARDOUR::string_to_sync_source (string str)
if (str == _("JACK")) {
return Engine;
}
fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
if (str == _("LTC")) {
return LTC;
}
fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
/*NOTREACHED*/
return Engine;
}