90% done with external sync design changes (GUI now has toggle switch for ext/int sync; source chosen separately, currently in ardour prefs dialog ; fix libmidi++ and compilation scripts to correctly build JACK+ALSA support; minor contiuing tweaks on transport stuff

git-svn-id: svn://localhost/ardour2/branches/3.0@6048 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-11-09 20:05:18 +00:00
parent 8f50846090
commit 498dfebcca
30 changed files with 284 additions and 208 deletions

View file

@ -1528,6 +1528,8 @@ widget "*BypassButton" style:highest "red_when_active"
widget "*BypassButton*" style:highest "red_when_active" widget "*BypassButton*" style:highest "red_when_active"
widget "*TransportSoloAlert" style:highest "flashing_alert" widget "*TransportSoloAlert" style:highest "flashing_alert"
widget "*TransportSoloAlert.*" style:highest "flashing_alert" widget "*TransportSoloAlert.*" style:highest "flashing_alert"
widget "*TransportSyncAlert" style:highest "flashing_alert"
widget "*TransportSyncAlert.*" style:highest "flashing_alert"
widget "*SendAlert" style:highest "green_flashing_alert" widget "*SendAlert" style:highest "green_flashing_alert"
widget "*SendAlert.*" style:highest "green_flashing_alert" widget "*SendAlert.*" style:highest "green_flashing_alert"
widget "*TransportAuditioningAlert" style:highest "flashing_alert" widget "*TransportAuditioningAlert" style:highest "flashing_alert"

View file

@ -398,6 +398,9 @@ ARDOUR_UI::post_engine ()
update_cpu_load (); update_cpu_load ();
update_sample_rate (engine->frame_rate()); update_sample_rate (engine->frame_rate());
Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
Config->map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed));
/* now start and maybe save state */ /* now start and maybe save state */
if (do_engine_start () == 0) { if (do_engine_start () == 0) {
@ -1524,14 +1527,15 @@ ARDOUR_UI::transport_roll ()
return; return;
} }
switch (Config->get_slave_source()) { if (session->config.get_external_sync()) {
case None: switch (session->config.get_sync_source()) {
case JACK: case JACK:
break; break;
default: default:
/* transport controlled by the master */ /* transport controlled by the master */
return; return;
} }
}
bool rolling = session->transport_rolling(); bool rolling = session->transport_rolling();
@ -1561,14 +1565,15 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
return; return;
} }
switch (Config->get_slave_source()) { if (session->config.get_external_sync()) {
case None: switch (session->config.get_sync_source()) {
case JACK: case JACK:
break; break;
default: default:
/* transport controlled by the master */ /* transport controlled by the master */
return; return;
} }
}
bool rolling = session->transport_rolling(); bool rolling = session->transport_rolling();
bool affect_transport = true; bool affect_transport = true;

View file

@ -385,9 +385,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
BindableButton play_selection_button; BindableButton play_selection_button;
BindableButton rec_button; BindableButton rec_button;
Gtk::ComboBoxText sync_option_combo; Gtk::ToggleButton sync_button;
void sync_option_changed (); void sync_button_clicked ();
void toggle_time_master (); void toggle_time_master ();
void toggle_video_sync (); void toggle_video_sync ();
@ -434,6 +434,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::VBox alert_box; Gtk::VBox alert_box;
void solo_blink (bool); void solo_blink (bool);
void sync_blink (bool);
void audition_blink (bool); void audition_blink (bool);
void soloing_changed (bool); void soloing_changed (bool);
@ -671,7 +672,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_use_osc (); void toggle_use_osc ();
void mtc_port_changed ();
void parameter_changed (std::string); void parameter_changed (std::string);
bool first_idle (); bool first_idle ();

View file

