move engine dialog from a widget to an actual dialog; emit Session::AudioEngineSetupRequired when loading a session if it is necessary
This commit is contained in:
parent
cd6a9cfe38
commit
56465fda10
|
@ -495,27 +495,27 @@
|
|||
<menuitem action='show-marker-lines'/>
|
||||
</menu>
|
||||
<menu name='JACK' action='JACK'>
|
||||
<menuitem action='JACKDisconnect'/>
|
||||
<menuitem action='JACKReconnect'/>
|
||||
<menuitem action='EngineDisconnect'/>
|
||||
<menuitem action='EngineReconnect'/>
|
||||
<menu name='Latency' action='Latency'>
|
||||
<menuitem action='JACKLatency32'/>
|
||||
<menuitem action='JACKLatency64'/>
|
||||
<menuitem action='JACKLatency128'/>
|
||||
<menuitem action='JACKLatency256'/>
|
||||
<menuitem action='JACKLatency512'/>
|
||||
<menuitem action='JACKLatency1024'/>
|
||||
<menuitem action='JACKLatency2048'/>
|
||||
<menuitem action='JACKLatency4096'/>
|
||||
<menuitem action='JACKLatency8192'/>
|
||||
<menuitem action='EngineLatency32'/>
|
||||
<menuitem action='EngineLatency64'/>
|
||||
<menuitem action='EngineLatency128'/>
|
||||
<menuitem action='EngineLatency256'/>
|
||||
<menuitem action='EngineLatency512'/>
|
||||
<menuitem action='EngineLatency1024'/>
|
||||
<menuitem action='EngineLatency2048'/>
|
||||
<menuitem action='EngineLatency4096'/>
|
||||
<menuitem action='EngineLatency8192'/>
|
||||
</menu>
|
||||
</menu>
|
||||
<menu action = 'WindowMenu'>
|
||||
<menuitem action='toggle-audio-midi-setup'/>
|
||||
<separator/>
|
||||
<menuitem action='toggle-mixer'/>
|
||||
<menuitem action='toggle-meterbridge'/>
|
||||
<menuitem action='toggle-editor-mixer'/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<menuitem action='toggle-inspector'/>
|
||||
<menuitem action='toggle-locations'/>
|
||||
<menuitem action='toggle-key-editor'/>
|
||||
|
|
|
@ -157,7 +157,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
/* start of private members */
|
||||
|
||||
, _startup (0)
|
||||
, engine (0)
|
||||
, nsm (0)
|
||||
, _was_dirty (false)
|
||||
, _mixer_on_top (false)
|
||||
|
@ -203,7 +202,7 @@ 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);
|
||||
|
||||
|
@ -220,7 +219,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
mixer = 0;
|
||||
meterbridge = 0;
|
||||
editor = 0;
|
||||
engine = 0;
|
||||
_session_is_new = false;
|
||||
session_selector_window = 0;
|
||||
last_key_press_time = 0;
|
||||
|
@ -268,6 +266,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
|
|||
|
||||
ARDOUR::Session::AskAboutPendingState.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::pending_state_dialog, this));
|
||||
|
||||
/* handle Audio/MIDI setup when session requires it */
|
||||
|
||||
ARDOUR::Session::AudioEngineSetupRequired.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::do_audio_midi_setup, this));
|
||||
|
||||
/* handle sr mismatch with a dialog (PROBLEM: needs to return a value and thus cannot be x-thread) */
|
||||
|
||||
ARDOUR::Session::AskAboutSampleRateMismatch.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::sr_mismatch_dialog, this, _1, _2));
|
||||
|
@ -382,13 +384,11 @@ ARDOUR_UI::create_global_port_matrix (ARDOUR::DataType type)
|
|||
void
|
||||
ARDOUR_UI::attach_to_engine ()
|
||||
{
|
||||
engine = AudioEngine::instance();
|
||||
AudioEngine::instance()->Stopped.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_stopped, this), gui_context());
|
||||
AudioEngine::instance()->Running.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_running, this), gui_context());
|
||||
AudioEngine::instance()->SampleRateChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context());
|
||||
|
||||
engine->Stopped.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_stopped, this), gui_context());
|
||||
engine->Running.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_running, this), gui_context());
|
||||
engine->SampleRateChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context());
|
||||
|
||||
engine->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
|
||||
AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
|
||||
|
||||
ARDOUR::Port::set_connecting_blocked (ARDOUR_COMMAND_LINE::no_connect_ports);
|
||||
|
||||
|
@ -427,7 +427,7 @@ ARDOUR_UI::engine_running ()
|
|||
Glib::RefPtr<Action> action;
|
||||
const char* action_name = 0;
|
||||
|
||||
switch (engine->samples_per_cycle()) {
|
||||
switch (AudioEngine::instance()->samples_per_cycle()) {
|
||||
case 32:
|
||||
action_name = X_("JACKLatency32");
|
||||
break;
|
||||
|
@ -468,7 +468,7 @@ ARDOUR_UI::engine_running ()
|
|||
|
||||
update_disk_space ();
|
||||
update_cpu_load ();
|
||||
update_sample_rate (engine->sample_rate());
|
||||
update_sample_rate (AudioEngine::instance()->sample_rate());
|
||||
update_timecode_format ();
|
||||
}
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ ARDOUR_UI::check_memory_locking ()
|
|||
|
||||
XMLNode* memory_warning_node = Config->instant_xml (X_("no-memory-warning"));
|
||||
|
||||
if (engine->is_realtime() && memory_warning_node == 0) {
|
||||
if (AudioEngine::instance()->is_realtime() && memory_warning_node == 0) {
|
||||
|
||||
struct rlimit limits;
|
||||
int64_t ram;
|
||||
|
@ -1010,7 +1010,7 @@ If you still wish to quit, please use the\n\n\
|
|||
}
|
||||
|
||||
halt_connection.disconnect ();
|
||||
engine->stop ();
|
||||
AudioEngine::instance()->stop ();
|
||||
quit ();
|
||||
}
|
||||
|
||||
|
@ -1139,13 +1139,13 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
|
|||
|
||||
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_sample_rate, ignored)
|
||||
|
||||
if (!engine->connected()) {
|
||||
if (!AudioEngine::instance()->connected()) {
|
||||
|
||||
snprintf (buf, sizeof (buf), _("Audio: <span foreground=\"red\">none</span>"));
|
||||
|
||||
} else {
|
||||
|
||||
framecnt_t rate = engine->sample_rate();
|
||||
framecnt_t rate = AudioEngine::instance()->sample_rate();
|
||||
|
||||
if (rate == 0) {
|
||||
/* no sample rate available */
|
||||
|
@ -1155,11 +1155,11 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
|
|||
if (fmod (rate, 1000.0) != 0.0) {
|
||||
snprintf (buf, sizeof (buf), _("Audio: <span foreground=\"green\">%.1f kHz / %4.1f ms</span>"),
|
||||
(float) rate / 1000.0f,
|
||||
(engine->usecs_per_cycle() / 1000.0f));
|
||||
(AudioEngine::instance()->usecs_per_cycle() / 1000.0f));
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), _("Audio: <span foreground=\"green\">%" PRId64 " kHz / %4.1f ms</span>"),
|
||||
rate/1000,
|
||||
(engine->usecs_per_cycle() / 1000.0f));
|
||||
(AudioEngine::instance()->usecs_per_cycle() / 1000.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1230,7 +1230,7 @@ ARDOUR_UI::update_cpu_load ()
|
|||
should also be changed.
|
||||
*/
|
||||
|
||||
float const c = engine->get_cpu_load ();
|
||||
float const c = AudioEngine::instance()->get_cpu_load ();
|
||||
snprintf (buf, sizeof (buf), _("DSP: <span foreground=\"%s\">%5.1f%%</span>"), c >= 90 ? X_("red") : X_("green"), c);
|
||||
cpu_load_label.set_markup (buf);
|
||||
}
|
||||
|
@ -1551,20 +1551,16 @@ ARDOUR_UI::open_recent_session ()
|
|||
bool
|
||||
ARDOUR_UI::check_audioengine ()
|
||||
{
|
||||
if (engine) {
|
||||
if (!engine->connected()) {
|
||||
MessageDialog msg (string_compose (
|
||||
_("%1 is not connected to JACK\n"
|
||||
"You cannot open or close sessions in this condition"),
|
||||
PROGRAM_NAME));
|
||||
pop_back_splash (msg);
|
||||
msg.run ();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (!AudioEngine::instance()->connected()) {
|
||||
MessageDialog msg (string_compose (
|
||||
_("%1 is not connected to any audio backend.\n"
|
||||
"You cannot open or close sessions in this condition"),
|
||||
PROGRAM_NAME));
|
||||
pop_back_splash (msg);
|
||||
msg.run ();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2785,25 +2781,23 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
|
|||
int unload_status;
|
||||
int retval = -1;
|
||||
|
||||
if (_session) {
|
||||
unload_status = unload_session ();
|
||||
|
||||
if (unload_status < 0) {
|
||||
goto out;
|
||||
} else if (unload_status > 0) {
|
||||
retval = 0;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
session_loaded = false;
|
||||
|
||||
if (!check_audioengine()) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
unload_status = unload_session ();
|
||||
|
||||
if (unload_status < 0) {
|
||||
goto out;
|
||||
} else if (unload_status > 0) {
|
||||
retval = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME));
|
||||
|
||||
try {
|
||||
new_session = new Session (*engine, path, snap_name, 0, mix_template);
|
||||
new_session = new Session (*AudioEngine::instance(), path, snap_name, 0, mix_template);
|
||||
}
|
||||
|
||||
/* this one is special */
|
||||
|
@ -2904,12 +2898,7 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
|||
Session *new_session;
|
||||
int x;
|
||||
|
||||
if (!check_audioengine()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
session_loaded = false;
|
||||
|
||||
x = unload_session ();
|
||||
|
||||
if (x < 0) {
|
||||
|
@ -2921,7 +2910,7 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
|
|||
_session_is_new = true;
|
||||
|
||||
try {
|
||||
new_session = new Session (*engine, path, snap_name, &bus_profile);
|
||||
new_session = new Session (*AudioEngine::instance(), path, snap_name, &bus_profile);
|
||||
}
|
||||
|
||||
catch (...) {
|
||||
|
@ -3808,38 +3797,33 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ARDOUR_UI::disconnect_from_jack ()
|
||||
ARDOUR_UI::disconnect_from_engine ()
|
||||
{
|
||||
if (engine) {
|
||||
/* drop connection to AudioEngine::Halted so that we don't act
|
||||
* as if the engine unexpectedly shut down
|
||||
*/
|
||||
halt_connection.disconnect ();
|
||||
|
||||
if (engine->stop ()) {
|
||||
MessageDialog msg (*editor, _("Could not disconnect from JACK"));
|
||||
msg.run ();
|
||||
} else {
|
||||
engine->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
|
||||
}
|
||||
|
||||
update_sample_rate (0);
|
||||
/* drop connection to AudioEngine::Halted so that we don't act
|
||||
* as if the engine unexpectedly shut down
|
||||
*/
|
||||
halt_connection.disconnect ();
|
||||
|
||||
if (AudioEngine::instance()->stop ()) {
|
||||
MessageDialog msg (*editor, _("Could not disconnect from JACK"));
|
||||
msg.run ();
|
||||
} else {
|
||||
AudioEngine::instance()->Halted.connect_same_thread (halt_connection, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
|
||||
}
|
||||
|
||||
update_sample_rate (0);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::reconnect_to_jack ()
|
||||
ARDOUR_UI::reconnect_to_engine ()
|
||||
{
|
||||
if (engine) {
|
||||
if (engine->start ()) {
|
||||
MessageDialog msg (*editor, _("Could not reconnect to JACK"));
|
||||
msg.run ();
|
||||
}
|
||||
|
||||
update_sample_rate (0);
|
||||
if (AudioEngine::instance()->start ()) {
|
||||
MessageDialog msg (*editor, _("Could not reconnect to JACK"));
|
||||
msg.run ();
|
||||
}
|
||||
|
||||
update_sample_rate (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4147,18 +4131,46 @@ ARDOUR_UI::reset_route_peak_display (Route* route)
|
|||
}
|
||||
}
|
||||
|
||||
EngineControl*
|
||||
ARDOUR_UI::audio_midi_setup_widget ()
|
||||
void
|
||||
ARDOUR_UI::toggle_audio_midi_setup ()
|
||||
{
|
||||
/* remove widget from any existing parent, since it is about
|
||||
to be packed somewhere else.
|
||||
*/
|
||||
|
||||
Gtk::Container* parent = _audio_midi_setup->get_parent ();
|
||||
|
||||
if (parent) {
|
||||
parent->remove (*_audio_midi_setup);
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-audio-midi-setup"));
|
||||
if (!act) {
|
||||
return;
|
||||
}
|
||||
|
||||
return _audio_midi_setup;
|
||||
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 ()
|
||||
{
|
||||
launch_audio_midi_setup ();
|
||||
|
||||
int r = _audio_midi_setup->run ();
|
||||
|
||||
switch (r) {
|
||||
case Gtk::RESPONSE_OK:
|
||||
return 0;
|
||||
case Gtk::RESPONSE_APPLY:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,8 +289,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
|
||||
const std::string& announce_string() const { return _announce_string; }
|
||||
|
||||
EngineControl* audio_midi_setup_widget();
|
||||
|
||||
protected:
|
||||
friend class PublicEditor;
|
||||
|
||||
|
@ -305,15 +303,13 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
void reenable_hide_loop_punch_ruler_if_appropriate ();
|
||||
void toggle_auto_return ();
|
||||
void toggle_click ();
|
||||
|
||||
void toggle_audio_midi_setup ();
|
||||
void toggle_session_auto_loop ();
|
||||
|
||||
void toggle_rc_options_window ();
|
||||
void toggle_session_options_window ();
|
||||
|
||||
private:
|
||||
ArdourStartup* _startup;
|
||||
ARDOUR::AudioEngine *engine;
|
||||
Gtk::Tooltips _tooltips;
|
||||
NSM_Client *nsm;
|
||||
bool _was_dirty;
|
||||
|
@ -671,9 +667,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
int pending_state_dialog ();
|
||||
int sr_mismatch_dialog (ARDOUR::framecnt_t, ARDOUR::framecnt_t);
|
||||
|
||||
void disconnect_from_jack ();
|
||||
void reconnect_to_jack ();
|
||||
void set_jack_buffer_size (ARDOUR::pframes_t);
|
||||
void disconnect_from_engine ();
|
||||
void reconnect_to_engine ();
|
||||
void set_engine_buffer_size (ARDOUR::pframes_t);
|
||||
|
||||
Gtk::MenuItem* jack_disconnect_item;
|
||||
Gtk::MenuItem* jack_reconnect_item;
|
||||
|
@ -753,6 +749,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
void check_announcements ();
|
||||
|
||||
EngineControl* _audio_midi_setup;
|
||||
void launch_audio_midi_setup ();
|
||||
int do_audio_midi_setup ();
|
||||
};
|
||||
|
||||
#endif /* __ardour_gui_h__ */
|
||||
|
|
|
@ -275,7 +275,10 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||
rec_button.set_sensitive (false);
|
||||
|
||||
WM::Manager::instance().set_session ((ARDOUR::Session*) 0);
|
||||
ARDOUR_UI::instance()->video_timeline->close_session();
|
||||
|
||||
if (ARDOUR_UI::instance()->video_timeline) {
|
||||
ARDOUR_UI::instance()->video_timeline->close_session();
|
||||
}
|
||||
|
||||
stop_blinking ();
|
||||
stop_clocking ();
|
||||
|
|
|
@ -189,31 +189,31 @@ ARDOUR_UI::install_actions ()
|
|||
ActionManager::register_action (engine_actions, X_("JACK"), _("JACK"));
|
||||
ActionManager::register_action (engine_actions, X_("Latency"), _("Latency"));
|
||||
|
||||
act = ActionManager::register_action (engine_actions, X_("JACKReconnect"), _("Reconnect"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::reconnect_to_jack));
|
||||
act = ActionManager::register_action (engine_actions, X_("EngineReconnect"), _("Reconnect"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::reconnect_to_engine));
|
||||
ActionManager::engine_opposite_sensitive_actions.push_back (act);
|
||||
|
||||
act = ActionManager::register_action (engine_actions, X_("JACKDisconnect"), _("Disconnect"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::disconnect_from_jack));
|
||||
act = ActionManager::register_action (engine_actions, X_("EngineDisconnect"), _("Disconnect"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::disconnect_from_engine));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
|
||||
RadioAction::Group latency_group;
|
||||
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency32"), X_("32"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 32));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency32"), X_("32"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 32));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency64"), X_("64"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 64));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency64"), X_("64"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 64));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency128"), X_("128"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 128));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency128"), X_("128"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 128));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency256"), X_("256"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 256));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency256"), X_("256"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 256));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency512"), X_("512"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 512));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency512"), X_("512"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 512));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency1024"), X_("1024"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 1024));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency1024"), X_("1024"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 1024));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency2048"), X_("2048"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 2048));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency2048"), X_("2048"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 2048));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency4096"), X_("4096"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 4096));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency4096"), X_("4096"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 4096));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("JACKLatency8192"), X_("8192"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (pframes_t) 8192));
|
||||
act = ActionManager::register_radio_action (engine_actions, latency_group, X_("EngineLatency8192"), X_("8192"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::set_engine_buffer_size), (pframes_t) 8192));
|
||||
ActionManager::engine_sensitive_actions.push_back (act);
|
||||
|
||||
/* these actions are intended to be shared across all windows */
|
||||
|
@ -230,6 +230,7 @@ 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);
|
||||
|
@ -430,38 +431,38 @@ ARDOUR_UI::install_actions ()
|
|||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::set_jack_buffer_size (pframes_t nframes)
|
||||
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_("JACKLatency32");
|
||||
action_name = X_("EngineLatency32");
|
||||
break;
|
||||
case 64:
|
||||
action_name = X_("JACKLatency64");
|
||||
action_name = X_("EngineLatency64");
|
||||
break;
|
||||
case 128:
|
||||
action_name = X_("JACKLatency128");
|
||||
action_name = X_("EngineLatency128");
|
||||
break;
|
||||
case 256:
|
||||
action_name = X_("JACKLatency256");
|
||||
action_name = X_("EngineLatency256");
|
||||
break;
|
||||
case 512:
|
||||
action_name = X_("JACKLatency512");
|
||||
action_name = X_("EngineLatency512");
|
||||
break;
|
||||
case 1024:
|
||||
action_name = X_("JACKLatency1024");
|
||||
action_name = X_("EngineLatency1024");
|
||||
break;
|
||||
case 2048:
|
||||
action_name = X_("JACKLatency2048");
|
||||
action_name = X_("EngineLatency2048");
|
||||
break;
|
||||
case 4096:
|
||||
action_name = X_("JACKLatency4096");
|
||||
action_name = X_("EngineLatency4096");
|
||||
break;
|
||||
case 8192:
|
||||
action_name = X_("JACKLatency8192");
|
||||
action_name = X_("EngineLatency8192");
|
||||
break;
|
||||
default:
|
||||
/* XXX can we do anything useful ? */
|
||||
|
@ -476,7 +477,7 @@ ARDOUR_UI::set_jack_buffer_size (pframes_t nframes)
|
|||
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action);
|
||||
|
||||
if (ract && ract->get_active()) {
|
||||
engine->request_buffer_size (nframes);
|
||||
AudioEngine::instance()->request_buffer_size (nframes);
|
||||
update_sample_rate (0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ using namespace PBD;
|
|||
using namespace Glib;
|
||||
|
||||
EngineControl::EngineControl ()
|
||||
: input_latency_adjustment (0, 0, 99999, 1)
|
||||
: ArdourDialog (_("Audio/MIDI Setup"))
|
||||
, input_latency_adjustment (0, 0, 99999, 1)
|
||||
, input_latency (input_latency_adjustment)
|
||||
, output_latency_adjustment (0, 0, 99999, 1)
|
||||
, output_latency (output_latency_adjustment)
|
||||
|
@ -64,6 +65,45 @@ EngineControl::EngineControl ()
|
|||
, ports_spinner (ports_adjustment)
|
||||
, realtime_button (_("Realtime"))
|
||||
, basic_packer (9, 3)
|
||||
{
|
||||
build_notebook ();
|
||||
|
||||
get_vbox()->set_border_width (12);
|
||||
get_vbox()->pack_start (notebook);
|
||||
|
||||
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
|
||||
|
||||
/* Pick up any existing audio setup configuration, if appropriate */
|
||||
|
||||
XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
|
||||
|
||||
if (audio_setup) {
|
||||
set_state (*audio_setup);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EngineControl::on_response (int response_id)
|
||||
{
|
||||
ArdourDialog::on_response (response_id);
|
||||
|
||||
switch (response_id) {
|
||||
case RESPONSE_APPLY:
|
||||
setup_engine (true);
|
||||
break;
|
||||
case RESPONSE_OK:
|
||||
setup_engine (true);
|
||||
hide ();
|
||||
break;
|
||||
default:
|
||||
hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EngineControl::build_notebook ()
|
||||
{
|
||||
using namespace Notebook_Helpers;
|
||||
Label* label;
|
||||
|
@ -164,16 +204,6 @@ EngineControl::EngineControl ()
|
|||
|
||||
notebook.set_name ("SettingsNotebook");
|
||||
|
||||
set_border_width (12);
|
||||
pack_start (notebook);
|
||||
|
||||
/* Pick up any existing audio setup configuration, if appropriate */
|
||||
|
||||
XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
|
||||
|
||||
if (audio_setup) {
|
||||
set_state (*audio_setup);
|
||||
}
|
||||
}
|
||||
|
||||
EngineControl::~EngineControl ()
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
#include <gtkmm/buttonbox.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
class EngineControl : public Gtk::VBox {
|
||||
#include "ardour_dialog.h"
|
||||
|
||||
class EngineControl : public ArdourDialog {
|
||||
public:
|
||||
EngineControl ();
|
||||
~EngineControl ();
|
||||
|
@ -144,6 +146,10 @@ class EngineControl : public Gtk::VBox {
|
|||
void save_state ();
|
||||
|
||||
static bool print_channel_count (Gtk::SpinButton*);
|
||||
|
||||
void build_notebook ();
|
||||
|
||||
void on_response (int);
|
||||
};
|
||||
|
||||
#endif /* __gtk2_ardour_engine_dialog_h__ */
|
||||
|
|
|
@ -75,7 +75,6 @@ ArdourStartup::ArdourStartup (bool require_new, const std::string& session_name,
|
|||
, monitor_via_hardware_button (string_compose (_("Use an external mixer or the hardware mixer of your audio interface.\n"
|
||||
"%1 will play NO role in monitoring"), PROGRAM_NAME))
|
||||
, monitor_via_ardour_button (string_compose (_("Ask %1 to play back material as it is being recorded"), PROGRAM_NAME))
|
||||
, engine_dialog (0)
|
||||
, new_folder_chooser (FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||
, more_new_session_options_button (_("I'd like more options for this session"))
|
||||
, _output_limit_count_adj (1, 0, 100, 1, 10, 0)
|
||||
|
@ -92,13 +91,12 @@ ArdourStartup::ArdourStartup (bool require_new, const std::string& session_name,
|
|||
, _existing_session_chooser_used (false)
|
||||
{
|
||||
new_user = !Glib::file_test (been_here_before_path(), Glib::FILE_TEST_EXISTS);
|
||||
need_audio_setup = AudioEngine::instance()->setup_required ();
|
||||
need_session_info = (session_name.empty() || require_new);
|
||||
|
||||
_provided_session_name = session_name;
|
||||
_provided_session_path = session_path;
|
||||
|
||||
if (need_audio_setup || need_session_info || new_user) {
|
||||
if (need_session_info || new_user) {
|
||||
|
||||
use_template_button.set_group (session_template_group);
|
||||
use_session_as_template_button.set_group (session_template_group);
|
||||
|
@ -140,18 +138,10 @@ ArdourStartup::ArdourStartup (bool require_new, const std::string& session_name,
|
|||
setup_monitoring_choice_page ();
|
||||
setup_monitor_section_choice_page ();
|
||||
|
||||
if (need_audio_setup) {
|
||||
setup_audio_page ();
|
||||
}
|
||||
|
||||
ic_new_session_button.set_active (true); // always create new session on first run
|
||||
|
||||
} else {
|
||||
|
||||
if (need_audio_setup) {
|
||||
setup_audio_page ();
|
||||
}
|
||||
|
||||
setup_initial_choice_page ();
|
||||
}
|
||||
|
||||
|
@ -184,7 +174,7 @@ ArdourStartup::~ArdourStartup ()
|
|||
bool
|
||||
ArdourStartup::ready_without_display () const
|
||||
{
|
||||
return !new_user && !need_audio_setup && !need_session_info;
|
||||
return !new_user && !need_session_info;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -311,24 +301,6 @@ ArdourStartup::session_folder ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArdourStartup::setup_audio_page ()
|
||||
{
|
||||
engine_dialog = ARDOUR_UI::instance()->audio_midi_setup_widget ();
|
||||
|
||||
engine_dialog->set_border_width (12);
|
||||
|
||||
engine_dialog->show_all ();
|
||||
|
||||
audio_page_index = append_page (*engine_dialog);
|
||||
set_page_type (*engine_dialog, ASSISTANT_PAGE_CONTENT);
|
||||
set_page_title (*engine_dialog, _("Audio / MIDI Setup"));
|
||||
|
||||
/* the default parameters should work, so the page is potentially complete */
|
||||
|
||||
set_page_complete (*engine_dialog, true);
|
||||
}
|
||||
|
||||
void
|
||||
ArdourStartup::setup_new_user_page ()
|
||||
{
|
||||
|
@ -660,13 +632,6 @@ ArdourStartup::on_delete_event (GdkEventAny*)
|
|||
void
|
||||
ArdourStartup::on_apply ()
|
||||
{
|
||||
if (engine_dialog) {
|
||||
if (engine_dialog->setup_engine (true)) {
|
||||
set_current_page (audio_page_index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (config_modified) {
|
||||
|
||||
if (default_dir_chooser) {
|
||||
|
|
|
@ -80,7 +80,6 @@ class ArdourStartup : public Gtk::Assistant {
|
|||
gint _response;
|
||||
bool config_modified;
|
||||
bool new_user;
|
||||
bool need_audio_setup;
|
||||
bool need_session_info;
|
||||
bool new_only;
|
||||
std::string _provided_session_name;
|
||||
|
@ -173,11 +172,6 @@ class ArdourStartup : public Gtk::Assistant {
|
|||
|
||||
void existing_session_selected ();
|
||||
|
||||
/* audio setup page */
|
||||
|
||||
void setup_audio_page ();
|
||||
EngineControl* engine_dialog;
|
||||
|
||||
/* new sessions */
|
||||
|
||||
void setup_new_session_page ();
|
||||
|
|
|
@ -555,6 +555,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
|
||||
int remove_last_capture ();
|
||||
|
||||
/** handlers should return 0 for "everything OK", and any other value for
|
||||
* "cannot setup audioengine".
|
||||
*/
|
||||
static PBD::Signal0<int> AudioEngineSetupRequired;
|
||||
|
||||
/** handlers should return -1 for "stop cleanup",
|
||||
0 for "yes, delete this playlist",
|
||||
1 for "no, don't delete this playlist".
|
||||
|
|
|
@ -106,6 +106,7 @@ using namespace PBD;
|
|||
|
||||
bool Session::_disable_all_loaded_plugins = false;
|
||||
|
||||
PBD::Signal0<int> Session::AudioEngineSetupRequired;
|
||||
PBD::Signal1<void,std::string> Session::Dialog;
|
||||
PBD::Signal0<int> Session::AskAboutPendingState;
|
||||
PBD::Signal2<int, framecnt_t, framecnt_t> Session::AskAboutSampleRateMismatch;
|
||||
|
@ -154,6 +155,17 @@ Session::Session (AudioEngine &eng,
|
|||
, _have_rec_enabled_track (false)
|
||||
, _suspend_timecode_transmission (0)
|
||||
{
|
||||
if (_engine.current_backend() == 0 || _engine.setup_required()) {
|
||||
boost::optional<int> r = AudioEngineSetupRequired ();
|
||||
if (r.get_value_or (-1) != 0) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_engine.connected()) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
|
||||
_locations = new Locations (*this);
|
||||
ltc_encoder = NULL;
|
||||
|
||||
|
@ -175,10 +187,6 @@ Session::Session (AudioEngine &eng,
|
|||
|
||||
interpolation.add_channel_to (0, 0);
|
||||
|
||||
if (!eng.connected()) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
|
||||
n_physical_outputs = _engine.n_physical_outputs ();
|
||||
n_physical_inputs = _engine.n_physical_inputs ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue