Merge branch 'master' into windows+cc

Conflicts (hopefully resolved):
	gtk2_ardour/ardour_ui.cc
	gtk2_ardour/ardour_ui.h
	gtk2_ardour/ardour_ui_options.cc
This commit is contained in:
John Emmas 2013-10-06 11:56:03 +01:00
commit 300b484cf6
54 changed files with 2274 additions and 1923 deletions

View file

@ -113,6 +113,7 @@ typedef uint64_t microseconds_t;
#include "rc_option_editor.h"
#include "route_time_axis.h"
#include "route_params_ui.h"
#include "session_dialog.h"
#include "session_metadata_dialog.h"
#include "session_option_editor.h"
#include "shuttle_control.h"
@ -160,7 +161,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
/* start of private members */
, _startup (0)
, nsm (0)
, _was_dirty (false)
, _mixer_on_top (false)
@ -195,6 +195,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, about (X_("about"), _("About"))
, location_ui (X_("locations"), _("Locations"))
, route_params (X_("inspector"), _("Tracks and Busses"))
, audio_midi_setup (X_("audio-midi-setup"), _("Audio/MIDI Setup"))
, session_option_editor (X_("session-options-editor"), _("Properties"), boost::bind (&ARDOUR_UI::create_session_option_editor, this))
, add_video_dialog (X_("add-video"), _("Add Tracks/Busses"), boost::bind (&ARDOUR_UI::create_add_video_dialog, this))
, bundle_manager (X_("bundle-manager"), _("Bundle Manager"), boost::bind (&ARDOUR_UI::create_bundle_manager, this))
@ -206,7 +207,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, _status_bar_visibility (X_("status-bar"))
, _feedback_exists (false)
, _audio_midi_setup (0)
{
Gtkmm2ext::init(localedir);
@ -218,12 +218,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
ui_config = new UIConfiguration();
ui_config->ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
ui_config->map_parameters (pc);
_audio_midi_setup = new EngineControl;
editor = 0;
mixer = 0;
meterbridge = 0;
@ -357,6 +351,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
WM::Manager::instance().register_window (&add_route_dialog);
WM::Manager::instance().register_window (&add_video_dialog);
WM::Manager::instance().register_window (&route_params);
WM::Manager::instance().register_window (&audio_midi_setup);
WM::Manager::instance().register_window (&bundle_manager);
WM::Manager::instance().register_window (&location_ui);
WM::Manager::instance().register_window (&big_clock_window);
@ -413,56 +408,10 @@ ARDOUR_UI::engine_running ()
first_time_engine_run = false;
}
ActionManager::set_sensitive (ActionManager::engine_sensitive_actions, true);
ActionManager::set_sensitive (ActionManager::engine_opposite_sensitive_actions, false);
Glib::RefPtr<Action> action;
const char* action_name = 0;
switch (AudioEngine::instance()->samples_per_cycle()) {
case 32:
action_name = X_("JACKLatency32");
break;
case 64:
action_name = X_("JACKLatency64");
break;
case 128:
action_name = X_("JACKLatency128");
break;
case 512:
action_name = X_("JACKLatency512");
break;
case 1024:
action_name = X_("JACKLatency1024");
break;
case 2048:
action_name = X_("JACKLatency2048");
break;
case 4096:
action_name = X_("JACKLatency4096");
break;
case 8192:
action_name = X_("JACKLatency8192");
break;
default:
/* XXX can we do anything useful ? */
break;
}
if (action_name) {
action = ActionManager::get_action (X_("JACK"), action_name);
if (action) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action);
ract->set_active ();
}
update_disk_space ();
update_cpu_load ();
update_sample_rate (AudioEngine::instance()->sample_rate());
update_timecode_format ();
}
update_disk_space ();
update_cpu_load ();
update_sample_rate (AudioEngine::instance()->sample_rate());
update_timecode_format ();
}
void
@ -490,13 +439,13 @@ ARDOUR_UI::engine_halted (const char* reason, bool free_reason)
*/
if (strlen (reason)) {
msgstr = string_compose (_("The audio backend (JACK) was shutdown because:\n\n%1"), reason);
msgstr = string_compose (_("The audio backend was shutdown because:\n\n%1"), reason);
} else {
msgstr = string_compose (_("\
JACK has either been shutdown or it\n\
`The audio backend has either been shutdown or it\n\
disconnected %1 because %1\n\
was not fast enough. Try to restart\n\
JACK, reconnect and save the session."), PROGRAM_NAME);
the audio backend and save the session."), PROGRAM_NAME);
}
MessageDialog msg (*editor, msgstr);
@ -830,10 +779,33 @@ ARDOUR_UI::startup ()
delete nsm;
nsm = 0;
}
}
else if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) {
exit (1);
} else {
if (ArdourStartup::required()) {
ArdourStartup s;
s.present ();
main().run();
s.hide ();
switch (s.response ()) {
case Gtk::RESPONSE_REJECT:
exit (1);
default:
break;
}
}
/* we need to create this early because it may need to set the
* audio backend end up.
*/
audio_midi_setup.get (true);
/* go get a session */
if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) {
exit (1);
}
}
use_config ();
@ -1161,7 +1133,6 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
}
}
}
sample_rate_label.set_markup (buf);
}
@ -1865,7 +1836,7 @@ ARDOUR_UI::transport_roll ()
#if 0
if (_session->config.get_external_sync()) {
switch (Config->get_sync_source()) {
case JACK:
case Engine:
break;
default:
/* transport controlled by the master */
@ -1915,7 +1886,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
if (_session->config.get_external_sync()) {
switch (Config->get_sync_source()) {
case JACK:
case Engine:
break;
default:
/* transport controlled by the master */
@ -2487,7 +2458,7 @@ ARDOUR_UI::ask_about_loading_existing_session (const std::string& session_path)
}
int
ARDOUR_UI::build_session_from_nsd (const std::string& session_path, const std::string& session_name)
ARDOUR_UI::build_session_from_dialog (SessionDialog& sd, const std::string& session_path, const std::string& session_name)
{
BusProfile bus_profile;
@ -2503,13 +2474,13 @@ ARDOUR_UI::build_session_from_nsd (const std::string& session_path, const std::s
/* get settings from advanced section of NSD */
if (_startup->create_master_bus()) {
bus_profile.master_out_channels = (uint32_t) _startup->master_channel_count();
if (sd.create_master_bus()) {
bus_profile.master_out_channels = (uint32_t) sd.master_channel_count();
} else {
bus_profile.master_out_channels = 0;
}
if (_startup->connect_inputs()) {
if (sd.connect_inputs()) {
bus_profile.input_ac = AutoConnectPhysical;
} else {
bus_profile.input_ac = AutoConnectOption (0);
@ -2517,16 +2488,16 @@ ARDOUR_UI::build_session_from_nsd (const std::string& session_path, const std::s
bus_profile.output_ac = AutoConnectOption (0);
if (_startup->connect_outputs ()) {
if (_startup->connect_outs_to_master()) {
if (sd.connect_outputs ()) {
if (sd.connect_outs_to_master()) {
bus_profile.output_ac = AutoConnectMaster;
} else if (_startup->connect_outs_to_physical()) {
} else if (sd.connect_outs_to_physical()) {
bus_profile.output_ac = AutoConnectPhysical;
}
}
bus_profile.requested_physical_in = (uint32_t) _startup->input_limit_count();
bus_profile.requested_physical_out = (uint32_t) _startup->output_limit_count();
bus_profile.requested_physical_in = (uint32_t) sd.input_limit_count();
bus_profile.requested_physical_out = (uint32_t) sd.output_limit_count();
}
if (build_session (session_path, session_name, bus_profile)) {
@ -2562,6 +2533,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
string template_name;
int ret = -1;
bool likely_new = false;
bool cancel_not_quit;
/* deal with any existing DIRTY session now, rather than later. don't
* treat a non-dirty session this way, so that it stays visible
@ -2572,6 +2544,11 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
ARDOUR_UI::instance()->video_timeline->sync_session_state();
}
/* if there is already a session, relabel the button
on the SessionDialog so that we don't Quit directly
*/
cancel_not_quit = (_session != 0);
if (_session && _session->dirty()) {
if (unload_session (false)) {
/* unload cancelled by user */
@ -2585,6 +2562,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
template_name = load_template;
}
SessionDialog session_dialog (should_be_new, session_name, session_path, load_template, cancel_not_quit);
while (ret != 0) {
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
@ -2609,31 +2588,28 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
session_name = "";
}
delete _startup;
_startup = new ArdourStartup (should_be_new, session_name, session_path, load_template);
if (should_be_new || session_name.empty()) {
/* need the dialog to get info from user */
if (!_startup->ready_without_display()) {
_startup->present ();
main().run();
_startup->hide ();
}
switch (_startup->response()) {
case RESPONSE_OK:
break;
default:
if (quit_on_cancel) {
exit (1);
} else {
return ret;
switch (session_dialog.run()) {
case RESPONSE_ACCEPT:
break;
default:
if (quit_on_cancel) {
exit (1);
} else {
return ret;
}
}
session_dialog.hide ();
}
/* if we run the startup dialog again, offer more than just "new session" */
should_be_new = false;
session_name = _startup->session_name (likely_new);
session_name = session_dialog.session_name (likely_new);
if (nsm) {
likely_new = true;
@ -2651,8 +2627,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
continue;
}
if (_startup->use_session_template()) {
template_name = _startup->session_template_name();
if (session_dialog.use_session_template()) {
template_name = session_dialog.session_template_name();
_session_is_new = true;
}
@ -2669,12 +2645,12 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
session_path = _startup->session_folder();
session_path = session_dialog.session_folder();
char illegal = Session::session_name_is_legal (session_name);
if (illegal) {
MessageDialog msg (*_startup,
MessageDialog msg (session_dialog,
string_compose (_("To ensure compatibility with various systems\n"
"session names may not contain a '%1' character"),
illegal));
@ -2701,12 +2677,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else {
if (!likely_new) {
if (_startup) {
pop_back_splash (*_startup);
} else {
hide_splash ();
}
pop_back_splash (session_dialog);
MessageDialog msg (string_compose (_("There is no existing session at \"%1\""), session_path));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
@ -2715,8 +2686,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
char illegal = Session::session_name_is_legal(session_name);
if (illegal) {
pop_back_splash (*_startup);
MessageDialog msg (*_startup, string_compose(_("To ensure compatibility with various systems\n"
pop_back_splash (session_dialog);
MessageDialog msg (session_dialog, string_compose(_("To ensure compatibility with various systems\n"
"session names may not contain a '%1' character"), illegal));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
@ -2728,7 +2699,9 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
if (likely_new && template_name.empty()) {
ret = build_session_from_nsd (session_path, session_name);
cerr << "building a session from dialog\n";
ret = build_session_from_dialog (session_dialog, session_path, session_name);
} else {
@ -2835,22 +2808,12 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
Gtk::MESSAGE_INFO,
BUTTONS_OK);
msg.set_keep_above (true);
msg.set_title (_("Loading Error"));
msg.set_secondary_text (_("Click the Refresh button to try again."));
msg.add_button (Stock::REFRESH, 1);
msg.set_position (Gtk::WIN_POS_CENTER);
pop_back_splash (msg);
msg.present ();
int response = msg.run ();
switch (response) {
case 1:
break;
default:
exit (1);
}
(void) msg.run ();
msg.hide ();
goto out;
@ -4141,41 +4104,14 @@ ARDOUR_UI::reset_route_peak_display (Route* route)
}
}
void
ARDOUR_UI::toggle_audio_midi_setup ()
{
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-audio-midi-setup"));
if (!act) {
return;
}
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active()) {
launch_audio_midi_setup ();
} else {
_audio_midi_setup->hide ();
}
}
void
ARDOUR_UI::launch_audio_midi_setup ()
{
if (!_audio_midi_setup) {
_audio_midi_setup = new EngineControl ();
}
_audio_midi_setup->present ();
}
int
ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate)
{
launch_audio_midi_setup ();
cerr << "Do AMS\n";
_audio_midi_setup->set_desired_sample_rate (desired_sample_rate);
audio_midi_setup->set_desired_sample_rate (desired_sample_rate);
switch (_audio_midi_setup->run()) {
switch (audio_midi_setup->run()) {
case Gtk::RESPONSE_OK:
return 0;
case Gtk::RESPONSE_APPLY:

View file

@ -93,7 +93,6 @@
class VideoTimeLine;
class SystemExec;
class ArdourStartup;
class ArdourKeyboard;
class AudioClock;
class ButtonJoiner;
@ -102,6 +101,10 @@ class EngineControl;
class MainClock;
class Mixer_UI;
class PublicEditor;
class RCOptionEditor;
class RouteParams_UI;
class SessionDialog;
class SessionOptionEditor;
class ShuttleControl;
class Splash;
class TimeInfoBox;
@ -153,7 +156,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
bool get_smart_mode () const;
int get_session_parameters (bool quit_on_cancel, bool should_be_new = false, std::string load_template = "");
int build_session_from_nsd (const std::string& session_name, const std::string& session_path);
int build_session_from_dialog (SessionDialog&, const std::string& session_name, const std::string& session_path);
bool ask_about_loading_existing_session (const std::string& session_path);
/// @return true if session was successfully unloaded.
@ -312,11 +315,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void toggle_session_options_window ();
private:
ArdourStartup* _startup;
Gtk::Tooltips _tooltips;
Gtk::Tooltips _tooltips;
NSM_Client *nsm;
bool _was_dirty;
bool _mixer_on_top;
bool _was_dirty;
bool _mixer_on_top;
bool first_time_engine_run;
void goto_editor_window ();
@ -603,6 +605,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
WM::Proxy<About> about;
WM::Proxy<LocationUIWindow> location_ui;
WM::Proxy<RouteParams_UI> route_params;
WM::Proxy<EngineControl> audio_midi_setup;
/* Windows/Dialogs that require a creator method */
@ -670,8 +673,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
int pending_state_dialog ();
int sr_mismatch_dialog (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
void set_engine_buffer_size (ARDOUR::pframes_t);
Gtk::MenuItem* jack_disconnect_item;
Gtk::MenuItem* jack_reconnect_item;
Gtk::Menu* jack_bufsize_menu;
@ -749,8 +750,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
std::string _announce_string;
void check_announcements ();
EngineControl* _audio_midi_setup;
void launch_audio_midi_setup ();
int do_audio_midi_setup (uint32_t);
};

View file

@ -197,7 +197,6 @@ ARDOUR_UI::install_actions ()
ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window));
ActionManager::register_action (common_actions, X_("toggle-editor-mixer"), _("Toggle Editor+Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer));
ActionManager::register_toggle_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge));
ActionManager::register_toggle_action (common_actions, X_("toggle-audio-midi-setup"), S_("Window|Audio/MIDI Setup"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_audio_midi_setup));
act = ActionManager::register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window));
ActionManager::session_sensitive_actions.push_back (act);
@ -396,60 +395,6 @@ ARDOUR_UI::install_actions ()
ActionManager::add_action_group (midi_actions);
}
void
ARDOUR_UI::set_engine_buffer_size (pframes_t nframes)
{
Glib::RefPtr<Action> action;
const char* action_name = 0;
switch (nframes) {
case 32:
action_name = X_("EngineLatency32");
break;
case 64:
action_name = X_("EngineLatency64");
break;
case 128:
action_name = X_("EngineLatency128");
break;
case 256:
action_name = X_("EngineLatency256");
break;
case 512:
action_name = X_("EngineLatency512");
break;
case 1024:
action_name = X_("EngineLatency1024");
break;
case 2048:
action_name = X_("EngineLatency2048");
break;
case 4096:
action_name = X_("EngineLatency4096");
break;
case 8192:
action_name = X_("EngineLatency8192");
break;
default:
/* XXX can we do anything useful ? */
break;
}
if (action_name) {
action = ActionManager::get_action (X_("JACK"), action_name);
if (action) {
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action);
if (ract && ract->get_active()) {
AudioEngine::instance()->request_buffer_size (nframes);
update_sample_rate (0);
}
}
}
}
void
ARDOUR_UI::build_menu_bar ()
{
@ -528,7 +473,7 @@ ARDOUR_UI::build_menu_bar ()
_status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space);
_status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true);
_status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true);
_status_bar_visibility.add (&sample_rate_label, X_("JACK"), _("JACK Sampling Rate and Latency"), true);
_status_bar_visibility.add (&sample_rate_label, X_("Audio"), _("Audio"), true);
_status_bar_visibility.add (&timecode_format_label, X_("TCFormat"), _("Timecode Format"), true);
_status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true);
@ -614,7 +559,7 @@ ARDOUR_UI::save_ardour_state ()
window_node->add_child_nocopy (*tearoff_node);
Config->add_extra_xml (*window_node);
Config->add_extra_xml (_audio_midi_setup->get_state());
Config->add_extra_xml (audio_midi_setup->get_state());
Config->save_state();

View file

@ -29,12 +29,6 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#ifdef HAVE_LIBLO
#include "ardour/osc.h"
#endif
#include "canvas/wave_view.h"
#include "audio_clock.h"
#include "ardour_ui.h"
#include "actions.h"
@ -62,7 +56,7 @@ ARDOUR_UI::toggle_external_sync()
{
if (_session) {
if (_session->config.get_video_pullup() != 0.0f) {
if (Config->get_sync_source() == JACK) {
if (Config->get_sync_source() == Engine) {
MessageDialog msg (
_("It is not possible to use JACK as the the sync source\n\
when the pull up/down setting is non-zero."));
@ -342,16 +336,6 @@ ARDOUR_UI::parameter_changed (std::string p)
ActionManager::map_some_state ("options", "SendMMC", &RCConfiguration::get_send_mmc);
} else if (p == "use-osc") {
#ifdef HAVE_LIBLO
if (Config->get_use_osc()) {
osc->start ();
} else {
osc->stop ();
}
#endif
} else if (p == "keep-tearoffs") {
ActionManager::map_some_state ("Common", "KeepTearoffs", &RCConfiguration::get_keep_tearoffs);
} else if (p == "mmc-control") {
@ -467,7 +451,7 @@ ARDOUR_UI::synchronize_sync_source_and_video_pullup ()
act->set_sensitive (true);
} else {
/* can't sync to JACK if video pullup != 0.0 */
if (Config->get_sync_source() == JACK) {
if (Config->get_sync_source() == Engine) {
act->set_sensitive (false);
} else {
act->set_sensitive (true);

View file

@ -996,7 +996,7 @@ AudioClock::set_slave_info ()
Slave* slave = _session->slave();
switch (sync_src) {
case JACK:
case Engine:
_left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
_right_layout->set_text ("");

View file

@ -2100,7 +2100,7 @@ Editor::transition_to_rolling (bool fwd)
if (_session->config.get_external_sync()) {
switch (Config->get_sync_source()) {
case JACK:
case Engine:
break;
default:
/* transport controlled by the master */

View file

@ -1115,7 +1115,7 @@ EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b)
switch (_sort_type) {
case ByName:
cmp = strcasecmp (region1->name().c_str(), region2->name().c_str());
cmp = g_strcasecmp (region1->name().c_str(), region2->name().c_str());
break;
case ByLength:
@ -1140,7 +1140,7 @@ EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b)
break;
case BySourceFileName:
cmp = strcasecmp (region1->source()->name().c_str(), region2->source()->name().c_str());
cmp = g_strcasecmp (region1->source()->name().c_str(), region2->source()->name().c_str());
break;
case BySourceFileLength:
@ -1153,9 +1153,9 @@ EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b)
case BySourceFileFS:
if (region1->source()->name() == region2->source()->name()) {
cmp = strcasecmp (region1->name().c_str(), region2->name().c_str());
cmp = g_strcasecmp (region1->name().c_str(), region2->name().c_str());
} else {
cmp = strcasecmp (region1->source()->name().c_str(), region2->source()->name().c_str());
cmp = g_strcasecmp (region1->source()->name().c_str(), region2->source()->name().c_str());
}
break;
}

View file

@ -48,6 +48,7 @@
#include "ardour_ui.h"
#include "engine_dialog.h"
#include "gui_thread.h"
#include "utils.h"
#include "i18n.h"
using namespace std;
@ -78,20 +79,147 @@ EngineControl::EngineControl ()
, aj_button (_("Start MIDI ALSA/JACK bridge"))
, ignore_changes (0)
, _desired_sample_rate (0)
, no_push (true)
, started_at_least_once (false)
{
if (!ARDOUR::AudioEngine::instance()->setup_required()) {
_have_control = false;
} else {
_have_control = true;
}
using namespace Notebook_Helpers;
vector<string> strings;
Label* label;
AttachOptions xopt = AttachOptions (FILL|EXPAND);
int row;
set_name (X_("AudioMIDISetup"));
build_notebook ();
/* the backend combo is the one thing that is ALWAYS visible
*/
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
for (vector<const ARDOUR::AudioBackendInfo*>::const_iterator b = backends.begin(); b != backends.end(); ++b) {
strings.push_back ((*b)->name);
}
set_popdown_strings (backend_combo, strings);
backend_combo.set_active_text (strings.front());
backend_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::backend_changed));
/* setup basic packing characteristics for the table used on the main
* tab of the notebook
*/
basic_packer.set_spacings (6);
basic_packer.set_border_width (12);
basic_packer.set_homogeneous (true);
/* pack it in */
basic_hbox.pack_start (basic_packer, false, false);
/* latency tab */
/* latency measurement tab */
lm_title.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("Latency Measurement Tool")));
row = 0;
lm_table.set_row_spacings (12);
lm_table.attach (lm_title, 0, 2, row, row+1, xopt, (AttachOptions) 0);
row++;
Gtk::Label* preamble;
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("<span weight=\"bold\">Turn down the volume on your hardware to a very low level.</span>"));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("Select two channels below and connect them using a cable or (less ideally) a speaker and microphone."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
label = manage (new Label (_("Output channel")));
lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
Gtk::Alignment* misc_align = manage (new Alignment (0.0, 0.5));
misc_align->add (lm_output_channel_combo);
lm_table.attach (*misc_align, 1, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
label = manage (new Label (_("Input channel")));
lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
misc_align = manage (new Alignment (0.0, 0.5));
misc_align->add (lm_input_channel_combo);
lm_table.attach (*misc_align, 1, 2, row, row+1, FILL, (AttachOptions) 0);
++row;
xopt = AttachOptions(0);
lm_measure_button.add (lm_start_stop_label);
lm_measure_button.signal_toggled().connect (sigc::mem_fun (*this, &EngineControl::latency_button_toggled));
lm_use_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::use_latency_button_clicked));
lm_use_button.set_sensitive (false);
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("Once the channels are connected, click the \"Measure latency\" button."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
lm_table.attach (lm_measure_button, 0, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
lm_table.attach (lm_results, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
++row;
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("When satisfied with the results, click the \"Use results\" button."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
lm_table.attach (lm_use_button, 0, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
lm_results.set_markup ("<i>No measurement results yet</i>");
lm_vbox.set_border_width (12);
lm_vbox.pack_start (lm_table, false, false);
/* pack it all up */
notebook.pages().push_back (TabElem (basic_vbox, _("Audio")));
notebook.pages().push_back (TabElem (midi_vbox, _("MIDI")));
notebook.pages().push_back (TabElem (lm_vbox, _("Latency")));
notebook.set_border_width (12);
notebook.set_tab_pos (POS_RIGHT);
notebook.show_all ();
notebook.set_name ("SettingsNotebook");
/* packup the notebook */
get_vbox()->set_border_width (12);
get_vbox()->pack_start (notebook);
/* need a special function to print "all available channels" when the
* channel counts hit zero.
*/
input_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &input_channels));
output_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &output_channels));
control_app_button.signal_clicked().connect (mem_fun (*this, &EngineControl::control_app_button_clicked));
manage_control_app_sensitivity ();
@ -103,12 +231,32 @@ EngineControl::EngineControl ()
XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
/* push a change as if we altered the backend */
ARDOUR::AudioEngine::instance()->Running.connect (running_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_running, this), gui_context());
ARDOUR::AudioEngine::instance()->Stopped.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
ARDOUR::AudioEngine::instance()->Halted.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
cerr << "AMS about to change backend\n";
backend_changed ();
if (audio_setup) {
set_state (*audio_setup);
}
/* Connect to signals */
driver_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::driver_changed));
sample_rate_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::sample_rate_changed));
buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::buffer_size_changed));
device_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::device_changed));
input_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
output_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
input_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
output_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
notebook.signal_switch_page().connect (sigc::mem_fun (*this, &EngineControl::on_switch_page));
no_push = false;
}
void
@ -139,36 +287,58 @@ EngineControl::on_response (int response_id)
void
EngineControl::build_notebook ()
{
Label* label;
AttachOptions xopt = AttachOptions (FILL|EXPAND);
/* clear the table */
Gtkmm2ext::container_clear (basic_vbox);
Gtkmm2ext::container_clear (basic_packer);
label = manage (left_aligned_label (_("Audio System:")));
basic_packer.attach (*label, 0, 1, 0, 1, xopt, (AttachOptions) 0);
basic_packer.attach (backend_combo, 1, 2, 0, 1, xopt, (AttachOptions) 0);
if (_have_control) {
build_full_control_notebook ();
} else {
build_no_control_notebook ();
}
basic_vbox.pack_start (basic_hbox, false, false);
if (_have_control) {
Gtk::HBox* hpacker = manage (new HBox);
hpacker->set_border_width (12);
hpacker->pack_start (control_app_button, false, false);
hpacker->show ();
control_app_button.show();
basic_vbox.pack_start (*hpacker);
}
basic_vbox.show_all ();
}
void
EngineControl::build_full_control_notebook ()
{
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
assert (backend);
using namespace Notebook_Helpers;
Label* label;
vector<string> strings;
int row = 0;
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
for (vector<const ARDOUR::AudioBackendInfo*>::const_iterator b = backends.begin(); b != backends.end(); ++b) {
strings.push_back ((*b)->name);
}
set_popdown_strings (backend_combo, strings);
backend_combo.set_active_text (strings.front());
basic_packer.set_spacings (6);
basic_packer.set_border_width (12);
basic_packer.set_homogeneous (true);
row = 0;
AttachOptions xopt = AttachOptions (FILL|EXPAND);
int row = 1; // row zero == backend combo
label = manage (left_aligned_label (_("Audio System:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
basic_packer.attach (backend_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
row++;
/* start packing it up */
label = manage (left_aligned_label (_("Driver:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
basic_packer.attach (driver_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
row++;
if (backend->requires_driver_selection()) {
label = manage (left_aligned_label (_("Driver:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
basic_packer.attach (driver_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
row++;
}
label = manage (left_aligned_label (_("Device:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
@ -236,126 +406,46 @@ EngineControl::build_notebook ()
basic_packer.attach (*label, 2, 3, row, row+1, xopt, (AttachOptions) 0);
++row;
basic_hbox.pack_start (basic_packer, false, false);
basic_vbox.pack_start (basic_hbox, false, false);
}
Gtk::HBox* hpacker = manage (new HBox);
hpacker->set_border_width (12);
hpacker->pack_start (control_app_button, false, false);
hpacker->show ();
control_app_button.show();
basic_vbox.pack_start (*hpacker);
void
EngineControl::build_no_control_notebook ()
{
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
assert (backend);
/* latency measurement tab */
using namespace Notebook_Helpers;
Label* label;
vector<string> strings;
AttachOptions xopt = AttachOptions (FILL|EXPAND);
int row = 1; // row zero == backend combo
const string msg = string_compose (_("The %1 audio backend was configured and started externally.\nThis limits your control over it."), backend->name());
lm_title.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("Latency Measurement Tool")));
row = 0;
lm_table.set_row_spacings (12);
lm_table.attach (lm_title, 0, 2, row, row+1, xopt, (AttachOptions) 0);
label = manage (new Label);
label->set_markup (string_compose ("<span weight=\"bold\" foreground=\"red\">%1</span>", msg));
basic_packer.attach (*label, 0, 2, row, row + 1, xopt, (AttachOptions) 0);
row++;
Gtk::Label* preamble;
if (backend->can_change_sample_rate_when_running()) {
label = manage (left_aligned_label (_("Sample rate:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
basic_packer.attach (sample_rate_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
row++;
}
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("<span weight=\"bold\">Turn down the volume on your hardware to a very low level.</span>"));
if (backend->can_change_buffer_size_when_running()) {
label = manage (left_aligned_label (_("Buffer size:")));
basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
basic_packer.attach (buffer_size_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
buffer_size_duration_label.set_alignment (0.0); /* left-align */
basic_packer.attach (buffer_size_duration_label, 2, 3, row, row+1, xopt, (AttachOptions) 0);
row++;
}
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
connect_disconnect_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::connect_disconnect_click));
basic_packer.attach (connect_disconnect_button, 0, 2, row, row+1, FILL, AttachOptions (0));
row++;
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("Select two channels below and connect them using a cable or (less ideally) a speaker and microphone."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
label = manage (new Label (_("Output channel")));
lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
Gtk::Alignment* misc_align = manage (new Alignment (0.0, 0.5));
misc_align->add (lm_output_channel_combo);
lm_table.attach (*misc_align, 1, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
label = manage (new Label (_("Input channel")));
lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
misc_align = manage (new Alignment (0.0, 0.5));
misc_align->add (lm_input_channel_combo);
lm_table.attach (*misc_align, 1, 2, row, row+1, FILL, (AttachOptions) 0);
++row;
xopt = AttachOptions(0);
lm_measure_button.add (lm_start_stop_label);
lm_measure_button.signal_toggled().connect (sigc::mem_fun (*this, &EngineControl::latency_button_toggled));
lm_use_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::use_latency_button_clicked));
lm_use_button.set_sensitive (false);
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("Once the channels are connected, click the \"Measure latency\" button."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
lm_table.attach (lm_measure_button, 0, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
lm_table.attach (lm_results, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
++row;
preamble = manage (new Label);
preamble->set_width_chars (60);
preamble->set_line_wrap (true);
preamble->set_markup (_("When satisfied with the results, click the \"Use results\" button."));
lm_table.attach (*preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
row++;
lm_table.attach (lm_use_button, 0, 2, row, row+1, xopt, (AttachOptions) 0);
++row;
lm_results.set_markup ("<i>No measurement results yet</i>");
lm_vbox.set_border_width (12);
lm_vbox.pack_start (lm_table, false, false);
/* pack it all up */
notebook.pages().push_back (TabElem (basic_vbox, _("Audio")));
notebook.pages().push_back (TabElem (midi_vbox, _("MIDI")));
notebook.pages().push_back (TabElem (lm_vbox, _("Latency")));
notebook.set_border_width (12);
notebook.set_tab_pos (POS_RIGHT);
notebook.show_all ();
notebook.set_name ("SettingsNotebook");
/* Connect to signals */
backend_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::backend_changed));
driver_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::driver_changed));
sample_rate_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::sample_rate_changed));
buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::buffer_size_changed));
device_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::device_changed));
input_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
output_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
input_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
output_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
input_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &input_channels));
output_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &output_channels));
notebook.signal_switch_page().connect (sigc::mem_fun (*this, &EngineControl::on_switch_page));
}
EngineControl::~EngineControl ()
@ -470,6 +560,11 @@ EngineControl::refresh_midi_display ()
}
}
void
EngineControl::update_sensitivity ()
{
}
void
EngineControl::backend_changed ()
{
@ -485,16 +580,29 @@ EngineControl::backend_changed ()
return;
}
_have_control = ARDOUR::AudioEngine::instance()->setup_required ();
build_notebook ();
setup_midi_tab_for_backend ();
if (backend->requires_driver_selection()) {
vector<string> drivers = backend->enumerate_drivers();
driver_combo.set_sensitive (true);
set_popdown_strings (driver_combo, drivers);
driver_combo.set_active_text (drivers.front());
driver_changed ();
if (!drivers.empty()) {
{
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
set_popdown_strings (driver_combo, drivers);
driver_combo.set_active_text (drivers.front());
}
driver_changed ();
}
} else {
driver_combo.set_sensitive (false);
/* this will change the device text which will cause a call to
* device changed which will set up parameters
*/
list_devices ();
}
@ -540,30 +648,30 @@ EngineControl::list_devices ()
available_devices.push_back (i->name);
}
ignore_changes++;
set_popdown_strings (device_combo, available_devices);
ignore_changes--;
if (!available_devices.empty()) {
sample_rate_combo.set_sensitive (true);
buffer_size_combo.set_sensitive (true);
input_latency.set_sensitive (true);
output_latency.set_sensitive (true);
input_channels.set_sensitive (true);
output_channels.set_sensitive (true);
/* changing the text in the combo will trigger device_changed()
which should populate the parameter controls
*/
update_sensitivity ();
{
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
set_popdown_strings (device_combo, available_devices);
device_combo.set_active_text (available_devices.front());
}
device_changed ();
ok_button->set_sensitive (true);
apply_button->set_sensitive (true);
device_combo.set_active_text (available_devices.front());
} else {
sample_rate_combo.set_sensitive (true);
buffer_size_combo.set_sensitive (true);
input_latency.set_sensitive (true);
output_latency.set_sensitive (true);
input_channels.set_sensitive (true);
output_channels.set_sensitive (true);
sample_rate_combo.set_sensitive (false);
buffer_size_combo.set_sensitive (false);
input_latency.set_sensitive (false);
output_latency.set_sensitive (false);
input_channels.set_sensitive (false);
output_channels.set_sensitive (false);
ok_button->set_sensitive (false);
apply_button->set_sensitive (false);
}
}
@ -595,59 +703,95 @@ EngineControl::device_changed ()
string device_name = device_combo.get_active_text ();
vector<string> s;
/* don't allow programmatic change to sample_rate_combo to cause a
recursive call to this method.
*/
{
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
ignore_changes++;
/* don't allow programmatic change to combos to cause a
recursive call to this method.
*/
/* sample rates */
/* sample rates */
string desired;
string desired;
vector<float> sr = backend->available_sample_rates (device_name);
for (vector<float>::const_iterator x = sr.begin(); x != sr.end(); ++x) {
s.push_back (rate_as_string (*x));
if (*x == _desired_sample_rate) {
desired = s.back();
}
}
vector<float> sr;
if (!s.empty()) {
set_popdown_strings (sample_rate_combo, s);
if (desired.empty()) {
sample_rate_combo.set_active_text (s.front());
if (_have_control) {
sr = backend->available_sample_rates (device_name);
} else {
sample_rate_combo.set_active_text (desired);
sr.push_back (8000.0f);
sr.push_back (16000.0f);
sr.push_back (32000.0f);
sr.push_back (44100.0f);
sr.push_back (48000.0f);
sr.push_back (88200.0f);
sr.push_back (96000.0f);
sr.push_back (192000.0f);
sr.push_back (384000.0f);
}
} else {
/* hmm ... how to tell the user about the fact that we have no
* available sample rates.
for (vector<float>::const_iterator x = sr.begin(); x != sr.end(); ++x) {
s.push_back (rate_as_string (*x));
if (*x == _desired_sample_rate) {
desired = s.back();
}
}
if (!s.empty()) {
sample_rate_combo.set_sensitive (true);
set_popdown_strings (sample_rate_combo, s);
if (desired.empty()) {
sample_rate_combo.set_active_text (s.front());
} else {
sample_rate_combo.set_active_text (desired);
}
} else {
sample_rate_combo.set_sensitive (false);
}
/* buffer sizes */
vector<uint32_t> bs;
if (_have_control) {
bs = backend->available_buffer_sizes(device_name);
} else if (backend->can_change_buffer_size_when_running()) {
bs.push_back (8);
bs.push_back (16);
bs.push_back (32);
bs.push_back (64);
bs.push_back (128);
bs.push_back (256);
bs.push_back (512);
bs.push_back (1024);
bs.push_back (2048);
bs.push_back (4096);
bs.push_back (8192);
}
s.clear ();
for (vector<uint32_t>::const_iterator x = bs.begin(); x != bs.end(); ++x) {
s.push_back (bufsize_as_string (*x));
}
if (!s.empty()) {
buffer_size_combo.set_sensitive (true);
set_popdown_strings (buffer_size_combo, s);
buffer_size_combo.set_active_text (s.front());
show_buffer_duration ();
} else {
buffer_size_combo.set_sensitive (false);
}
/* XXX theoretically need to set min + max channel counts here
*/
manage_control_app_sensitivity ();
}
vector<uint32_t> bs = backend->available_buffer_sizes(device_name);
s.clear ();
for (vector<uint32_t>::const_iterator x = bs.begin(); x != bs.end(); ++x) {
s.push_back (bufsize_as_string (*x));
}
if (!s.empty()) {
set_popdown_strings (buffer_size_combo, s);
buffer_size_combo.set_active_text (s.front());
show_buffer_duration ();
} else {
/* hmm ... how to tell the user about the fact that we have no
* available buffer sizes.
*/
}
manage_control_app_sensitivity ();
ignore_changes--;
/* pick up any saved state for this device */
maybe_display_saved_state ();
@ -657,18 +801,6 @@ EngineControl::device_changed ()
push_state_to_backend (false);
}
string
EngineControl::rate_as_string (float r)
{
char buf[32];
if (fmod (r, 1000.0f)) {
snprintf (buf, sizeof (buf), "%.1f kHz", r/1000.0);
} else {
snprintf (buf, sizeof (buf), "%.0f kHz", r/1000.0);
}
return buf;
}
string
EngineControl::bufsize_as_string (uint32_t sz)
{
@ -774,6 +906,10 @@ EngineControl::get_saved_state_for_currently_displayed_backend_and_device ()
EngineControl::State*
EngineControl::save_state ()
{
if (!_have_control) {
return 0;
}
bool existing = true;
State* state = get_saved_state_for_currently_displayed_backend_and_device ();
@ -808,10 +944,15 @@ EngineControl::store_state (State& state)
void
EngineControl::maybe_display_saved_state ()
{
if (!_have_control) {
return;
}
State* state = get_saved_state_for_currently_displayed_backend_and_device ();
if (state) {
ignore_changes++;
PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
if (!_desired_sample_rate) {
sample_rate_combo.set_active_text (rate_as_string (state->sample_rate));
}
@ -822,7 +963,6 @@ EngineControl::maybe_display_saved_state ()
show_buffer_duration ();
input_latency.set_value (state->input_latency);
output_latency.set_value (state->output_latency);
ignore_changes--;
}
}
@ -952,6 +1092,7 @@ EngineControl::set_state (const XMLNode& root)
/* now see if there was an active state and switch the setup to it */
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
if ((*i).active) {
ignore_changes++;
backend_combo.set_active_text ((*i).backend);
@ -971,6 +1112,10 @@ EngineControl::set_state (const XMLNode& root)
int
EngineControl::push_state_to_backend (bool start)
{
if (no_push) {
return 0;
}
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (!backend) {
@ -993,46 +1138,59 @@ EngineControl::push_state_to_backend (bool start)
if (_have_control) {
/* we can control the backend */
if (started_at_least_once) {
if (backend->requires_driver_selection()) {
if (get_driver() != backend->driver_name()) {
change_driver = true;
/* we can control the backend */
if (backend->requires_driver_selection()) {
if (get_driver() != backend->driver_name()) {
change_driver = true;
}
}
}
if (get_device_name() != backend->device_name()) {
if (get_device_name() != backend->device_name()) {
change_device = true;
}
if (get_rate() != backend->sample_rate()) {
change_rate = true;
}
if (get_buffer_size() != backend->buffer_size()) {
change_bufsize = true;
}
/* zero-requested channels means "all available" */
if (ichan == 0) {
ichan = backend->input_channels();
}
if (ochan == 0) {
ochan = backend->output_channels();
}
if (ichan != backend->input_channels()) {
change_channels = true;
}
if (ochan != backend->output_channels()) {
change_channels = true;
}
if (get_input_latency() != backend->systemic_input_latency() ||
get_output_latency() != backend->systemic_output_latency()) {
change_latency = true;
}
} else {
/* backend never started, so we have to force a group
of settings.
*/
change_driver = true;
change_device = true;
}
if (get_rate() != backend->sample_rate()) {
change_rate = true;
}
if (get_buffer_size() != backend->buffer_size()) {
change_bufsize = true;
}
/* zero-requested channels means "all available" */
if (ichan == 0) {
ichan = backend->input_channels();
}
if (ochan == 0) {
ochan = backend->output_channels();
}
if (ichan != backend->input_channels()) {
change_channels = true;
}
if (ochan != backend->output_channels()) {
change_channels = true;
}
if (get_input_latency() != backend->systemic_input_latency() ||
get_output_latency() != backend->systemic_output_latency()) {
change_latency = true;
}
@ -1175,27 +1333,29 @@ EngineControl::post_push ()
* necessary
*/
State* state = get_saved_state_for_currently_displayed_backend_and_device ();
if (_have_control) {
State* state = get_saved_state_for_currently_displayed_backend_and_device ();
if (!state) {
state = save_state ();
assert (state);
if (!state) {
state = save_state ();
assert (state);
}
/* all off */
for (StateList::iterator i = states.begin(); i != states.end(); ++i) {
(*i).active = false;
}
/* mark this one active (to be used next time the dialog is
* shown)
*/
state->active = true;
manage_control_app_sensitivity ();
}
/* all off */
for (StateList::iterator i = states.begin(); i != states.end(); ++i) {
(*i).active = false;
}
/* mark this one active (to be used next time the dialog is
* shown)
*/
state->active = true;
manage_control_app_sensitivity ();
/* schedule a redisplay of MIDI ports */
Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (*this, &EngineControl::refresh_midi_display), false), 1000);
@ -1482,3 +1642,42 @@ EngineControl::on_delete_event (GdkEventAny* ev)
return ArdourDialog::on_delete_event (ev);
}
void
EngineControl::engine_running ()
{
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
assert (backend);
buffer_size_combo.set_active_text (bufsize_as_string (backend->buffer_size()));
sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate()));
buffer_size_combo.set_sensitive (true);
sample_rate_combo.set_sensitive (true);
connect_disconnect_button.set_label (string_compose (_("Disconnect from %1"), backend->name()));
started_at_least_once = true;
}
void
EngineControl::engine_stopped ()
{
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
assert (backend);
buffer_size_combo.set_sensitive (false);
connect_disconnect_button.set_label (string_compose (_("Connect to %1"), backend->name()));
sample_rate_combo.set_sensitive (true);
buffer_size_combo.set_sensitive (true);
}
void
EngineControl::connect_disconnect_click()
{
if (ARDOUR::AudioEngine::instance()->running()) {
ARDOUR_UI::instance()->disconnect_from_engine ();
} else {
ARDOUR_UI::instance()->reconnect_to_engine ();
}
}

View file

@ -75,8 +75,11 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
Gtk::Adjustment ports_adjustment;
Gtk::SpinButton ports_spinner;
Gtk::Label have_control_text;
Gtk::Button control_app_button;
Gtk::Button connect_disconnect_button;
/* latency measurement */
Gtk::ComboBoxText lm_output_channel_combo;
@ -106,8 +109,8 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
uint32_t ignore_changes;
uint32_t _desired_sample_rate;
static bool engine_running ();
bool no_push;
bool started_at_least_once;
void driver_changed ();
void backend_changed ();
@ -119,7 +122,6 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void setup_midi_tab_for_jack ();
void refresh_midi_display ();
std::string rate_as_string (float);
std::string bufsize_as_string (uint32_t);
float get_rate() const;
@ -174,6 +176,8 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
static bool print_channel_count (Gtk::SpinButton*);
void build_notebook ();
void build_full_control_notebook ();
void build_no_control_notebook ();
void on_response (int);
void control_app_button_clicked ();
@ -181,6 +185,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void manage_control_app_sensitivity ();
int push_state_to_backend (bool start);
void post_push ();
void update_sensitivity ();
/* latency measurement */
void latency_button_toggled ();
@ -193,6 +198,13 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
void on_switch_page (GtkNotebookPage*, guint page_num);
bool on_delete_event (GdkEventAny*);
void engine_running ();
void engine_stopped ();
PBD::ScopedConnection running_connection;
PBD::ScopedConnection stopped_connection;
void connect_disconnect_click ();
};
#endif /* __gtk2_ardour_engine_dialog_h__ */

View file

@ -28,7 +28,6 @@
#include <fcntl.h>
#include <sigc++/bind.h>
#include <libgen.h>
#include <glib/gstdio.h>

View file

@ -33,9 +33,9 @@
#include <assert.h>
#include <string.h>
#include <strings.h>
#include <stdint.h>
#include <cairo/cairo.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@ -740,13 +740,13 @@ piano_keyboard_set_keyboard_layout(PianoKeyboard *pk, const char *layout)
{
assert(layout);
if (!strcasecmp(layout, "QWERTY")) {
if (!g_strcasecmp(layout, "QWERTY")) {
bind_keys_qwerty(pk);
} else if (!strcasecmp(layout, "QWERTZ")) {
} else if (!g_strcasecmp(layout, "QWERTZ")) {
bind_keys_qwertz(pk);
} else if (!strcasecmp(layout, "AZERTY")) {
} else if (!g_strcasecmp(layout, "AZERTY")) {
bind_keys_azerty(pk);
} else {

View file

@ -250,8 +250,6 @@ KeyEditor::populate ()
//kinda kludgy way to avoid displaying menu items as mappable
if ( parts[1] == _("Main_menu") )
continue;
if ( parts[1] == _("JACK") )
continue;
if ( parts[1] == _("redirectmenu") )
continue;
if ( parts[1] == _("Editor_menus") )

View file

@ -37,8 +37,6 @@
#include "pbd/boost_debug.h"
#endif
#include <jack/jack.h>
#include "ardour/revision.h"
#include "ardour/version.h"
#include "ardour/ardour.h"
@ -81,17 +79,10 @@ static const char* localedir = LOCALEDIR;
void
gui_jack_error ()
{
MessageDialog win (string_compose (_("%1 could not connect to JACK."), PROGRAM_NAME),
MessageDialog win (string_compose (_("%1 could not connect to the audio backend."), PROGRAM_NAME),
false,
Gtk::MESSAGE_INFO,
Gtk::BUTTONS_NONE);
win.set_secondary_text(string_compose (_("There are several possible reasons:\n\
\n\
1) JACK is not running.\n\
2) JACK is running as another user, perhaps root.\n\
3) There is already another client called \"%1\".\n\
\n\
Please consider the possibilities, and perhaps (re)start JACK."), PROGRAM_NAME));
win.add_button (Stock::QUIT, RESPONSE_CLOSE);
win.set_default_response (RESPONSE_CLOSE);

View file

@ -698,7 +698,7 @@ MixerStrip::output_press (GdkEventButton *ev)
{
using namespace Menu_Helpers;
if (!_session->engine().connected()) {
MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
MessageDialog msg (_("Not connected to audio engine - no I/O changes are possible"));
msg.run ();
return true;
}
@ -826,7 +826,7 @@ MixerStrip::input_press (GdkEventButton *ev)
citems.clear();
if (!_session->engine().connected()) {
MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
MessageDialog msg (_("Not connected to audio engine - no I/O changes are possible"));
msg.run ();
return true;
}

View file

@ -537,13 +537,13 @@ struct PluginMenuCompareByCreator {
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
int cmp;
cmp = strcasecmp (a->creator.c_str(), b->creator.c_str());
cmp = g_strcasecmp (a->creator.c_str(), b->creator.c_str());
if (cmp < 0) {
return true;
} else if (cmp == 0) {
/* same creator ... compare names */
if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
if (g_strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
return true;
}
}
@ -555,7 +555,7 @@ struct PluginMenuCompareByName {
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
int cmp;
cmp = strcasecmp (a->name.c_str(), b->name.c_str());
cmp = g_strcasecmp (a->name.c_str(), b->name.c_str());
if (cmp < 0) {
return true;
@ -573,13 +573,13 @@ struct PluginMenuCompareByCategory {
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
int cmp;
cmp = strcasecmp (a->category.c_str(), b->category.c_str());
cmp = g_strcasecmp (a->category.c_str(), b->category.c_str());
if (cmp < 0) {
return true;
} else if (cmp == 0) {
/* same category ... compare names */
if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
if (g_strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
return true;
}
}

View file

@ -2151,7 +2151,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
} else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
if (!_session->engine().connected()) {
MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
MessageDialog msg ( _("Not connected to audio engine - no I/O changes are possible"));
msg.run ();
return 0;
}

View file

@ -1146,7 +1146,7 @@ RCOptionEditor::RCOptionEditor ()
tsf = new BoolOption (
"seamless-loop",
_("Do seamless looping (not possible when slaved to MTC, JACK etc)"),
_("Do seamless looping (not possible when slaved to MTC, LTC etc)"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_seamless_loop),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_seamless_loop)
);
@ -1456,12 +1456,10 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (*_rc_config, &RCConfiguration::set_monitoring_model)
);
#ifndef __APPLE__
/* no JACK monitoring on CoreAudio */
if (AudioEngine::instance()->port_engine().can_monitor_input()) {
mm->add (HardwareMonitoring, _("via Audio Driver"));
}
#endif
mm->add (SoftwareMonitoring, _("ardour"));
mm->add (ExternalMonitoring, _("audio hardware"));

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,238 @@
/*
Copyright (C) 2010 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk2_ardour_session_dialog_h__
#define __gtk2_ardour_session_dialog_h__
#include <string>
#include <gdkmm/pixbuf.h>
#include <gtkmm/label.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/expander.h>
#include <gtkmm/box.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/filechooserbutton.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/table.h>
#include <gtkmm/frame.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/liststore.h>
#include <gtkmm/combobox.h>
#include "ardour/utils.h"
#include "ardour_dialog.h"
class EngineControl;
class SessionDialog : public ArdourDialog {
public:
SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
const std::string& template_name, bool cancel_not_quit);
~SessionDialog ();
std::string session_name (bool& should_be_new);
std::string session_folder ();
bool use_session_template();
std::string session_template_name();
// advanced session options
bool create_master_bus() const;
int master_channel_count() const;
bool connect_inputs() const;
bool limit_inputs_used_for_connection() const;
int input_limit_count() const;
bool connect_outputs() const;
bool limit_outputs_used_for_connection() const;
int output_limit_count() const;
bool connect_outs_to_master() const;
bool connect_outs_to_physical() const;
private:
bool new_only;
std::string _provided_session_name;
std::string _provided_session_path;
bool on_delete_event (GdkEventAny*);
Gtk::Button* cancel_button;
Gtk::Button* open_button;
Gtk::Button* back_button;
Gtk::Button* quit_button;
bool back_button_pressed (GdkEventButton*);
Gtk::Frame info_frame;
/* initial choice page */
void setup_initial_choice_box ();
Gtk::VBox ic_vbox;
Gtk::Button ic_new_session_button;
void new_session_button_clicked ();
/* recent sessions */
void setup_existing_session_page ();
struct RecentSessionsSorter {
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
return cmp_nocase(a.first, b.first) == -1;
}
};
struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
RecentSessionModelColumns() {
add (visible_name);
add (tip);
add (fullpath);
add (sample_rate);
add (disk_format);
}
Gtk::TreeModelColumn<std::string> visible_name;
Gtk::TreeModelColumn<std::string> tip;
Gtk::TreeModelColumn<std::string> fullpath;
Gtk::TreeModelColumn<std::string> sample_rate;
Gtk::TreeModelColumn<std::string> disk_format;
};
RecentSessionModelColumns recent_session_columns;
Gtk::TreeView recent_session_display;
Glib::RefPtr<Gtk::TreeStore> recent_session_model;
Gtk::ScrolledWindow recent_scroller;
Gtk::Label recent_label;
Gtk::FileChooserButton existing_session_chooser;
int redisplay_recent_sessions ();
void recent_session_row_selected ();
void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
void existing_session_selected ();
void session_selected ();
/* new sessions */
void setup_new_session_page ();
Gtk::Entry new_name_entry;
Gtk::FileChooserButton new_folder_chooser;
struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
SessionTemplateColumns () {
add (name);
add (path);
}
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<std::string> path;
};
SessionTemplateColumns session_template_columns;
Glib::RefPtr<Gtk::ListStore> template_model;
Gtk::ComboBox template_chooser;
Gtk::VBox session_new_vbox;
Gtk::VBox session_existing_vbox;
Gtk::Expander more_new_session_options_button;
Gtk::CheckButton use_template_button;
std::string load_template_override;
void more_new_session_options_button_clicked();
void new_name_changed ();
void new_name_activated ();
void populate_session_templates ();
/* more options for new sessions */
Gtk::VBox more_options_vbox;
Gtk::Label chan_count_label_1;
Gtk::Label chan_count_label_3;
Gtk::Label chan_count_label_4;
Gtk::Table advanced_table;
Gtk::HBox input_port_limit_hbox;
Gtk::VBox input_port_vbox;
Gtk::Table input_table;
Gtk::HBox input_hbox;
Gtk::Label bus_label;
Gtk::Frame bus_frame;
Gtk::Table bus_table;
Gtk::HBox bus_hbox;
Gtk::Label input_label;
Gtk::Frame input_frame;
Gtk::HBox output_port_limit_hbox;
Gtk::VBox output_port_vbox;
Gtk::VBox output_conn_vbox;
Gtk::VBox output_vbox;
Gtk::HBox output_hbox;
Gtk::Label output_label;
Gtk::Frame output_frame;
Gtk::VBox advanced_vbox;
Gtk::Label advanced_label;
Gtk::CheckButton _create_master_bus;
Gtk::SpinButton _master_bus_channel_count;
Gtk::CheckButton _connect_inputs;
Gtk::CheckButton _limit_input_ports;
Gtk::SpinButton _input_limit_count;
Gtk::CheckButton _connect_outputs;
Gtk::CheckButton _limit_output_ports;
Gtk::SpinButton _output_limit_count;
Gtk::RadioButtonGroup connect_outputs_group;
Gtk::RadioButton _connect_outputs_to_master;
Gtk::RadioButton _connect_outputs_to_physical;
Gtk::Adjustment _output_limit_count_adj;
Gtk::Adjustment _input_limit_count_adj;
Gtk::Adjustment _master_bus_channel_count_adj;
void connect_inputs_clicked ();
void connect_outputs_clicked ();
void limit_inputs_clicked ();
void limit_outputs_clicked ();
void master_bus_button_clicked ();
void setup_more_options_box ();
/* always there */
Glib::RefPtr<Pango::Layout> layout;
bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
Gtk::Label info_scroller_label;
std::string::size_type info_scroller_count;
bool info_scroller_update();
sigc::connection info_scroller_connection;
void updates_button_clicked ();
};
#endif /* __gtk2_ardour_session_dialog_h__ */

View file

@ -334,7 +334,7 @@ SessionOptionEditor::parameter_changed (std::string const & p)
{
OptionEditor::parameter_changed (p);
if (p == "external-sync") {
if (Config->get_sync_source() == JACK) {
if (Config->get_sync_source() == Engine) {
_vpu->set_sensitive(!_session_config->get_external_sync());
} else {
_vpu->set_sensitive(true);

View file

@ -26,8 +26,8 @@
#include <sstream>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <gtkmm/box.h>
#include <gtkmm/stock.h>
@ -1473,7 +1473,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths
for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
char tmpc[MAXPATHLEN+1];
char tmpc[PATH_MAX+1];
snprintf (tmpc, sizeof(tmpc), "%s/%s", tmpdir.c_str(), Glib::path_get_basename (*i).c_str());

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,7 @@
#include <gtkmm/assistant.h>
#include <gtkmm/label.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/expander.h>
#include <gtkmm/box.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/filechooserbutton.h>
@ -45,32 +46,10 @@ class EngineControl;
class ArdourStartup : public Gtk::Assistant {
public:
ArdourStartup (bool require_new, const std::string& session_name, const std::string& session_path, const std::string& template_name);
ArdourStartup ();
~ArdourStartup ();
bool ready_without_display () const;
std::string session_name (bool& should_be_new);
std::string session_folder ();
bool use_session_template();
std::string session_template_name();
// advanced session options
bool create_master_bus() const;
int master_channel_count() const;
bool connect_inputs() const;
bool limit_inputs_used_for_connection() const;
int input_limit_count() const;
bool connect_outputs() const;
bool limit_outputs_used_for_connection() const;
int output_limit_count() const;
bool connect_outs_to_master() const;
bool connect_outs_to_physical() const;
static bool required ();
gint response () const {
return _response;
@ -80,17 +59,12 @@ class ArdourStartup : public Gtk::Assistant {
gint _response;
bool config_modified;
bool new_user;
bool need_session_info;
bool new_only;
std::string _provided_session_name;
std::string _provided_session_path;
std::string been_here_before_path () const;
static std::string been_here_before_path ();
void on_apply ();
void on_cancel ();
bool on_delete_event (GdkEventAny*);
void on_prepare (Gtk::Widget*);
static ArdourStartup *the_startup;
@ -108,15 +82,7 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::FileChooserButton* default_dir_chooser;
void default_dir_changed();
void setup_first_page ();
/* initial choice page */
void setup_initial_choice_page ();
Gtk::VBox ic_vbox;
Gtk::RadioButton ic_new_session_button;
Gtk::RadioButton ic_existing_session_button;
bool initial_button_clicked(GdkEventButton*);
void initial_button_activated();
Gtk::FileChooserButton new_folder_chooser;
/* monitoring choices */
@ -134,134 +100,6 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::RadioButton no_monitor_section_button;
void setup_monitor_section_choice_page ();
/* session page (could be new or existing) */
void setup_session_page ();
Gtk::VBox session_vbox;
Gtk::HBox session_hbox;
/* recent sessions */
void setup_existing_session_page ();
struct RecentSessionsSorter {
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
return cmp_nocase(a.first, b.first) == -1;
}
};
struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
RecentSessionModelColumns() {
add (visible_name);
add (tip);
add (fullpath);
}
Gtk::TreeModelColumn<std::string> visible_name;
Gtk::TreeModelColumn<std::string> tip;
Gtk::TreeModelColumn<std::string> fullpath;
};
RecentSessionModelColumns recent_session_columns;
Gtk::TreeView recent_session_display;
Glib::RefPtr<Gtk::TreeStore> recent_session_model;
Gtk::ScrolledWindow recent_scroller;
Gtk::FileChooserButton existing_session_chooser;
int redisplay_recent_sessions ();
void recent_session_row_selected ();
void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
void existing_session_selected ();
/* new sessions */
void setup_new_session_page ();
Gtk::Entry new_name_entry;
Gtk::FileChooserButton new_folder_chooser;
Gtk::FileChooserButton session_template_chooser;
struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
SessionTemplateColumns () {
add (name);
add (path);
}
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<std::string> path;
};
SessionTemplateColumns session_template_columns;
Glib::RefPtr<Gtk::ListStore> template_model;
Gtk::ComboBox template_chooser;
Gtk::VBox session_new_vbox;
Gtk::VBox session_existing_vbox;
Gtk::CheckButton more_new_session_options_button;
Gtk::RadioButtonGroup session_template_group;
Gtk::RadioButton use_session_as_template_button;
Gtk::RadioButton use_template_button;
std::string load_template_override;
void more_new_session_options_button_clicked();
void new_name_changed ();
void populate_session_templates ();
/* more options for new sessions */
Gtk::VBox more_options_vbox;
Gtk::Label chan_count_label_1;
Gtk::Label chan_count_label_3;
Gtk::Label chan_count_label_4;
Gtk::Table advanced_table;
Gtk::HBox input_port_limit_hbox;
Gtk::VBox input_port_vbox;
Gtk::Table input_table;
Gtk::HBox input_hbox;
Gtk::Label bus_label;
Gtk::Frame bus_frame;
Gtk::Table bus_table;
Gtk::HBox bus_hbox;
Gtk::Label input_label;
Gtk::Frame input_frame;
Gtk::HBox output_port_limit_hbox;
Gtk::VBox output_port_vbox;
Gtk::VBox output_conn_vbox;
Gtk::VBox output_vbox;
Gtk::HBox output_hbox;
Gtk::Label output_label;
Gtk::Frame output_frame;
Gtk::VBox advanced_vbox;
Gtk::Label advanced_label;
Gtk::CheckButton _create_master_bus;
Gtk::SpinButton _master_bus_channel_count;
Gtk::CheckButton _connect_inputs;
Gtk::CheckButton _limit_input_ports;
Gtk::SpinButton _input_limit_count;
Gtk::CheckButton _connect_outputs;
Gtk::CheckButton _limit_output_ports;
Gtk::SpinButton _output_limit_count;
Gtk::RadioButtonGroup connect_outputs_group;
Gtk::RadioButton _connect_outputs_to_master;
Gtk::RadioButton _connect_outputs_to_physical;
Gtk::Adjustment _output_limit_count_adj;
Gtk::Adjustment _input_limit_count_adj;
Gtk::Adjustment _master_bus_channel_count_adj;
void connect_inputs_clicked ();
void connect_outputs_clicked ();
void limit_inputs_clicked ();
void limit_outputs_clicked ();
void master_bus_button_clicked ();
void setup_more_options_page ();
/* final page */
void setup_final_page ();
@ -278,21 +116,12 @@ class ArdourStartup : public Gtk::Assistant {
gint default_folder_page_index;
gint monitoring_page_index;
gint monitor_section_page_index;
gint session_page_index;
gint initial_choice_index;
gint final_page_index;
gint session_options_page_index;
void move_along_now ();
bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
void setup_prerelease_page ();
Gtk::Label info_scroller_label;
std::string::size_type info_scroller_count;
bool info_scroller_update();
sigc::connection info_scroller_connection;
void updates_button_clicked ();
};
#endif /* __gtk2_ardour_startup_h__ */

View file

@ -28,7 +28,6 @@
#include <fcntl.h>
#include <sigc++/bind.h>
#include <libgen.h>
#include <glib/gstdio.h>

View file

@ -28,6 +28,7 @@
#include <clocale>
#include <cstring>
#include <cctype>
#include <cmath>
#include <fstream>
#include <list>
#include <sys/stat.h>
@ -843,3 +844,15 @@ unique_random_color (list<Gdk::Color>& used_colors)
/* XXX need throttle here to make sure we don't spin for ever */
}
}
string
rate_as_string (float r)
{
char buf[32];
if (fmod (r, 1000.0f)) {
snprintf (buf, sizeof (buf), "%.1f kHz", r/1000.0);
} else {
snprintf (buf, sizeof (buf), "%.0f kHz", r/1000.0);
}
return buf;
}

View file

@ -89,4 +89,6 @@ std::string escape_angled_brackets (std::string const &);
Gdk::Color unique_random_color (std::list<Gdk::Color> &);
std::string rate_as_string (float r);
#endif /* __ardour_gtk_utils_h__ */

View file

@ -554,7 +554,7 @@ VideoMonitor::xjadeo_sync_setup ()
bool my_manual_seek = true;
if (_session->config.get_external_sync()) {
if (ARDOUR::Config->get_sync_source() == ARDOUR::JACK)
if (ARDOUR::Config->get_sync_source() == ARDOUR::Engine)
my_manual_seek = false;
}

View file

@ -196,6 +196,7 @@ gtk2_ardour_sources = [
'search_path_option.cc',
'selection.cc',
'send_ui.cc',
'session_dialog.cc',
'session_import_dialog.cc',
'session_metadata_dialog.cc',
'session_option_editor.cc',

View file

@ -399,13 +399,25 @@ class AudioBackend : public PortEngine {
* stacksize. The thread will begin executing @param func, and will exit
* when that function returns.
*/
virtual int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize) = 0;
virtual int create_process_thread (boost::function<void()> func) = 0;
/** Wait for the thread specified by @param thread to exit.
/** Wait for all processing threads to exit.
*
* Return zero on success, non-zero on failure.
*/
virtual int wait_for_process_thread_exit (AudioBackendNativeThread thread) = 0;
virtual int join_process_threads () = 0;
/** Return true if execution context is in a backend thread
*/
virtual bool in_process_thread () = 0;
/** Return the minimum stack size of audio threads in bytes
*/
static size_t thread_stack_size () { return 100000; }
/** Return number of processing threads
*/
virtual uint32_t process_thread_count () = 0;
virtual void update_latencies () = 0;

View file

@ -100,8 +100,12 @@ public:
pframes_t sample_time_at_cycle_start ();
pframes_t samples_since_cycle_start ();
bool get_sync_offset (pframes_t& offset) const;
int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize);
int wait_for_process_thread_exit (AudioBackendNativeThread);
int create_process_thread (boost::function<void()> func);
int join_process_threads ();
bool in_process_thread ();
uint32_t process_thread_count ();
bool is_realtime() const;
bool connected() const;

View file

@ -31,8 +31,6 @@
#include <glib.h>
#include <cassert>
#include <pthread.h>
#include "pbd/semutils.h"
#include "ardour/types.h"
@ -59,8 +57,6 @@ class Graph : public SessionHandleRef
public:
Graph (Session & session);
uint32_t threads_in_use () const { return _thread_list.size(); }
void prep();
void trigger (GraphNode * n);
void rechain (boost::shared_ptr<RouteList>, GraphEdges const &);
@ -93,7 +89,6 @@ protected:
virtual void session_going_away ();
private:
std::list<AudioBackendNativeThread> _thread_list;
volatile bool _quit_threads;
void reset_thread_list ();

View file

@ -51,7 +51,7 @@ CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc-qf-speed-tolerance", 5)
CONFIG_VARIABLE (bool, timecode_sync_frame_rate, "timecode-sync-frame-rate", true)
CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
CONFIG_VARIABLE (bool, timecode_source_2997, "timecode-source-2997", false)
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", JACK)
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", Engine)
CONFIG_VARIABLE (std::string, ltc_source_port, "ltc-source-port", "system:capture_1")
CONFIG_VARIABLE (bool, send_ltc, "send-ltc", false)
CONFIG_VARIABLE (bool, ltc_send_continuously, "ltc-send-continuously", true)

View file

@ -161,6 +161,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
virtual ~Session ();
static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format);
std::string path() const { return _path; }
std::string name() const { return _name; }
std::string snap_name() const { return _current_snapshot_name; }
@ -509,7 +511,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
static PBD::Signal1<void, framepos_t> EndTimeChanged;
void request_sync_source (Slave*);
bool synced_to_jack() const { return config.get_external_sync() && Config->get_sync_source() == JACK; }
bool synced_to_engine() const { return config.get_external_sync() && Config->get_sync_source() == Engine; }
double transport_speed() const { return _transport_speed; }
bool transport_stopped() const { return _transport_speed == 0.0f; }
@ -1617,7 +1619,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void setup_ltc ();
void setup_click ();
void setup_click_state (const XMLNode&);
void setup_bundles ();
static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath);
};
} // namespace ARDOUR

View file

@ -486,11 +486,11 @@ class MIDIClock_Slave : public Slave {
bool _starting;
};
class JACK_Slave : public Slave
class Engine_Slave : public Slave
{
public:
JACK_Slave (AudioEngine&);
~JACK_Slave ();
Engine_Slave (AudioEngine&);
~Engine_Slave ();
bool speed_and_position (double& speed, framepos_t& pos);

View file

@ -489,7 +489,12 @@ namespace ARDOUR {
};
enum SyncSource {
JACK,
/* These are "synonyms". It is important for JACK to be first
both here and in enums.cc, so that the string "JACK" is
correctly recognized in older session and preference files.
*/
JACK = 0,
Engine = 0,
MTC,
MIDIClock,
LTC
@ -610,16 +615,6 @@ namespace ARDOUR {
uint32_t max; //< samples
};
/* PLATFORM SPECIFIC #ifdef's here */
/** Define the native thread type used on the platform */
typedef pthread_t AudioBackendNativeThread;
static inline bool self_thread_equal (AudioBackendNativeThread thr) {
return pthread_equal (thr, pthread_self());
}
/* PLATFORM SPECIFIC #endif's here */
} // namespace ARDOUR

View file

@ -824,21 +824,39 @@ AudioEngine::get_sync_offset (pframes_t& offset) const
}
int
AudioEngine::create_process_thread (boost::function<void()> func, AudioBackendNativeThread* thr, size_t stacksize)
AudioEngine::create_process_thread (boost::function<void()> func)
{
if (!_backend) {
return -1;
}
return _backend->create_process_thread (func, thr, stacksize);
return _backend->create_process_thread (func);
}
int
AudioEngine::wait_for_process_thread_exit (AudioBackendNativeThread thr)
AudioEngine::join_process_threads ()
{
if (!_backend) {
return -1;
}
return _backend->join_process_threads ();
}
bool
AudioEngine::in_process_thread ()
{
if (!_backend) {
return false;
}
return _backend->in_process_thread ();
}
uint32_t
AudioEngine::process_thread_count ()
{
if (!_backend) {
return 0;
}
return _backend->wait_for_process_thread_exit (thr);
return _backend->process_thread_count ();
}
int

View file

@ -26,7 +26,7 @@
using namespace std;
using namespace ARDOUR;
JACK_Slave::JACK_Slave (AudioEngine& e)
Engine_Slave::Engine_Slave (AudioEngine& e)
: engine (e)
{
double x;
@ -35,24 +35,24 @@ JACK_Slave::JACK_Slave (AudioEngine& e)
speed_and_position (x, p);
}
JACK_Slave::~JACK_Slave ()
Engine_Slave::~Engine_Slave ()
{
}
bool
JACK_Slave::locked() const
Engine_Slave::locked() const
{
return true;
}
bool
JACK_Slave::ok() const
Engine_Slave::ok() const
{
return true;
}
bool
JACK_Slave::speed_and_position (double& sp, framepos_t& position)
Engine_Slave::speed_and_position (double& sp, framepos_t& position)
{
switch (engine.transport_state()) {
case TransportStopped:

View file

@ -336,6 +336,7 @@ setup_enum_writer ()
REGISTER_ENUM (MTC);
REGISTER_ENUM (JACK);
REGISTER_ENUM (Engine);
REGISTER_ENUM (MIDIClock);
REGISTER_ENUM (LTC);
REGISTER (_SyncSource);

View file

@ -544,7 +544,11 @@ ARDOUR::get_available_sync_options ()
{
vector<SyncSource> ret;
ret.push_back (JACK);
boost::shared_ptr<AudioBackend> backend = AudioEngine::instance()->current_backend();
if (backend && backend->name() == "JACK") {
ret.push_back (Engine);
}
ret.push_back (MTC);
ret.push_back (MIDIClock);
ret.push_back (LTC);

View file

@ -97,29 +97,24 @@ Graph::reset_thread_list ()
number of threads.
*/
if (_thread_list.size() == num_threads) {
if (AudioEngine::instance()->process_thread_count() == num_threads) {
return;
}
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
AudioBackendNativeThread a_thread;
if (!_thread_list.empty()) {
if (AudioEngine::instance()->process_thread_count() != 0) {
drop_threads ();
}
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this), &a_thread, 100000) != 0) {
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) {
throw failed_constructor ();
}
_thread_list.push_back (a_thread);
for (uint32_t i = 1; i < num_threads; ++i) {
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this), &a_thread, 100000) != 0) {
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this))) {
throw failed_constructor ();
}
_thread_list.push_back (a_thread);
}
}
@ -141,17 +136,15 @@ Graph::drop_threads ()
{
_quit_threads = true;
for (unsigned int i=0; i< _thread_list.size(); i++) {
uint32_t thread_count = AudioEngine::instance()->process_thread_count ();
for (unsigned int i=0; i < thread_count; i++) {
_execution_sem.signal ();
}
_callback_start_sem.signal ();
for (list<AudioBackendNativeThread>::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) {
AudioEngine::instance()->wait_for_process_thread_exit (*i);
}
_thread_list.clear ();
AudioEngine::instance()->join_process_threads ();
_execution_tokens = 0;
@ -584,10 +577,5 @@ Graph::process_one_route (Route* route)
bool
Graph::in_process_thread () const
{
for (list<AudioBackendNativeThread>::const_iterator i = _thread_list.begin (); i != _thread_list.end(); ++i) {
if (self_thread_equal (*i)) {
return true;
}
}
return false;
return AudioEngine::instance()->in_process_thread ();
}

View file

@ -276,6 +276,21 @@ Session::Session (AudioEngine &eng,
throw failed_constructor ();
}
/* if a mix template was provided, then ::create() will
* have copied it into the session and we need to load it
* so that we have the state ready for ::set_state()
* after the engine is started.
*
* Note that we do NOT try to get the sample rate from
* the template at this time, though doing so would
* be easy if we decided this was an appropriate part
* of a template.
*/
if (!mix_template.empty() && load_state (_current_snapshot_name)) {
throw failed_constructor ();
}
} else {
if (load_state (_current_snapshot_name)) {
@ -393,7 +408,7 @@ Session::immediately_post_engine ()
_engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));
if (synced_to_jack()) {
if (synced_to_engine()) {
_engine.transport_stop ();
}
@ -577,14 +592,21 @@ Session::setup_ltc ()
void
Session::setup_click ()
{
XMLNode* child = 0;
_clicking = false;
_click_io.reset (new ClickIO (*this, "click"));
_click_gain.reset (new Amp (*this));
_click_gain->activate ();
if (state_tree) {
setup_click_state (*state_tree->root());
}
}
if (state_tree && (child = find_named_node (*state_tree->root(), "Click")) != 0) {
void
Session::setup_click_state (const XMLNode& node)
{
const XMLNode* child = 0;
if ((child = find_named_node (node, "Click")) != 0) {
/* existing state for Click */
int c = 0;
@ -1406,7 +1428,7 @@ Session::audible_frame () const
offset = current_block_size;
}
if (synced_to_jack()) {
if (synced_to_engine()) {
tf = _engine.transport_frame();
} else {
tf = _transport_frame;

View file

@ -494,9 +494,10 @@ Session::create (const string& session_template, BusProfile* bus_profile)
ifstream in(in_path.c_str());
if (in) {
string out_path = _path;
out_path += _name;
out_path += statefile_suffix;
/* no need to call legalize_for_path() since the string
* in session_template is already a legal path name
*/
string out_path = Glib::build_filename (_session_dir->root_path(), _name + statefile_suffix);
ofstream out(out_path.c_str());
@ -1317,13 +1318,7 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "Click")) == 0) {
warning << _("Session: XML state has no click section") << endmsg;
} else if (_click_io) {
const XMLNodeList& children (child->children());
XMLNodeList::const_iterator i = children.begin();
_click_io->set_state (**i, version);
++i;
if (i != children.end()) {
_click_gain->set_state (**i, version);
}
setup_click_state (node);
}
if ((child = find_named_node (node, ControlProtocolManager::state_node_name)) != 0) {
@ -3781,3 +3776,68 @@ Session::rename (const std::string& new_name)
#undef RENAME
}
int
Session::get_session_info_from_path (XMLTree& tree, const string& xmlpath)
{
if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
return -1;
}
if (!tree.read (xmlpath)) {
return -1;
}
return 0;
}
int
Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFormat& data_format)
{
XMLTree tree;
bool found_sr = false;
bool found_data_format = false;
if (get_session_info_from_path (tree, xmlpath)) {
return -1;
}
/* sample rate */
const XMLProperty* prop;
if ((prop = tree.root()->property (X_("sample-rate"))) != 0) {
sample_rate = atoi (prop->value());
found_sr = true;
}
const XMLNodeList& children (tree.root()->children());
for (XMLNodeList::const_iterator c = children.begin(); c != children.end(); ++c) {
const XMLNode* child = *c;
if (child->name() == "Config") {
const XMLNodeList& options (child->children());
for (XMLNodeList::const_iterator oc = options.begin(); oc != options.end(); ++oc) {
const XMLNode* option = *oc;
const XMLProperty* name = option->property("name");
if (!name) {
continue;
}
if (name->value() == "native-file-data-format") {
const XMLProperty* value = option->property ("value");
if (value) {
SampleFormat fmt = (SampleFormat) string_2_enum (option->property ("value")->value(), fmt);
data_format = fmt;
found_data_format = true;
break;
}
}
}
}
if (found_data_format) {
break;
}
}
return !(found_sr && found_data_format); // zero if they are both found
}

View file

@ -182,7 +182,7 @@ Session::timecode_time (Timecode::Time &t)
int
Session::backend_sync_callback (TransportState state, framepos_t pos)
{
bool slave = synced_to_jack();
bool slave = synced_to_engine();
switch (state) {
case TransportStopped:

View file

@ -86,7 +86,7 @@ Session::request_sync_source (Slave* new_slave)
seamless = Config->get_seamless_loop ();
if (dynamic_cast<JACK_Slave*>(new_slave)) {
if (dynamic_cast<Engine_Slave*>(new_slave)) {
/* JACK cannot support seamless looping at present */
Config->set_seamless_loop (false);
} else {
@ -514,13 +514,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
if (auto_return_enabled ||
(ptw & PostTransportLocate) ||
(_requested_return_frame >= 0) ||
synced_to_jack()) {
synced_to_engine()) {
if (pending_locate_flush) {
flush_all_inserts ();
}
if ((auto_return_enabled || synced_to_jack() || _requested_return_frame >= 0) &&
if ((auto_return_enabled || synced_to_engine() || _requested_return_frame >= 0) &&
!(ptw & PostTransportLocate)) {
/* no explicit locate queued */
@ -543,7 +543,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
/* don't try to handle loop play when synced to JACK */
if (!synced_to_jack()) {
if (!synced_to_engine()) {
Location *location = _locations->auto_loop_location();
@ -734,7 +734,7 @@ Session::set_play_loop (bool yn)
return;
}
if (yn && Config->get_seamless_loop() && synced_to_jack()) {
if (yn && Config->get_seamless_loop() && synced_to_engine()) {
warning << string_compose (
_("Seamless looping cannot be supported while %1 is using JACK transport.\n"
"Recommend changing the configured options"), PROGRAM_NAME)
@ -811,7 +811,7 @@ Session::flush_all_inserts ()
void
Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force)
{
if (synced_to_jack()) {
if (synced_to_engine()) {
double sp;
framepos_t pos;
@ -926,7 +926,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
bool transport_was_stopped = !transport_rolling();
if (transport_was_stopped && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) {
if (transport_was_stopped && (!auto_play_legal || !config.get_auto_play()) && !with_roll && !(synced_to_engine() && play_loop)) {
realtime_stop (false, true); // XXX paul - check if the 2nd arg is really correct
transport_was_stopped = true;
} else {
@ -1067,7 +1067,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
set_track_monitor_input_status (true);
}
if (synced_to_jack ()) {
if (synced_to_engine ()) {
if (clear_state) {
/* do this here because our response to the slave won't
take care of it.
@ -1090,7 +1090,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
set_track_monitor_input_status (false);
}
if (synced_to_jack()) {
if (synced_to_engine()) {
_engine.transport_start ();
} else {
start_transport ();
@ -1100,7 +1100,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
/* not zero, not 1.0 ... varispeed */
if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) {
if ((synced_to_engine()) && speed != 0.0 && speed != 1.0) {
warning << string_compose (
_("Global varispeed cannot be supported while %1 is connected to JACK transport control"),
PROGRAM_NAME)
@ -1429,8 +1429,8 @@ Session::switch_to_sync_source (SyncSource src)
}
break;
case JACK:
if (_slave && dynamic_cast<JACK_Slave*>(_slave)) {
case Engine:
if (_slave && dynamic_cast<Engine_Slave*>(_slave)) {
return;
}
@ -1438,7 +1438,7 @@ Session::switch_to_sync_source (SyncSource src)
return;
}
new_slave = new JACK_Slave (*AudioEngine::instance());
new_slave = new Engine_Slave (*AudioEngine::instance());
break;
default:
@ -1632,9 +1632,9 @@ bool
Session::maybe_stop (framepos_t limit)
{
if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
if (synced_to_jack () && config.get_jack_time_master ()) {
if (synced_to_engine () && config.get_jack_time_master ()) {
_engine.transport_stop ();
} else if (!synced_to_jack ()) {
} else if (!synced_to_engine ()) {
stop_transport ();
}
return true;

View file

@ -397,12 +397,12 @@ string_to_sync_source (string str)
}
if (str == _("JACK")) {
return JACK;
return Engine;
}
fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
/*NOTREACHED*/
return JACK;
return Engine;
}
/** @param sh Return a short version of the string */
@ -410,7 +410,10 @@ const char*
sync_source_to_string (SyncSource src, bool sh)
{
switch (src) {
case JACK:
case Engine:
/* no other backends offer sync for now ... deal with this if we
* ever have to.
*/
return _("JACK");
case MTC:

View file

@ -70,6 +70,7 @@ libardour_sources = [
'diskstream.cc',
'element_import_handler.cc',
'element_importer.cc',
'engine_slave.cc',
'enums.cc',
'event_type_map.cc',
'export_channel.cc',
@ -104,7 +105,6 @@ libardour_sources = [
'interpolation.cc',
'io.cc',
'io_processor.cc',
'jack_slave.cc',
'kmeterdsp.cc',
'ladspa_plugin.cc',
'ladspa_search_path.cc',
@ -347,7 +347,7 @@ def build(bld):
'AUDIOUNITS', 'OSX','BOOST','CURL','DL']
obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
'libvampplugin','libtaglib','librubberband',
'libaudiographer','libltc']
'libaudiographer','libltc','libtimecode']
obj.vnum = LIBARDOUR_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.defines = [

View file

@ -63,7 +63,7 @@ deinstantiate ()
static bool
already_configured ()
{
return JackConnection::server_running ();
return !JackConnection::in_control ();
}
static ARDOUR::AudioBackendInfo _descriptor = {

View file

@ -45,6 +45,7 @@ using namespace PBD;
using std::string;
using std::vector;
#define GET_PRIVATE_JACK_POINTER(localvar) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return; }
#define GET_PRIVATE_JACK_POINTER_RET(localvar,r) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return r; }
@ -513,7 +514,10 @@ JACKAudioBackend::start ()
{
if (!available()) {
if (!_jack_connection->server_running()) {
if (_jack_connection->in_control()) {
/* we will be starting JACK, so set up the
command that JACK will use when it (auto-)starts
*/
setup_jack_startup_command ();
}
@ -822,25 +826,72 @@ JACKAudioBackend::_latency_callback (jack_latency_callback_mode_t mode, void* ar
}
int
JACKAudioBackend::create_process_thread (boost::function<void()> f, pthread_t* thread, size_t stacksize)
JACKAudioBackend::create_process_thread (boost::function<void()> f)
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
ThreadData* td = new ThreadData (this, f, stacksize);
if (jack_client_create_thread (_priv_jack, thread, jack_client_real_time_priority (_priv_jack),
jack_native_thread_t thread_id;
ThreadData* td = new ThreadData (this, f, thread_stack_size());
if (jack_client_create_thread (_priv_jack, &thread_id, jack_client_real_time_priority (_priv_jack),
jack_is_realtime (_priv_jack), _start_process_thread, td)) {
return -1;
}
return 0;
_jack_threads.push_back(thread_id);
return 0;
}
int
JACKAudioBackend::wait_for_process_thread_exit (AudioBackendNativeThread thr)
JACKAudioBackend::join_process_threads ()
{
void* status;
/* this doesn't actively try to stop the thread, it just waits till it exits */
return pthread_join (thr, &status);
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
int ret = 0;
for (std::vector<jack_native_thread_t>::const_iterator i = _jack_threads.begin ();
i != _jack_threads.end(); i++) {
#if defined(USING_JACK2_EXPANSION_OF_JACK_API) || defined(PLATFORM_WINDOWS)
if (jack_client_stop_thread (_priv_jack, *i) != 0) {
#else
void* status;
if (pthread_join (*i, &status) != 0) {
#endif
error << "AudioEngine: cannot stop process thread" << endmsg;
ret += -1;
}
}
_jack_threads.clear();
return ret;
}
bool
JACKAudioBackend::in_process_thread ()
{
for (std::vector<jack_native_thread_t>::const_iterator i = _jack_threads.begin ();
i != _jack_threads.end(); i++) {
#ifdef COMPILER_MINGW
if (*i == GetCurrentThread()) {
return true;
}
#else // pthreads
if (pthread_equal (*i, pthread_self()) != 0) {
return true;
}
#endif
}
return false;
}
uint32_t
JACKAudioBackend::process_thread_count ()
{
return _jack_threads.size();
}
void*
@ -960,6 +1011,7 @@ JACKAudioBackend::disconnected (const char* why)
engine.halted_callback (why); /* EMIT SIGNAL */
}
}
float
JACKAudioBackend::cpu_load() const
{

View file

@ -103,8 +103,10 @@ class JACKAudioBackend : public AudioBackend {
size_t raw_buffer_size (DataType t);
int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize);
int wait_for_process_thread_exit (AudioBackendNativeThread);
int create_process_thread (boost::function<void()> func);
int join_process_threads ();
bool in_process_thread ();
uint32_t process_thread_count ();
void transport_start ();
void transport_stop ();
@ -184,6 +186,8 @@ class JACKAudioBackend : public AudioBackend {
bool _freewheeling;
std::map<DataType,size_t> _raw_buffer_sizes;
std::vector<jack_native_thread_t> _jack_threads;
static int _xrun_callback (void *arg);
static void* _process_thread (void *arg);
static int _sample_rate_callback (pframes_t nframes, void *arg);

View file

@ -36,6 +36,8 @@ using std::vector;
using std::cerr;
using std::endl;
bool JackConnection::_in_control = false;
static void jack_halted_callback (void* arg)
{
JackConnection* jc = static_cast<JackConnection*> (arg);
@ -54,17 +56,9 @@ JackConnection::JackConnection (const std::string& arg1, const std::string& arg2
, _client_name (arg1)
, session_uuid (arg2)
{
_in_control = !server_running();
}
/* See if the server is already up
*/
JackConnection::~JackConnection ()
{
close ();
}
bool
JackConnection::server_running ()
{
EnvironmentalProtectionAgency* global_epa = EnvironmentalProtectionAgency::get_global_epa ();
boost::scoped_ptr<EnvironmentalProtectionAgency> current_epa;
@ -83,10 +77,15 @@ JackConnection::server_running ()
if (status == 0) {
jack_client_close (c);
return true;
_in_control = false;
} else {
_in_control = true;
}
}
return false;
JackConnection::~JackConnection ()
{
close ();
}
int
@ -106,19 +105,6 @@ JackConnection::open ()
global_epa->restore ();
}
/* check to see if the server is already running so that we know if we
* are starting it.
*/
jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
if (status == 0) {
_in_control = false;
jack_client_close (c);
} else {
_in_control = true;
}
/* ensure that PATH or equivalent includes likely locations of the JACK
* server, in case the user's default does not.
*/

View file

@ -27,15 +27,13 @@ class JackConnection {
void halted_callback ();
void halted_info_callback (jack_status_t, const char*);
bool in_control() const { return _in_control; }
static bool server_running();
static bool in_control() { return _in_control; }
private:
jack_client_t* volatile _jack;
std::string _client_name;
std::string session_uuid;
bool _in_control;
static bool _in_control;
};
} // namespace

View file

@ -104,6 +104,12 @@ PBD::stacktrace (std::ostream& out, int levels)
#else
std::string
PBD::demangle (std::string const & l)
{
return string;
}
void
PBD::stacktrace (std::ostream& out, int /*levels*/)
{

View file

@ -58,7 +58,7 @@ def fetch_gcc_version (CC):
return version
def fetch_git_revision ():
cmd = "LANG= git describe --tags HEAD"
cmd = "git describe --tags HEAD"
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
rev = output[0].decode('utf-8')
return rev