@ -239,7 +239,7 @@ ARDOUR_UI::setup_transport ()
ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start")); ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start"));
ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end")); ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end"));
ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click")); ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click"));
ARDOUR_UI::instance()->tooltips().set_tip (sync_option_combo, _("Positional sync source")); ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Positional sync source"));
ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?")); ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?"));
ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control")); ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control"));
ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display")); ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
@ -331,11 +331,10 @@ ARDOUR_UI::setup_transport ()
sdframe->set_shadow_type (SHADOW_IN); sdframe->set_shadow_type (SHADOW_IN);
sdframe->add (speed_display_box); sdframe->add (speed_display_box);
mtc_port_changed (); sync_button.set_name ("TransportSyncAlert");
sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed)); sync_button.signal_clicked().connect (mem_fun (*this, &ARDOUR_UI::sync_button_clicked));
// XXX HOW TO USE set_popdown_strings() and combo_fudge with this when we don't know // XXX HOW TO USE set_popdown_strings() with this when we don't know the real strings till later?
// the real strings till later? set_size_request_to_display_given_text (sync_button, X_("Egternal"), 4, 10);
set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+COMBO_FUDGE, 10);
shbox->pack_start (*sdframe, false, false); shbox->pack_start (*sdframe, false, false);
shbox->pack_start (shuttle_units_button, true, true); shbox->pack_start (shuttle_units_button, true, true);
@ -362,7 +361,7 @@ ARDOUR_UI::setup_transport ()
if (!Profile->get_sae()) { if (!Profile->get_sae()) {
VBox* time_controls_box = manage (new VBox); VBox* time_controls_box = manage (new VBox);
time_controls_box->pack_start (sync_option_combo, false, false); time_controls_box->pack_start (sync_button, false, false);
time_controls_box->pack_start (time_master_button, false, false); time_controls_box->pack_start (time_master_button, false, false);
clock_box->pack_start (*time_controls_box, false, false, 1); clock_box->pack_start (*time_controls_box, false, false, 1);
} }
@ -485,6 +484,24 @@ ARDOUR_UI::solo_blink (bool onoff)
} }
} }
void
ARDOUR_UI::sync_blink (bool onoff)
{
if (session == 0 || !session->config.get_external_sync()) {
return;
}
if (!session->transport_locked()) {
if (onoff) {
sync_button.set_state (STATE_ACTIVE);
} else {
sync_button.set_state (STATE_NORMAL);
}
} else {
sync_button.set_state (STATE_NORMAL);
}
}
void void
ARDOUR_UI::audition_blink (bool onoff) ARDOUR_UI::audition_blink (bool onoff)
{ {
@ -846,13 +863,10 @@ ARDOUR_UI::editor_realized ()
} }
void void
ARDOUR_UI::sync_option_changed () ARDOUR_UI::sync_button_clicked ()
{ {
if (session) { if (session) {
ustring txt = sync_option_combo.get_active_text (); session->config.set_external_sync (sync_button.get_active());
if (txt.length()) {
session->request_slave_source (string_to_slave_source (txt));
}
} }
} }

View file

@ -105,6 +105,7 @@ ARDOUR_UI::connect_to_session (Session *s)
Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink)); Blink.connect (mem_fun(*this, &ARDOUR_UI::transport_rec_enable_blink));
Blink.connect (mem_fun(*this, &ARDOUR_UI::solo_blink)); Blink.connect (mem_fun(*this, &ARDOUR_UI::solo_blink));
Blink.connect (mem_fun(*this, &ARDOUR_UI::sync_blink));
Blink.connect (mem_fun(*this, &ARDOUR_UI::audition_blink)); Blink.connect (mem_fun(*this, &ARDOUR_UI::audition_blink));
/* these are all need to be handled in an RT-safe and MT way, so don't /* these are all need to be handled in an RT-safe and MT way, so don't

View file

@ -262,69 +262,50 @@ ARDOUR_UI::toggle_editing_space()
} }
} }
void
ARDOUR_UI::mtc_port_changed ()
{
bool have_mtc;
bool have_midi_clock;
if (session) {
if (session->mtc_port()) {
have_mtc = true;
} else {
have_mtc = false;
}
if (session->midi_clock_port()) {
have_midi_clock = true;
} else {
have_midi_clock = false;
}
} else {
have_mtc = false;
have_midi_clock = false;
}
positional_sync_strings.clear ();
positional_sync_strings.push_back (slave_source_to_string (None));
if (have_mtc) {
positional_sync_strings.push_back (slave_source_to_string (MTC));
}
if (have_midi_clock) {
positional_sync_strings.push_back (slave_source_to_string (MIDIClock));
}
positional_sync_strings.push_back (slave_source_to_string (JACK));
set_popdown_strings (sync_option_combo, positional_sync_strings);
}
void void
ARDOUR_UI::setup_session_options () ARDOUR_UI::setup_session_options ()
{ {
mtc_port_changed (); session->config.ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
session->config.map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed));
Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
} }
#if 0
void
ARDOUR_UI::handle_sync_change ()
{
if (!session) {
return;
}
if (!session->config.get_external_sync()) {
sync_button.set_label (_("Internal"));
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
} else {
sync_button.set_label (_("External"));
/* XXX need to make auto-play is off as well as insensitive */
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
}
}
#endif
void void
ARDOUR_UI::parameter_changed (std::string p) ARDOUR_UI::parameter_changed (std::string p)
{ {
ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), p)); ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), p));
if (p == "slave-source") { if (p == "external-sync") {
sync_option_combo.set_active_text (slave_source_to_string (Config->get_slave_source())); if (!session->config.get_external_sync()) {
sync_button.set_label (_("Internal"));
switch (Config->get_slave_source()) {
case None:
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true); ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true); ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
break; } else {
sync_button.set_label (sync_source_to_string (session->config.get_sync_source()));
default:
/* XXX need to make auto-play is off as well as insensitive */ /* XXX need to make auto-play is off as well as insensitive */
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false); ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false); ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
break;
} }
} else if (p == "send-mtc") { } else if (p == "send-mtc") {

View file

@ -2350,14 +2350,15 @@ Editor::transition_to_rolling (bool fwd)
return; return;
} }
switch (Config->get_slave_source()) { if (session->config.get_external_sync()) {
case None: switch (session->config.get_sync_source()) {
case JACK: case JACK:
break; break;
default: default:
/* transport controlled by the master */ /* transport controlled by the master */
return; return;
} }
}
if (session->is_auditioning()) { if (session->is_auditioning()) {
session->cancel_audition (); session->cancel_audition ();

View file

@ -231,6 +231,11 @@ public:
_combo->append_text (o); _combo->append_text (o);
} }
void clear () {
_combo->clear_items();
_options.clear ();
}
void changed () { void changed () {
uint32_t const r = _combo->get_active_row_number (); uint32_t const r = _combo->get_active_row_number ();
if (r < _options.size()) { if (r < _options.size()) {

View file

@ -138,8 +138,8 @@ private:
}; };
SessionOptionEditor::SessionOptionEditor (Session* s) SessionOptionEditor::SessionOptionEditor (Session* s)
: OptionEditor (&(s->config), _("Session Preferences")), : OptionEditor (&(s->config), _("Session Preferences"))
_session_config (&(s->config)) , _session_config (&(s->config))
{ {
/* FADES */ /* FADES */
@ -222,6 +222,19 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
add_option (_("Sync"), spf); add_option (_("Sync"), spf);
ComboOption<SyncSource>* ssrc = new ComboOption<SyncSource> (
"sync-source",
_("External sync source"),
mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
);
s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
populate_sync_options (s, ssrc);
add_option (_("Sync"), ssrc);
ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> ( ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
"timecode-format", "timecode-format",
_("Timecode frames-per-second"), _("Timecode frames-per-second"),
@ -332,3 +345,18 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
add_option (_("Connections"), new ConnectionOptions (this, s)); add_option (_("Connections"), new ConnectionOptions (this, s));
} }
void
SessionOptionEditor::populate_sync_options (Session* s, Option* opt)
{
ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
vector<SyncSource> sync_opts = s->get_available_sync_options ();
sync_opt->clear ();
for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
sync_opt->add (*i, sync_source_to_string (*i));
}
}

View file

@ -12,4 +12,5 @@ public:
private: private:
ARDOUR::SessionConfiguration* _session_config; ARDOUR::SessionConfiguration* _session_config;
void populate_sync_options (ARDOUR::Session*, Option*);
}; };

View file

@ -108,7 +108,6 @@ CONFIG_VARIABLE (nframes_t, postroll, "postroll", 0)
CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f) CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f)
CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f)
CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f)
CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None)
CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung)
CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage)
CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false) CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false)

View file

@ -145,7 +145,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
RangeStop, RangeStop,
RangeLocate, RangeLocate,
Overwrite, Overwrite,
SetSlaveSource, SetSyncSource,
Audition, Audition,
InputConfigurationChange, InputConfigurationChange,
SetPlayAudioRange, SetPlayAudioRange,
@ -173,7 +173,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void* ptr; void* ptr;
bool yes_or_no; bool yes_or_no;
nframes64_t target2_frame; nframes64_t target2_frame;
SlaveSource slave; SyncSource sync_source;
Route* route; Route* route;
}; };
@ -576,8 +576,9 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
static sigc::signal<void> EndTimeChanged; static sigc::signal<void> EndTimeChanged;
static sigc::signal<void> TimecodeOffsetChanged; static sigc::signal<void> TimecodeOffsetChanged;
void request_slave_source (SlaveSource); std::vector<SyncSource> get_available_sync_options() const;
bool synced_to_jack() const { return Config->get_slave_source() == JACK; } void request_sync_source (SyncSource);
bool synced_to_jack() const { return config.get_external_sync() && config.get_sync_source() == JACK; }
double transport_speed() const { return _transport_speed; } double transport_speed() const { return _transport_speed; }
bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_stopped() const { return _transport_speed == 0.0f; }
@ -1074,9 +1075,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
nframes_t this_delta, bool starting); nframes_t this_delta, bool starting);
void follow_slave_silently(nframes_t nframes, float slave_speed); void follow_slave_silently(nframes_t nframes, float slave_speed);
void set_slave_source (SlaveSource); void use_sync_source (SyncSource);
void drop_sync_source ();
SlaveSource post_export_slave; bool post_export_sync;
nframes_t post_export_position; nframes_t post_export_position;
bool _exporting; bool _exporting;

View file

@ -47,3 +47,5 @@ CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false)
CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f)
CONFIG_VARIABLE (bool, show_summary, "show-summary", true) CONFIG_VARIABLE (bool, show_summary, "show-summary", true)
CONFIG_VARIABLE (bool, show_group_tabs, "show-group-tabs", true) CONFIG_VARIABLE (bool, show_group_tabs, "show-group-tabs", true)
CONFIG_VARIABLE (bool, external_sync, "external-sync", false)
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", JACK)

View file

@ -360,10 +360,9 @@ namespace ARDOUR {
ExportContext ExportContext
}; };
enum SlaveSource { enum SyncSource {
None = 0,
MTC,
JACK, JACK,
MTC,
MIDIClock MIDIClock
}; };
@ -444,7 +443,7 @@ std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf); std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf); std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf); std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf); std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf); std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf); std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf);
std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::TimecodeFormat& sf);
@ -461,7 +460,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::CrossfadeModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::SlaveSource& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleUnits& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::TimecodeFormat& sf);

View file

@ -62,8 +62,8 @@ bool path_is_paired (Glib::ustring path, Glib::ustring& pair_base);
void compute_equal_power_fades (ARDOUR::nframes_t nframes, float* in, float* out); void compute_equal_power_fades (ARDOUR::nframes_t nframes, float* in, float* out);
const char* slave_source_to_string (ARDOUR::SlaveSource src); const char* sync_source_to_string (ARDOUR::SyncSource src);
ARDOUR::SlaveSource string_to_slave_source (std::string str); ARDOUR::SyncSource string_to_sync_source (std::string str);
const char* edit_mode_to_string (ARDOUR::EditMode); const char* edit_mode_to_string (ARDOUR::EditMode);
ARDOUR::EditMode string_to_edit_mode (std::string); ARDOUR::EditMode string_to_edit_mode (std::string);

View file

@ -70,7 +70,7 @@ setup_enum_writer ()
CDMarkerFormat _CDMarkerFormat; CDMarkerFormat _CDMarkerFormat;
HeaderFormat _HeaderFormat; HeaderFormat _HeaderFormat;
PluginType _PluginType; PluginType _PluginType;
SlaveSource _SlaveSource; SyncSource _SyncSource;
ShuttleBehaviour _ShuttleBehaviour; ShuttleBehaviour _ShuttleBehaviour;
ShuttleUnits _ShuttleUnits; ShuttleUnits _ShuttleUnits;
Session::RecordState _Session_RecordState; Session::RecordState _Session_RecordState;
@ -266,11 +266,10 @@ setup_enum_writer ()
REGISTER_ENUM (VST); REGISTER_ENUM (VST);
REGISTER (_PluginType); REGISTER (_PluginType);
REGISTER_ENUM (None);
REGISTER_ENUM (MTC); REGISTER_ENUM (MTC);
REGISTER_ENUM (JACK); REGISTER_ENUM (JACK);
REGISTER_ENUM (MIDIClock); REGISTER_ENUM (MIDIClock);
REGISTER (_SlaveSource); REGISTER (_SyncSource);
REGISTER_ENUM (Sprung); REGISTER_ENUM (Sprung);
REGISTER_ENUM (Wheel); REGISTER_ENUM (Wheel);
@ -296,7 +295,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Session::Event, RangeStop); REGISTER_CLASS_ENUM (Session::Event, RangeStop);
REGISTER_CLASS_ENUM (Session::Event, RangeLocate); REGISTER_CLASS_ENUM (Session::Event, RangeLocate);
REGISTER_CLASS_ENUM (Session::Event, Overwrite); REGISTER_CLASS_ENUM (Session::Event, Overwrite);
REGISTER_CLASS_ENUM (Session::Event, SetSlaveSource); REGISTER_CLASS_ENUM (Session::Event, SetSyncSource);
REGISTER_CLASS_ENUM (Session::Event, Audition); REGISTER_CLASS_ENUM (Session::Event, Audition);
REGISTER_CLASS_ENUM (Session::Event, InputConfigurationChange); REGISTER_CLASS_ENUM (Session::Event, InputConfigurationChange);
REGISTER_CLASS_ENUM (Session::Event, SetPlayAudioRange); REGISTER_CLASS_ENUM (Session::Event, SetPlayAudioRange);
@ -669,15 +668,15 @@ std::ostream& operator<<(std::ostream& o, const CrossfadeModel& var)
std::string s = enum_2_string (var); std::string s = enum_2_string (var);
return o << s; return o << s;
} }
std::istream& operator>>(std::istream& o, SlaveSource& var) std::istream& operator>>(std::istream& o, SyncSource& var)
{ {
std::string s; std::string s;
o >> s; o >> s;
var = (SlaveSource) string_2_enum (s, var); var = (SyncSource) string_2_enum (s, var);
return o; return o;
} }
std::ostream& operator<<(std::ostream& o, const SlaveSource& var) std::ostream& operator<<(std::ostream& o, const SyncSource& var)
{ {
std::string s = enum_2_string (var); std::string s = enum_2_string (var);
return o << s; return o << s;

View file

@ -126,7 +126,6 @@ int
ARDOUR::setup_midi () ARDOUR::setup_midi ()
{ {
if (Config->midi_ports.size() == 0) { if (Config->midi_ports.size() == 0) {
//warning << _("no MIDI ports specified: no MMC or MTC control possible") << endmsg;
return 0; return 0;
} }
@ -139,27 +138,17 @@ ARDOUR::setup_midi ()
MIDI::Port* first; MIDI::Port* first;
const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports(); const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
if (ports.size() > 1) { if (ports.size() > 1) {
first = ports.begin()->second; first = ports.begin()->second;
/* More than one port, so try using specific names for each port */ /* More than one port, so try using specific names for each port */
if (Config->get_mmc_port_name() != N_("control")) {
default_mmc_port = MIDI::Manager::instance()->port (Config->get_mmc_port_name()); default_mmc_port = MIDI::Manager::instance()->port (Config->get_mmc_port_name());
}
if (Config->get_mtc_port_name() != N_("control")) {
default_mtc_port = MIDI::Manager::instance()->port (Config->get_mtc_port_name()); default_mtc_port = MIDI::Manager::instance()->port (Config->get_mtc_port_name());
}
if (Config->get_midi_port_name() != N_("control")) {
default_midi_port = MIDI::Manager::instance()->port (Config->get_midi_port_name()); default_midi_port = MIDI::Manager::instance()->port (Config->get_midi_port_name());
} default_midi_clock_port = MIDI::Manager::instance()->port (Config->get_midi_clock_port_name());
if (Config->get_midi_clock_port_name() != N_("control")) {
default_midi_port = MIDI::Manager::instance()->port (Config->get_midi_clock_port_name());
}
/* If that didn't work, just use the first listed port */ /* If that didn't work, just use the first listed port */
@ -194,7 +183,6 @@ ARDOUR::setup_midi ()
if (default_mmc_port == 0) { if (default_mmc_port == 0) {
warning << string_compose (_("No MMC control (MIDI port \"%1\" not available)"), Config->get_mmc_port_name()) warning << string_compose (_("No MMC control (MIDI port \"%1\" not available)"), Config->get_mmc_port_name())
<< endmsg; << endmsg;
return 0;
} }
@ -339,8 +327,11 @@ ARDOUR::init (bool use_vst, bool try_optimization)
return -1; return -1;
} }
Config->set_use_vst (use_vst); Config->set_use_vst (use_vst);
cerr << "After config loaded, MTC port name = " << Config->get_mtc_port_name() << endl;
Profile = new RuntimeProfile; Profile = new RuntimeProfile;

View file

@ -203,6 +203,8 @@ RCConfiguration::get_state ()
MIDI::Manager::PortMap::const_iterator i; MIDI::Manager::PortMap::const_iterator i;
const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports(); const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
cerr << "Saving " << ports.size() << " MIDI ports\n";
for (i = ports.begin(); i != ports.end(); ++i) { for (i = ports.begin(); i != ports.end(); ++i) {
root->add_child_nocopy(i->second->get_state()); root->add_child_nocopy(i->second->get_state());
} }
@ -260,8 +262,11 @@ RCConfiguration::set_state (const XMLNode& root, int /*version*/)
MIDI::Port::Descriptor desc (*node); MIDI::Port::Descriptor desc (*node);
map<string,XMLNode>::iterator x; map<string,XMLNode>::iterator x;
if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) { if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
midi_ports.erase (x); warning << string_compose (_("Duplicate MIDI port definition found (tag=\"%1\") - ignored"),
desc.tag) << endmsg;
continue;
} }
midi_ports.insert (pair<string,XMLNode>(desc.tag,*node)); midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
} }

View file

@ -4444,3 +4444,21 @@ Session::route_group_changed ()
{ {
RouteGroupChanged (); /* EMIT SIGNAL */ RouteGroupChanged (); /* EMIT SIGNAL */
} }
vector<SyncSource>
Session::get_available_sync_options () const
{
vector<SyncSource> ret;
ret.push_back (JACK);
if (mtc_port()) {
ret.push_back (MTC);
}
if (midi_clock_port()) {
ret.push_back (MIDIClock);
}
return ret;
}

View file

@ -393,8 +393,8 @@ Session::process_event (Event* ev)
set_diskstream_speed (static_cast<Diskstream*> (ev->ptr), ev->speed); set_diskstream_speed (static_cast<Diskstream*> (ev->ptr), ev->speed);
break; break;
case Event::SetSlaveSource: case Event::SetSyncSource:
set_slave_source (ev->slave); use_sync_source (ev->sync_source);
break; break;
case Event::Audition: case Event::Audition:

View file

@ -85,10 +85,10 @@ Session::pre_export ()
/* no slaving */ /* no slaving */
post_export_slave = Config->get_slave_source (); post_export_sync = config.get_external_sync ();
post_export_position = _transport_frame; post_export_position = _transport_frame;
Config->set_slave_source (None); config.set_external_sync (false);
_exporting = true; _exporting = true;
export_status->running = true; export_status->running = true;
@ -244,8 +244,8 @@ Session::finalize_audio_export ()
/* restart slaving */ /* restart slaving */
if (post_export_slave != None) { if (post_export_sync) {
Config->set_slave_source (post_export_slave); config.set_external_sync (true);
} else { } else {
locate (post_export_position, false, false, false); locate (post_export_position, false, false, false);
} }

View file

@ -141,6 +141,8 @@ Session::set_mtc_port (string port_tag)
ms->rebind (*port); ms->rebind (*port);
} }
cerr << "!!SPT to " << port_tag << endl;
Config->set_mtc_port_name (port_tag); Config->set_mtc_port_name (port_tag);
out: out:
@ -494,7 +496,7 @@ Session::setup_midi_control ()
void void
Session::spp_start (Parser &, nframes_t /*timestamp*/) Session::spp_start (Parser &, nframes_t /*timestamp*/)
{ {
if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) { if (Config->get_mmc_control() && (config.get_external_sync() && config.get_sync_source() != MTC)) {
request_transport_speed (1.0); request_transport_speed (1.0);
} }
} }
@ -516,7 +518,7 @@ Session::spp_stop (Parser&, nframes_t /*timestamp*/)
void void
Session::midi_clock_start (Parser& ignored, nframes_t timestamp) Session::midi_clock_start (Parser& ignored, nframes_t timestamp)
{ {
if (Config->get_slave_source() == MIDIClock) { if (config.get_external_sync() && (config.get_sync_source() == MIDIClock)) {
request_transport_speed (1.0); request_transport_speed (1.0);
} }
} }
@ -530,7 +532,7 @@ Session::midi_clock_continue (Parser& parser, nframes_t timestamp)
void void
Session::midi_clock_stop (Parser& ignored, nframes_t timestamp) Session::midi_clock_stop (Parser& ignored, nframes_t timestamp)
{ {
if (Config->get_slave_source() == MIDIClock) { if (config.get_external_sync() && (config.get_slave_source() == MIDIClock)) {
request_stop (); request_stop ();
} }
} }
@ -539,7 +541,7 @@ Session::midi_clock_stop (Parser& ignored, nframes_t timestamp)
void void
Session::mmc_deferred_play (MIDI::MachineControl &/*mmc*/) Session::mmc_deferred_play (MIDI::MachineControl &/*mmc*/)
{ {
if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) { if (Config->get_mmc_control() && (config.get_external_sync() && (config.get_sync_source() != MTC))) {
request_transport_speed (1.0); request_transport_speed (1.0);
} }
} }

View file

@ -469,7 +469,7 @@ Session::transport_locked () const
{ {
Slave* sl = _slave; Slave* sl = _slave;
if (!locate_pending() && ((Config->get_slave_source() == None) || (sl && sl->ok() && sl->locked()))) { if (!locate_pending() && (!config.get_external_sync() || (sl && sl->ok() && sl->locked()))) {
return true; return true;
} }
@ -487,7 +487,7 @@ Session::follow_slave (nframes_t nframes)
if (!_slave->ok()) { if (!_slave->ok()) {
stop_transport (); stop_transport ();
Config->set_slave_source (None); config.set_external_sync (false);
goto noroll; goto noroll;
} }

View file

@ -215,6 +215,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
destructive_index = 0; destructive_index = 0;
first_file_data_format_reset = true; first_file_data_format_reset = true;
first_file_header_format_reset = true; first_file_header_format_reset = true;
post_export_sync = false;
//midi_thread = (pthread_t) 0; //midi_thread = (pthread_t) 0;
AudioDiskstream::allocate_working_buffers(); AudioDiskstream::allocate_working_buffers();
@ -869,15 +870,7 @@ int
Session::load_options (const XMLNode& node) Session::load_options (const XMLNode& node)
{ {
LocaleGuard lg (X_("POSIX")); LocaleGuard lg (X_("POSIX"));
config.set_variables (node); config.set_variables (node);
/* now reset MIDI ports because the session can have its own
MIDI configuration.
*/
setup_midi ();
return 0; return 0;
} }
@ -3200,8 +3193,12 @@ Session::config_changed (std::string p, bool ours)
first_file_data_format_reset = false; first_file_data_format_reset = false;
} else if (p == "slave-source") { } else if (p == "external-sync") {
set_slave_source (Config->get_slave_source()); if (!config.get_external_sync()) {
drop_sync_source ();
} else {
use_sync_source (config.get_sync_source());
}
} else if (p == "remote-model") { } else if (p == "remote-model") {
set_remote_control_ids (); set_remote_control_ids ();
} else if (p == "denormal-model") { } else if (p == "denormal-model") {

View file

@ -79,9 +79,9 @@ Session::request_input_change_handling ()
} }
void void
Session::request_slave_source (SlaveSource src) Session::request_sync_source (SyncSource src)
{ {
Event* ev = new Event (Event::SetSlaveSource, Event::Add, Event::Immediate, 0, 0.0); Event* ev = new Event (Event::SetSyncSource, Event::Add, Event::Immediate, 0, 0.0);
bool seamless; bool seamless;
seamless = Config->get_seamless_loop (); seamless = Config->get_seamless_loop ();
@ -97,7 +97,7 @@ Session::request_slave_source (SlaveSource src)
/* save value of seamless from before the switch */ /* save value of seamless from before the switch */
_was_seamless = seamless; _was_seamless = seamless;
ev->slave = src; ev->sync_source = src;
queue_event (ev); queue_event (ev);
} }
@ -230,7 +230,7 @@ Session::realtime_stop (bool abort, bool clear_state)
waiting_for_sync_offset = true; waiting_for_sync_offset = true;
} }
transport_sub_state = ((Config->get_slave_source() == None && config.get_auto_return()) ? AutoReturning : 0); transport_sub_state = ((!config.get_external_sync()&& config.get_auto_return()) ? AutoReturning : 0);
} }
void void
@ -439,7 +439,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
} }
bool const auto_return_enabled = bool const auto_return_enabled =
(Config->get_slave_source() == None && config.get_auto_return()); (!config.get_external_sync() && config.get_auto_return());
if (auto_return_enabled || if (auto_return_enabled ||
(ptw & PostTransportLocate) || (ptw & PostTransportLocate) ||
@ -571,7 +571,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
/* and start it up again if relevant */ /* and start it up again if relevant */
if ((ptw & PostTransportLocate) && Config->get_slave_source() == None && pending_locate_roll) { if ((ptw & PostTransportLocate) && !config.get_external_sync() && pending_locate_roll) {
request_transport_speed (1.0); request_transport_speed (1.0);
pending_locate_roll = false; pending_locate_roll = false;
} }
@ -1106,7 +1106,7 @@ Session::post_transport ()
if (ptw & PostTransportLocate) { if (ptw & PostTransportLocate) {
if (((Config->get_slave_source() == None && (auto_play_legal && config.get_auto_play())) && !_exporting) || (ptw & PostTransportRoll)) { if (((!config.get_external_sync() && (auto_play_legal && config.get_auto_play())) && !_exporting) || (ptw & PostTransportRoll)) {
start_transport (); start_transport ();
} else { } else {
@ -1142,7 +1142,38 @@ Session::reset_rf_scale (nframes_t motion)
} }
void void
Session::set_slave_source (SlaveSource src) Session::drop_sync_source ()
{
bool non_rt_required = false;
if (_transport_speed) {
error << _("please stop the transport before adjusting slave settings") << endmsg;
return;
}
delete _slave;
_slave = 0;
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (!(*i)->hidden()) {
if ((*i)->realtime_set_speed ((*i)->speed(), true)) {
non_rt_required = true;
}
(*i)->set_slaved (0);
}
}
if (non_rt_required) {
add_post_transport_work (PostTransportSpeed);
_butler->schedule_transport_work ();
}
set_dirty();
}
void
Session::use_sync_source (SyncSource src)
{ {
bool reverse = false; bool reverse = false;
bool non_rt_required = false; bool non_rt_required = false;
@ -1152,22 +1183,10 @@ Session::set_slave_source (SlaveSource src)
return; return;
} }
// if (src == JACK && Config->get_jack_time_master()) {
// return;
// }
delete _slave; delete _slave;
_slave = 0; _slave = 0;
if (_transport_speed < 0.0) {
reverse = true;
}
switch (src) { switch (src) {
case None:
stop_transport ();
break;
case MTC: case MTC:
if (_mtc_port) { if (_mtc_port) {
try { try {
@ -1206,8 +1225,6 @@ Session::set_slave_source (SlaveSource src)
}; };
Config->set_slave_source (src);
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
if (!(*i)->hidden()) { if (!(*i)->hidden()) {

View file

@ -331,14 +331,10 @@ edit_mode_to_string (EditMode mode)
} }
} }
SlaveSource SyncSource
string_to_slave_source (string str) string_to_sync_source (string str)
{ {
if (str == _("Internal")) { if (str == _("MIDI Timecode")) {
return None;
}
if (str == _("MTC")) {
return MTC; return MTC;
} }
@ -350,29 +346,26 @@ string_to_slave_source (string str)
return JACK; return JACK;
} }
fatal << string_compose (_("programming error: unknown slave source string \"%1\""), str) << endmsg; fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
/*NOTREACHED*/ /*NOTREACHED*/
return None; return JACK;
} }
const char* const char*
slave_source_to_string (SlaveSource src) sync_source_to_string (SyncSource src)
{ {
switch (src) { switch (src) {
case JACK: case JACK:
return _("JACK"); return _("JACK");
case MTC: case MTC:
return _("MTC"); return _("MIDI Timecode");
case MIDIClock: case MIDIClock:
return _("MIDI Clock"); return _("MIDI Clock");
default:
case None:
return _("Internal");
} }
/* GRRRR .... stupid, stupid gcc - you can't get here from there, all enum values are handled */
return _("JACK");
} }
float float

View file

@ -110,6 +110,12 @@ PortFactory::ignore_duplicate_devices (Port::Type type)
break; break;
#endif // WITH_ALSA #endif // WITH_ALSA
#ifdef WITH_JACK_MIDI
case Port::JACK_Midi:
ret = true;
break;
#endif // WITH_JACK_MIDI
#if WITH_COREMIDI #if WITH_COREMIDI
case Port::CoreMidi_MidiPort: case Port::CoreMidi_MidiPort:
ret = true; ret = true;

View file

@ -70,12 +70,6 @@ Manager::add_port (const XMLNode& node)
PortMap::iterator existing; PortMap::iterator existing;
pair<string, Port *> newpair; pair<string, Port *> newpair;
/* do not allow multiple ports with the same tag. if attempted, just return the existing
port with the same tag. XXX this is really caused by the mess of setup_midi() being
called twice in Ardour, once in the global init() function and once after the user RC file
has been loaded (there may be extra ports in it).
*/
if ((existing = ports_by_tag.find (desc.tag)) != ports_by_tag.end()) { if ((existing = ports_by_tag.find (desc.tag)) != ports_by_tag.end()) {
port = (*existing).second; port = (*existing).second;
@ -151,6 +145,7 @@ Manager::add_port (const XMLNode& node)
port = factory.create_port (node, api_data); port = factory.create_port (node, api_data);
if (port == 0) { if (port == 0) {
return 0; return 0;
} }

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import autowaf import autowaf
import os import os
import sys
# Version of this package (even if built as a child) # Version of this package (even if built as a child)
MAJOR = '2' MAJOR = '2'
@ -36,10 +37,6 @@ def configure(conf):
autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML') autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0') autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
# TODO
conf.env['SYSMIDI'] = 'JACK MIDI'
conf.env.append_value('CXXFLAGS', '-DWITH_JACK_MIDI')
# Boost headers # Boost headers
autowaf.check_header(conf, 'boost/shared_ptr.hpp') autowaf.check_header(conf, 'boost/shared_ptr.hpp')
autowaf.check_header(conf, 'boost/weak_ptr.hpp') autowaf.check_header(conf, 'boost/weak_ptr.hpp')
@ -61,12 +58,17 @@ def build(bld):
mtc.cc mtc.cc
version.cc version.cc
''' '''
if bld.env['SYSMIDI'] == 'JACK MIDI': # everybody loves JACK
obj.source += ' jack_midiport.cc ' obj.source += ' jack_midiport.cc '
elif bld.env['SYSMIDI'] == 'Alsa Sequencer': obj.cxxflags = [ '-DWITH_JACK_MIDI' ]
obj.source += ' alsa_sequencer_midiport.cc ' if sys.platform == 'darwin':
elif bld.env['SYSMIDI'] == 'CoreMIDI': # OS X
obj.source += ' coremidi_midiport.cc ' obj.source += ' coremidi_midiport.cc '
obj.cxxflags += [ '-DWITH_COREMIDI' ]
else :
# linux
obj.source += ' alsa_sequencer_midiport.cc '
obj.cxxflags += [ '-DWITH_ALSA' ]
obj.export_incdirs = ['.'] obj.export_incdirs = ['.']
obj.includes = ['.'] obj.includes = ['.']
obj.name = 'libmidipp' obj.name = 'libmidipp'

11
wscript
View file

@ -530,6 +530,17 @@ def build(bld):
for i in children: for i in children:
bld.add_subdirs(i) bld.add_subdirs(i)
# ideally, we'd like to use the OS-provided MIDI API
# for default ports. that doesn't work on at least
# Fedora (Nov 9th, 2009) so use JACK MIDI on linux.
if sys.platform == 'darwin':
rc_subst_dict = {
'MIDITAG' : 'control',
'MIDITYPE' : 'coremidi',
'JACK_INPUT' : 'auditioner'
}
else:
rc_subst_dict = { rc_subst_dict = {
'MIDITAG' : 'control', 'MIDITAG' : 'control',
'MIDITYPE' : 'jack', 'MIDITYPE' : 'jack',