diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-15 16:07:26 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-15 16:07:26 +0000 |
commit | e96e4bacbeadd832e9deb251d91124eb012a5a49 (patch) | |
tree | 6f8e5bcd550535d9c8b07581a4bfe3d938fdea07 | |
parent | a4c84de53c3855b52955df5633e2b1a4347667f8 (diff) |
basic startup changes to enable the engine control stuff to work; a little ARDOUR_SAE work
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2304 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/actions.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour-sae.menus | 326 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 269 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 10 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dependents.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 179 | ||||
-rw-r--r-- | gtk2_ardour/engine_dialog.h | 26 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 136 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.cc | 47 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.h | 12 | ||||
-rw-r--r-- | gtk2_ardour/opts.cc | 32 | ||||
-rw-r--r-- | gtk2_ardour/opts.h | 13 | ||||
-rw-r--r-- | libs/ardour/ardour/profile.h | 4 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 4 |
15 files changed, 775 insertions, 297 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 7583d69273..2aa0546a09 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -66,7 +66,7 @@ ActionManager::init () { ui_manager = UIManager::create (); - std::string ui_file = ARDOUR::find_config_file(GTK_ARDOUR::menus_file); + std::string ui_file = ARDOUR::find_config_file (ARDOUR_COMMAND_LINE::menus_file); bool loaded = false; diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus new file mode 100644 index 0000000000..83245b879b --- /dev/null +++ b/gtk2_ardour/ardour-sae.menus @@ -0,0 +1,326 @@ +<ui> + + <menubar name='Main' action='MainMenu'> + <menu name='Session' action='Session'> + <menuitem action='New'/> + <menuitem action='Open'/> + <menuitem action='Recent'/> + <menuitem action='Close'/> + <separator/> + <menuitem action='Save'/> + <menuitem action='Snapshot'/> + <menuitem action='SaveTemplate'/> + <separator/> + <menuitem action='AddTrackBus'/> + <separator/> + <separator/> + <menu name='Cleanup' action='Cleanup'> + <menuitem action='CleanupUnused'/> + <menuitem action='FlushWastebasket'/> + </menu> + <separator/> + <menuitem action='Quit'/> + </menu> + <menu name='Files' action='Files'> + <menu action='addExistingAudioFiles'> + <menuitem action='addExternalAudioAsRegion'/> + <menuitem action='addExternalAudioToTrack'/> + <separator/> + <menuitem action='addExternalAudioAsTrack'/> + <menuitem action='addExternalAudioAsTapeTrack'/> + </menu> + <separator/> + <menuitem action='ExportSession'/> + <menuitem action='ExportSelection'/> + <menuitem action='ExportRangeMarkers'/> + </menu> + <menu name='Transport' action='Transport'> + <menuitem action='ToggleRoll'/> + <menuitem action='ToggleRollForgetCapture'/> + <menuitem action='Loop'/> + <menuitem action='PlaySelection'/> + <menuitem action='set-playhead'/> + <menuitem action='Forward'/> + <menuitem action='Rewind'/> + <menuitem action='GotoZero'/> + <menuitem action='GotoStart'/> + <menuitem action='GotoEnd'/> + <separator/> + <menuitem action='Record'/> + <separator/> + <menuitem action='TransitionToRoll'/> + <menuitem action='TransitionToReverse'/> + <separator/> + <menuitem action='jump-forward-to-mark'/> + <menuitem action='jump-backward-to-mark'/> + <menuitem action='add-location-from-playhead'/> + <separator/> + <menuitem action='playhead-to-next-region-start'/> + <menuitem action='playhead-to-next-region-end'/> + <menuitem action='playhead-to-previous-region-start'/> + <menuitem action='playhead-to-previous-region-end'/> + <menuitem action='playhead-to-next-region-sync'/> + <menuitem action='playhead-to-previous-region-sync'/> + <menuitem action='center-playhead'/> + <menuitem action='playhead-to-edit'/> + <separator/> + <menuitem action='playhead-to-range-start'/> + <menuitem action='playhead-to-range-end'/> + <menu action='TransportOptions'> + <menuitem action='ToggleTimeMaster'/> + <menuitem action='TogglePunchIn'/> + <menuitem action='TogglePunchOut'/> + <menuitem action='ToggleAutoInput'/> + <menuitem action='ToggleAutoPlay'/> + <menuitem action='ToggleAutoReturn'/> + <menuitem action='ToggleClick'/> + <menuitem action='toggle-follow-playhead'/> + <menuitem action='ToggleVideoSync'/> + </menu> + </menu> + <menu name='Edit' action='Edit'> + <menuitem action='undo'/> + <menuitem action='redo'/> + <menuitem action='editor-cut'/> + <menuitem action='editor-delete'/> + <menuitem action='editor-copy'/> + <menuitem action='editor-paste'/> + <menuitem action='set-edit-cursor'/> + <menuitem action='remove-last-capture'/> + <separator/> + <menu action="EditSelectRangeOptions"> + <menuitem action='extend-range-to-start-of-region'/> + <menuitem action='extend-range-to-end-of-region'/> + <menuitem action='start-range'/> + <menuitem action='finish-range'/> + <menuitem action='finish-add-range'/> + </menu> + <menu action="EditSelectRegionOptions"> + <menuitem action='select-all'/> + <menuitem action='select-all-after-edit-cursor'/> + <menuitem action='select-all-before-edit-cursor'/> + <menuitem action='select-all-after-playhead'/> + <menuitem action='select-all-before-playhead'/> + <menuitem action='select-all-between-cursors'/> + <menuitem action='select-all-in-punch-range'/> + <menuitem action='select-all-in-loop-range'/> + </menu> + <menu action='EditCursorMovementOptions'> + <menuitem action='edit-cursor-to-next-region-start'/> + <menuitem action='edit-cursor-to-next-region-end'/> + <menuitem action='edit-cursor-to-previous-region-start'/> + <menuitem action='edit-cursor-to-previous-region-end'/> + <menuitem action='edit-cursor-to-next-region-sync'/> + <menuitem action='edit-cursor-to-previous-region-sync'/> + <menuitem action='center-edit-cursor'/> + <menuitem action='edit-to-playhead'/> + <menuitem action='edit-cursor-to-range-start'/> + <menuitem action='edit-cursor-to-range-end'/> + </menu> + <menu name='KeyMouse Actions' action='KeyMouse Actions'> + <menuitem action='audition-at-mouse'/> + <menuitem action='brush-at-mouse'/> + <menuitem action='mute-unmute-region'/> + <separator/> + <menuitem action='set-mouse-mode-object'/> + <menuitem action='set-mouse-mode-range'/> + <menuitem action='set-mouse-mode-gain'/> + <menuitem action='set-mouse-mode-zoom'/> + <menuitem action='set-mouse-mode-timefx'/> + </menu> + </menu> + <menu name='Regions' action='Regions'> + <menuitem action='crop'/> + <menuitem action='duplicate-region'/> + <menuitem action='insert-region'/> + <menuitem action='normalize-region'/> + <separator/> + <menuitem action="nudge-forward"/> + <menuitem action="nudge-next-forward"/> + <menuitem action="nudge-backward"/> + <menuitem action="nudge-next-backward"/> + <menuitem action='split-region'/> + <menuitem action='set-region-sync-position'/> + </menu> + <menu name='View' action = 'View'> + <menu name='ZoomFocus' action='ZoomFocus'> + <menuitem action='zoom-focus-left'/> + <menuitem action='zoom-focus-right'/> + <menuitem action='zoom-focus-center'/> + <menuitem action='zoom-focus-playhead'/> + <menuitem action='zoom-focus-edit'/> + </menu> + <menu name='SnapMode' action='SnapMode'> + <menuitem action='snap-normal'/> + <menuitem action='snap-magnetic'/> + </menu> + <menu name='SnapTo' action='SnapTo'> + <menuitem action='snap-to-frame'/> + <menuitem action='snap-to-cd-frame'/> + <menuitem action='snap-to-smpte-frame'/> + <menuitem action='snap-to-smpte-seconds'/> + <menuitem action='snap-to-smpte-minutes'/> + <menuitem action='snap-to-seconds'/> + <menuitem action='snap-to-minutes'/> + <menuitem action='snap-to-thirtyseconds'/> + <menuitem action='snap-to-asixteenthbeat'/> + <menuitem action='snap-to-eighths'/> + <menuitem action='snap-to-quarters'/> + <menuitem action='snap-to-thirds'/> + <menuitem action='snap-to-beat'/> + <menuitem action='snap-to-bar'/> + <menuitem action='snap-to-mark'/> + <menuitem action='snap-to-edit-cursor'/> + <menuitem action='snap-to-region-start'/> + <menuitem action='snap-to-region-end'/> + <menuitem action='snap-to-region-sync'/> + <menuitem action='snap-to-region-boundary'/> + </menu> + <separator/> + + <menuitem action='temporal-zoom-in'/> + <menuitem action='temporal-zoom-out'/> + <menuitem action='zoom-to-session'/> + <menuitem action='scroll-tracks-down'/> + <menuitem action='scroll-tracks-up'/> + <menuitem action='scroll-tracks-down'/> + <menuitem action='step-tracks-up'/> + <menuitem action='step-tracks-down'/> + <separator/> + <menuitem action='scroll-forward'/> + <menuitem action='scroll-backward'/> + <separator/> + <menuitem action='scroll-playhead-forward'/> + <menuitem action='scroll-playhead-backward'/> + <separator/> + <menuitem action='show-editor-mixer'/> + </menu> + <menu name='JACK' action='JACK'> + <menuitem action='JACKDisconnect'/> + <menuitem action='JACKReconnect'/> + <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'/> + </menu> + </menu> + <menu name='Windows' action = 'Windows'> + <menuitem action='ToggleMaximalEditor'/> + <separator/> + <menuitem action='goto-editor'/> + <menuitem action='goto-mixer'/> + <menuitem action='ToggleOptionsEditor'/> + <menuitem action='ToggleInspector'/> + <menuitem action='ToggleLocations'/> + <menuitem action='ToggleThemeManager'/> + <menuitem action='ToggleBigClock'/> + <separator/> + </menu> + <menu name='Options' action='Options'> + <menu action='AudioFileFormat'> + <menu action='AudioFileFormatData'> + <menuitem action='FileDataFormatFloat'/> + <menuitem action='FileDataFormat24bit'/> + <menuitem action='FileDataFormat16bit'/> + </menu> + <menu action='AudioFileFormatHeader'> + <menuitem action='FileHeaderFormatBWF'/> + <menuitem action='FileHeaderFormatWAVE'/> + <menuitem action='FileHeaderFormatWAVE64'/> + <menuitem action='FileHeaderFormatCAF'/> + </menu> + </menu> + <menu action='Monitoring'> + <menuitem action='UseHardwareMonitoring'/> + <menuitem action='UseSoftwareMonitoring'/> + <menuitem action='UseExternalMonitoring'/> + </menu> + <menu action='Metering'> + <menu action='MeteringFallOffRate'> + <menuitem action='MeterFalloffOff'/> + <menuitem action='MeterFalloffSlowest'/> + <menuitem action='MeterFalloffSlow'/> + <menuitem action='MeterFalloffMedium'/> + <menuitem action='MeterFalloffFast'/> + <menuitem action='MeterFalloffFaster'/> + <menuitem action='MeterFalloffFastest'/> + </menu> + <menu action='MeteringHoldTime'> + <menuitem action='MeterHoldOff'/> + <menuitem action='MeterHoldShort'/> + <menuitem action='MeterHoldMedium'/> + <menuitem action='MeterHoldLong'/> + </menu> + </menu> + <menu action='Solo'> + <menuitem action='LatchedSolo'/> + </menu> + </menu> + <menu name='Help' action='Help'> + <menuitem action='About'/> + </menu> + </menubar> + + <popup name='redirectmenu'> + <menuitem action='newplugin'/> + <menuitem action='newinsert'/> + <menuitem action='newsend'/> + <separator/> + <menuitem action='clear'/> + <separator/> + <menuitem action='cut'/> + <menuitem action='copy'/> + <menuitem action='paste'/> + <menuitem action='delete'/> + <separator/> + <menuitem action='rename'/> + <separator/> + <menuitem action='selectall'/> + <menuitem action='deselectall'/> + <separator/> + <menuitem action='activate'/> + <menuitem action='deactivate'/> + <separator/> + <menuitem action='activate_all'/> + <menuitem action='deactivate_all'/> + <separator/> + <menuitem action='edit'/> + </popup> + + <popup name='ShuttleUnitPopup'> + <menuitem action='SetShuttleUnitsPercentage'/> + <menuitem action='SetShuttleUnitsSemitones'/> + </popup> + + <popup name='RegionListMenu'> + <menuitem action='rlAudition'/> + <menuitem action='rlHide'/> + <menuitem action='rlRemove'/> + <separator/> + <menuitem action='rlShowAll'/> + <menuitem action='rlShowAuto'/> + <menu name='Sort' action='RegionListSort'> + <menuitem action='SortAscending'/> + <menuitem action='SortDescending'/> + <separator/> + <menuitem action='SortByRegionName'/> + <menuitem action='SortByRegionLength'/> + <menuitem action='SortByRegionPosition'/> + <menuitem action='SortByRegionTimestamp'/> + <menuitem action='SortByRegionStartinFile'/> + <menuitem action='SortByRegionEndinFile'/> + <menuitem action='SortBySourceFileName'/> + <menuitem action='SortBySourceFileLength'/> + <menuitem action='SortBySourceFileCreationDate'/> + <menuitem action='SortBySourceFilesystem'/> + </menu> + <separator/> + <menuitem action='addExternalAudioToRegionList'/> + </popup> +</ui> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 56ca0181c3..bfe2c145e6 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -169,6 +169,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) _session_is_new = false; big_clock_window = 0; session_selector_window = 0; + new_session_dialog = 0; last_key_press_time = 0; connection_editor = 0; add_route_dialog = 0; @@ -210,31 +211,81 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) ARDOUR::Session::AskAboutPendingState.connect (mem_fun(*this, &ARDOUR_UI::pending_state_dialog)); - /* have to wait for AudioEngine and Configuration before proceeding */ + /* lets get this party started */ + + try { + ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization); + setup_gtk_ardour_enums (); + Config->set_current_owner (ConfigVariableBase::Interface); + setup_profile (); + + } catch (failed_constructor& err) { + error << _("could not initialize Ardour.") << endmsg; + // pass it on up + throw err; + } + + /* we like keyboards */ + + keyboard = new Keyboard; + + starting.connect (mem_fun(*this, &ARDOUR_UI::startup)); + stopping.connect (mem_fun(*this, &ARDOUR_UI::shutdown)); +} + +gint +ARDOUR_UI::start_backend_audio () +{ + if (new_session_dialog->engine_control.start_engine ()) { + return -1; + } + + return 0; } void -ARDOUR_UI::set_engine (AudioEngine& e) +ARDOUR_UI::create_engine () { - engine = &e; + // this gets called every time by new_session() + + if (engine) { + return; + } + + try { + engine = new ARDOUR::AudioEngine (ARDOUR_COMMAND_LINE::jack_client_name); + } catch (AudioEngine::NoBackendAvailable& err) { + backend_audio_error (); + error << string_compose (_("Could not connect to JACK server as \"%1\""), ARDOUR_COMMAND_LINE::jack_client_name) << endmsg; + quit (); + } engine->Stopped.connect (mem_fun(*this, &ARDOUR_UI::engine_stopped)); engine->Running.connect (mem_fun(*this, &ARDOUR_UI::engine_running)); engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted)); engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate)); - ActionManager::init (); - new_session_dialog = new NewSessionDialog(); + post_engine (); +} - _tooltips.enable(); +void +ARDOUR_UI::post_engine () +{ + /* Things to be done once we create the AudioEngine + */ - keyboard = new Keyboard; + check_memory_locking(); + + ActionManager::init (); + _tooltips.enable(); if (setup_windows ()) { throw failed_constructor (); } - if (GTK_ARDOUR::show_key_actions) { + /* this is the first point at which all the keybindings are available */ + + if (ARDOUR_COMMAND_LINE::show_key_actions) { vector<string> names; vector<string> paths; vector<string> keys; @@ -251,9 +302,6 @@ ARDOUR_UI::set_engine (AudioEngine& e) exit (0); } - /* start with timecode, metering enabled - */ - blink_timeout_tag = -1; /* the global configuration object is now valid */ @@ -279,8 +327,16 @@ ARDOUR_UI::set_engine (AudioEngine& e) update_cpu_load (); update_sample_rate (engine->frame_rate()); - starting.connect (mem_fun(*this, &ARDOUR_UI::startup)); - stopping.connect (mem_fun(*this, &ARDOUR_UI::shutdown)); + /* now start and maybe save state */ + + if (do_engine_start () == 0) { + if (session && _session_is_new) { + /* we need to retain initial visual + settings for a new session + */ + session->save_state (""); + } + } } ARDOUR_UI::~ARDOUR_UI () @@ -302,6 +358,10 @@ ARDOUR_UI::~ARDOUR_UI () if (add_route_dialog) { delete add_route_dialog; } + + if (new_session_dialog) { + delete new_session_dialog; + } } gint @@ -464,9 +524,116 @@ ARDOUR_UI::update_autosave () } void +ARDOUR_UI::backend_audio_error () +{ + MessageDialog win (_("Ardour could not connect to JACK."), + false, + Gtk::MESSAGE_INFO, + (Gtk::ButtonsType)(Gtk::BUTTONS_NONE)); +win.set_secondary_text(_("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 \"ardour\".\n\ +\n\ +Please consider the possibilities, and perhaps (re)start JACK.")); + + win.add_button (Stock::QUIT, RESPONSE_CLOSE); + win.set_default_response (RESPONSE_CLOSE); + + win.show_all (); + win.set_position (Gtk::WIN_POS_CENTER); + + if (!ARDOUR_COMMAND_LINE::no_splash) { + hide_splash (); + } + + /* we just don't care about the result, but we want to block */ + + win.run (); +} + +void ARDOUR_UI::startup () { - check_memory_locking(); + using namespace ARDOUR_COMMAND_LINE; + string name, path; + bool isnew; + + new_session_dialog = new NewSessionDialog(); + + /* If no session name is given: we're not loading a session yet, nor creating a new one */ + + if (session_name.length()) { + + /* Load session or start the new session dialog */ + + if (Session::find_session (session_name, path, name, isnew)) { + error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; + return; + } + + if (!ARDOUR_COMMAND_LINE::new_session) { + + /* Supposed to be loading an existing session, but the session doesn't exist */ + + if (isnew) { + error << string_compose (_("\n\nNo session named \"%1\" exists.\n" + "To create it from the command line, start ardour as \"ardour --new %1"), path) + << endmsg; + return; + } + } + + new_session_dialog->set_session_name (name); + new_session_dialog->set_session_folder (Glib::path_get_basename (path)); + _session_is_new = isnew; + } + + hide_splash (); + + bool have_backend = EngineControl::engine_running(); + bool need_nsd; + bool load_needed = false; + + if (have_backend) { + + /* backend audio is working */ + + if (session_name.empty() || ARDOUR_COMMAND_LINE::new_session) { + /* need NSD to get session name and other info */ + need_nsd = true; + } else { + need_nsd = false; + } + + } else { + + /* no backend audio, must bring up NSD to check configuration */ + + need_nsd = true; + } + + if (need_nsd) { + + if (!new_session (session_name,have_backend)) { + return; + } + + } else { + + load_needed = true; + } + + create_engine (); + + if (load_needed) { + if (load_session (session_name, name)) { + return; + } + } + + show (); } void @@ -971,7 +1138,6 @@ ARDOUR_UI::open_session () { if (!check_audioengine()) { return; - } /* popup selector window */ @@ -1472,21 +1638,6 @@ ARDOUR_UI::setup_theme () theme_manager->setup_theme(); } -gint -ARDOUR_UI::start_engine () -{ - if (do_engine_start () == 0) { - if (session && _session_is_new) { - /* we need to retain initial visual - settings for a new session - */ - session->save_state (""); - } - } - - return FALSE; -} - void ARDOUR_UI::update_clocks () { @@ -1780,15 +1931,11 @@ ARDOUR_UI::save_template () } bool -ARDOUR_UI::new_session (std::string predetermined_path) +ARDOUR_UI::new_session (Glib::ustring predetermined_path, bool have_engine) { string session_name; string session_path; - - if (!check_audioengine()) { - return false; - } - + int response = Gtk::RESPONSE_NONE; new_session_dialog->set_modal(true); @@ -1798,13 +1945,11 @@ ARDOUR_UI::new_session (std::string predetermined_path) new_session_dialog->set_current_page (0); do { + + new_session_dialog->set_have_engine (have_engine); + response = new_session_dialog->run (); - if (!check_audioengine()) { - new_session_dialog->hide (); - return false; - } - _session_is_new = false; if (response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) { @@ -1819,10 +1964,26 @@ ARDOUR_UI::new_session (std::string predetermined_path) /* Clear was pressed */ new_session_dialog->reset(); + continue; + } + + /* first things first ... we need an audio engine running */ + + if (!have_engine) { + if (start_backend_audio ()) { + new_session_dialog->hide (); + return false; + } + have_engine = true; + } + + create_engine (); - } else if (response == Gtk::RESPONSE_YES) { + /* now handle possible affirmative responses */ - /* YES == OPEN, but there's no enum for that */ + if (response == Gtk::RESPONSE_YES) { + + /* YES == OPEN from the open session tab */ session_name = new_session_dialog->session_name(); @@ -1842,15 +2003,11 @@ ARDOUR_UI::new_session (std::string predetermined_path) } else if (response == Gtk::RESPONSE_OK) { + /* OK == OPEN from new session tab */ + session_name = new_session_dialog->session_name(); if (new_session_dialog->get_current_page() == 1) { - - /* XXX this is a bit of a hack.. - i really want the new sesion dialog to return RESPONSE_YES - if we're on page 1 (the load page) - Unfortunately i can't see how atm.. - */ if (session_name.empty()) { response = Gtk::RESPONSE_NONE; @@ -1873,6 +2030,8 @@ ARDOUR_UI::new_session (std::string predetermined_path) continue; } + /* handle what appear to be paths rather than just a name */ + if (session_name[0] == '/' || (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') || (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) { @@ -1891,7 +2050,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) session_path = Glib::build_filename (session_path, session_name); - if (g_file_test (session_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { Glib::ustring str = string_compose (_("This session\n%1\nalready exists. Do you want to open it?"), session_path); @@ -1999,7 +2158,7 @@ ARDOUR_UI::close_session() } unload_session(); - new_session (); + new_session ("", true); } int @@ -2808,13 +2967,13 @@ ARDOUR_UI::setup_profile () if (gdk_screen_width() < 1200) { Profile->set_small_screen (); } + + if (getenv ("ARDOUR_SAE")) { + Profile->set_sae (); + } } void ARDOUR_UI::audioengine_setup () { - EngineDialog ed; - - ed.show_all (); - ed.run (); } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index e712ced9e0..1b061b4ab6 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -72,9 +72,9 @@ class ConnectionEditor; class RouteParams_UI; class About; class AddRouteDialog; -class NewSessionDialog; class LocationUI; class ThemeManager; +class NewSessionDialog; namespace Gtkmm2ext { class TearOff; @@ -130,7 +130,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI _will_create_new_session_automatically = yn; } - bool new_session(std::string path = string()); + bool new_session (Glib::ustring path, bool have_engine = false); gint cmdline_new_session (string path); int unload_session (); void close_session(); @@ -202,8 +202,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI void session_add_midi_track (); - void set_engine (ARDOUR::AudioEngine&); - gint start_engine (); + void create_engine (); + void post_engine (); + gint start_backend_audio (); gint exit_on_main_window_close (GdkEventAny *); @@ -291,6 +292,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI static ARDOUR_UI *theArdourUI; + void backend_audio_error (); void startup (); void shutdown (); diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index d9d8396d2c..ac2b70f838 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -47,7 +47,7 @@ void ARDOUR_UI::shutdown () { if (session) { - delete session; + // delete session; session = 0; } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 602fe260ea..98cf2b42ac 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -101,7 +101,7 @@ ARDOUR_UI::install_actions () /* the real actions */ - act = ActionManager::register_action (main_actions, X_("New"), _("New"), hide_return (bind (mem_fun(*this, &ARDOUR_UI::new_session), string ()))); + act = ActionManager::register_action (main_actions, X_("New"), _("New"), hide_return (bind (mem_fun(*this, &ARDOUR_UI::new_session), string (), true))); ActionManager::register_action (main_actions, X_("Open"), _("Open"), mem_fun(*this, &ARDOUR_UI::open_session)); ActionManager::register_action (main_actions, X_("Recent"), _("Recent"), mem_fun(*this, &ARDOUR_UI::open_recent_session)); @@ -162,10 +162,6 @@ ARDOUR_UI::install_actions () /* not sensitive to the presence or absence of JACK */ act = ActionManager::register_action (jack_actions, X_("AudioEngineSetup"), _("Setup"), mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::audioengine_setup)); - if (EngineDialog::engine_running()) { - // act->set_sensitive (false); - } - act = ActionManager::register_action (jack_actions, X_("JACKReconnect"), _("Reconnect"), mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::reconnect_to_jack)); ActionManager::jack_opposite_sensitive_actions.push_back (act); @@ -701,7 +697,9 @@ ARDOUR_UI::build_control_surface_menu () void ARDOUR_UI::build_menu_bar () { - build_control_surface_menu (); + if (!Profile->get_sae()) { + build_control_surface_menu (); + } menu_bar = dynamic_cast<MenuBar*> (ActionManager::get_widget (X_("/Main"))); menu_bar->set_name ("MainMenuBar"); diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index d080141251..970525411d 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1,4 +1,6 @@ #include <vector> +#include <cmath> +#include <fstream> #include <glibmm.h> @@ -8,6 +10,7 @@ #include <gtkmm2ext/utils.h> #include <pbd/convert.h> +#include <pbd/error.h> #include "engine_dialog.h" #include "i18n.h" @@ -18,9 +21,8 @@ using namespace Gtkmm2ext; using namespace PBD; using namespace Glib; -EngineDialog::EngineDialog () - : ArdourDialog (_("Audio Engine"), false, true), - periods_adjustment (2, 2, 16, 1, 2), +EngineControl::EngineControl () + : periods_adjustment (2, 2, 16, 1, 2), periods_spinner (periods_adjustment), priority_adjustment (60, 10, 90, 1, 10), priority_spinner (priority_adjustment), @@ -35,7 +37,9 @@ EngineDialog::EngineDialog () hw_monitor_button (_("H/W monitoring")), hw_meter_button (_("H/W metering")), verbose_output_button (_("Verbose output")), - basic_packer (5, 2), + start_button (_("Start")), + stop_button (_("Stop")), + basic_packer (8, 2), options_packer (12, 2), device_packer (3, 2) { @@ -86,7 +90,7 @@ EngineDialog::EngineDialog () /* figure out available devices and set up interface_combo */ enumerate_devices (); - driver_combo.signal_changed().connect (mem_fun (*this, &EngineDialog::driver_changed)); + driver_combo.signal_changed().connect (mem_fun (*this, &EngineControl::driver_changed)); driver_changed (); strings.clear (); @@ -96,6 +100,9 @@ EngineDialog::EngineDialog () set_popdown_strings (audio_mode_combo, strings); audio_mode_combo.set_active_text (strings.front()); + audio_mode_combo.signal_changed().connect (mem_fun (*this, &EngineControl::audio_mode_changed)); + audio_mode_changed (); + label = manage (new Label (_("Driver"))); basic_packer.attach (*label, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (driver_combo, 1, 2, 0, 1, FILL|EXPAND, (AttachOptions) 0); @@ -108,18 +115,44 @@ EngineDialog::EngineDialog () basic_packer.attach (*label, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (sample_rate_combo, 1, 2, 2, 3, FILL|EXPAND, (AttachOptions) 0); - label = manage (new Label (_("Period Size"))); + label = manage (new Label (_("Buffer size"))); basic_packer.attach (*label, 0, 1, 3, 4, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (period_size_combo, 1, 2, 3, 4, FILL|EXPAND, (AttachOptions) 0); - label = manage (new Label (_("Number of periods"))); + label = manage (new Label (_("Number of buffers"))); basic_packer.attach (*label, 0, 1, 4, 5, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (periods_spinner, 1, 2, 4, 5, FILL|EXPAND, (AttachOptions) 0); periods_spinner.set_value (2); - label = manage (new Label (_("Audio Mode"))); + label = manage (new Label (_("Approximate latency"))); basic_packer.attach (*label, 0, 1, 5, 6, FILL|EXPAND, (AttachOptions) 0); - basic_packer.attach (audio_mode_combo, 1, 2, 5, 6, FILL|EXPAND, (AttachOptions) 0); + basic_packer.attach (latency_label, 1, 2, 5, 6, FILL|EXPAND, (AttachOptions) 0); + + sample_rate_combo.signal_changed().connect (mem_fun (*this, &EngineControl::redisplay_latency)); + periods_adjustment.signal_value_changed().connect (mem_fun (*this, &EngineControl::redisplay_latency)); + period_size_combo.signal_changed().connect (mem_fun (*this, &EngineControl::redisplay_latency)); + redisplay_latency(); + + label = manage (new Label (_("Audio Mode"))); + basic_packer.attach (*label, 0, 1, 6, 7, FILL|EXPAND, (AttachOptions) 0); + basic_packer.attach (audio_mode_combo, 1, 2, 6, 7, FILL|EXPAND, (AttachOptions) 0); + + /* + + if (engine_running()) { + start_button.set_sensitive (false); + } else { + stop_button.set_sensitive (false); + } + + start_button.signal_clicked().connect (mem_fun (*this, &EngineControl::start_engine)); + stop_button.signal_clicked().connect (mem_fun (*this, &EngineControl::start_engine)); + */ + + button_box.pack_start (start_button, false, false); + button_box.pack_start (stop_button, false, false); + + // basic_packer.attach (button_box, 0, 2, 8, 9, FILL|EXPAND, (AttachOptions) 0); /* options */ @@ -129,7 +162,7 @@ EngineDialog::EngineDialog () options_packer.attach (priority_spinner, 1, 2, 1, 2, FILL|EXPAND, (AttachOptions) 0); priority_spinner.set_value (60); - realtime_button.signal_toggled().connect (mem_fun (*this, &EngineDialog::realtime_changed)); + realtime_button.signal_toggled().connect (mem_fun (*this, &EngineControl::realtime_changed)); realtime_changed (); #ifndef __APPLE @@ -213,42 +246,29 @@ EngineDialog::EngineDialog () label = manage (new Label (_("Output channels"))); device_packer.attach (*label, 0, 1, 3, 4, FILL|EXPAND, (AttachOptions) 0); device_packer.attach (output_channels, 1, 2, 3, 4, FILL|EXPAND, (AttachOptions) 0); - label = manage (new Label (_("Input latency"))); + label = manage (new Label (_("Input latency (samples)"))); device_packer.attach (*label, 0, 1, 4, 5, FILL|EXPAND, (AttachOptions) 0); device_packer.attach (input_latency, 1, 2, 4, 5, FILL|EXPAND, (AttachOptions) 0); - label = manage (new Label (_("Output latency"))); + label = manage (new Label (_("Output latency (samples)"))); device_packer.attach (*label, 0, 1, 5, 6, FILL|EXPAND, (AttachOptions) 0); device_packer.attach (output_latency, 1, 2, 5, 6, FILL|EXPAND, (AttachOptions) 0); - notebook.pages().push_back (TabElem (basic_packer, _("Parameters"))); + notebook.pages().push_back (TabElem (basic_packer, _("Basics"))); notebook.pages().push_back (TabElem (options_packer, _("Options"))); - notebook.pages().push_back (TabElem (device_packer, _("Device"))); - - get_vbox()->set_border_width (12); - get_vbox()->pack_start (notebook); - - add_button (Stock::OK, RESPONSE_ACCEPT); - start_button = add_button (_("Start"), RESPONSE_YES); - stop_button = add_button (_("Stop"), RESPONSE_NO); + notebook.pages().push_back (TabElem (device_packer, _("Device Parameters"))); - if (engine_running()) { - start_button->set_sensitive (false); - } else { - stop_button->set_sensitive (false); - } - - start_button->signal_clicked().connect (mem_fun (*this, &EngineDialog::start_engine)); - stop_button->signal_clicked().connect (mem_fun (*this, &EngineDialog::start_engine)); + set_border_width (12); + pack_start (notebook); } -EngineDialog::~EngineDialog () +EngineControl::~EngineControl () { } void -EngineDialog::build_command_line (vector<string>& cmd) +EngineControl::build_command_line (vector<string>& cmd) { string str; bool using_oss = false; @@ -335,15 +355,16 @@ EngineDialog::build_command_line (vector<string>& cmd) cmd.push_back (to_string ((uint32_t) floor (periods_spinner.get_value()), std::dec)); cmd.push_back ("-r"); - /* rate string has "Hz" on the end of it */ - uint32_t rate = atoi (sample_rate_combo.get_active_text ()); - cmd.push_back (to_string (rate, std::dec)); + cmd.push_back (to_string (get_rate(), std::dec)); cmd.push_back ("-p"); cmd.push_back (period_size_combo.get_active_text()); if (using_alsa) { + cmd.push_back ("-d"); + cmd.push_back (interface_combo.get_active_text()); + if (hw_meter_button.get_active()) { cmd.push_back ("-M"); } @@ -383,7 +404,7 @@ EngineDialog::build_command_line (vector<string>& cmd) } bool -EngineDialog::engine_running () +EngineControl::engine_running () { jack_status_t status; jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status); @@ -395,43 +416,60 @@ EngineDialog::engine_running () return false; } -void -EngineDialog::start_engine () +int +EngineControl::start_engine () { vector<string> args; - std::string cwd; + std::string cwd = "/tmp"; + int ret = 0; build_command_line (args); - cerr << "will execute:\n"; + ofstream jackdrc ("/home/paul/.jackdrc"); + if (!jackdrc) { + error << _("cannot open JACK rc file to store parameters") << endmsg; + return -1; + } + for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) { - cerr << (*i) << ' '; + jackdrc << (*i) << ' '; } - cerr << endl; + jackdrc << endl; + jackdrc.close (); + +#if 0 try { - // spawn_async_with_pipes (cwd, args, SpawnFlags (0), sigc::slot<void>(), &engine_pid, &engine_stdin, &engine_stdout, &engine_stderr); + spawn_async_with_pipes (cwd, args, SpawnFlags (0), sigc::slot<void>(), &engine_pid, &engine_stdin, &engine_stdout, &engine_stderr); } catch (Glib::Exception& err) { - cerr << "spawn failed\n"; + error << _("could not start JACK server: ") << err.what() << endmsg; + ret = -1; } +#endif + + return ret; } -void -EngineDialog::stop_engine () +int +EngineControl::stop_engine () { + close (engine_stdin); + close (engine_stderr); + close (engine_stdout); spawn_close_pid (engine_pid); + return 0; } void -EngineDialog::realtime_changed () +EngineControl::realtime_changed () { priority_spinner.set_sensitive (realtime_button.get_active()); } void -EngineDialog::enumerate_devices () +EngineControl::enumerate_devices () { /* note: case matters for the map keys */ @@ -448,14 +486,14 @@ EngineDialog::enumerate_devices () #ifdef __APPLE vector<string> -EngineDialog::enumerate_coreaudio_devices () +EngineControl::enumerate_coreaudio_devices () { vector<string> devs; return devs; } #else vector<string> -EngineDialog::enumerate_alsa_devices () +EngineControl::enumerate_alsa_devices () { vector<string> devs; devs.push_back ("hw:0"); @@ -465,25 +503,25 @@ EngineDialog::enumerate_alsa_devices () return devs; } vector<string> -EngineDialog::enumerate_ffado_devices () +EngineControl::enumerate_ffado_devices () { vector<string> devs; return devs; } vector<string> -EngineDialog::enumerate_oss_devices () +EngineControl::enumerate_oss_devices () { vector<string> devs; return devs; } vector<string> -EngineDialog::enumerate_dummy_devices () +EngineControl::enumerate_dummy_devices () { vector<string> devs; return devs; } vector<string> -EngineDialog::enumerate_netjack_devices () +EngineControl::enumerate_netjack_devices () { vector<string> devs; return devs; @@ -491,7 +529,7 @@ EngineDialog::enumerate_netjack_devices () #endif void -EngineDialog::driver_changed () +EngineControl::driver_changed () { string driver = driver_combo.get_active_text(); vector<string>& strings = devices[driver]; @@ -516,3 +554,36 @@ EngineDialog::driver_changed () monitor_button.set_sensitive (false); } } + +uint32_t +EngineControl::get_rate () +{ + return atoi (sample_rate_combo.get_active_text ()); +} + +void +EngineControl::redisplay_latency () +{ + uint32_t rate = get_rate(); + float periods = periods_adjustment.get_value(); + float period_size = atof (period_size_combo.get_active_text()); + + char buf[32]; + snprintf (buf, sizeof(buf), "%.1fmsec", (periods * period_size) / (rate/1000.0)); + + latency_label.set_text (buf); +} + +void +EngineControl::audio_mode_changed () +{ + Glib::ustring str = audio_mode_combo.get_active_text(); + + if (str == _("Duplex")) { + input_device_combo.set_sensitive (false); + output_device_combo.set_sensitive (false); + } else { + input_device_combo.set_sensitive (true); + output_device_combo.set_sensitive (true); + } +} diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 3744d1d121..14eb56fc9a 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -12,15 +12,17 @@ #include <gtkmm/table.h> #include <gtkmm/expander.h> #include <gtkmm/box.h> +#include <gtkmm/buttonbox.h> +#include <gtkmm/button.h> -#include "ardour_dialog.h" - -class EngineDialog : public ArdourDialog { +class EngineControl : public Gtk::VBox { public: - EngineDialog (); - ~EngineDialog (); + EngineControl (); + ~EngineControl (); static bool engine_running (); + int start_engine (); + int stop_engine (); private: Gtk::Adjustment periods_adjustment; @@ -33,6 +35,7 @@ class EngineDialog : public ArdourDialog { Gtk::SpinButton output_channels; Gtk::SpinButton input_latency; Gtk::SpinButton output_latency; + Gtk::Label latency_label; Gtk::CheckButton realtime_button; Gtk::CheckButton no_memory_lock_button; @@ -43,6 +46,10 @@ class EngineDialog : public ArdourDialog { Gtk::CheckButton hw_monitor_button; Gtk::CheckButton hw_meter_button; Gtk::CheckButton verbose_output_button; + + Gtk::Button start_button; + Gtk::Button stop_button; + Gtk::HButtonBox button_box; Gtk::ComboBoxText sample_rate_combo; Gtk::ComboBoxText period_size_combo; @@ -63,15 +70,10 @@ class EngineDialog : public ArdourDialog { Gtk::Notebook notebook; - Gtk::Button* start_button; - Gtk::Button* stop_button; - void realtime_changed (); void driver_changed (); void build_command_line (std::vector<std::string>&); - void start_engine (); - void stop_engine (); Glib::Pid engine_pid; int engine_stdin; int engine_stdout; @@ -88,6 +90,10 @@ class EngineDialog : public ArdourDialog { std::vector<std::string> enumerate_ffado_devices (); std::vector<std::string> enumerate_dummy_devices (); #endif + + void redisplay_latency (); + uint32_t get_rate(); + void audio_mode_changed (); }; #endif /* __gtk2_ardour_engine_dialog_h__ */ diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index d40c5b257a..21d983bff7 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -46,7 +46,7 @@ #include "i18n.h" using namespace Gtk; -using namespace GTK_ARDOUR; +using namespace ARDOUR_COMMAND_LINE; using namespace ARDOUR; using namespace PBD; using namespace sigc; @@ -67,95 +67,6 @@ show_ui_callback (void *arg) return FALSE; } -void -gui_jack_error () -{ - MessageDialog win (_("Ardour could not connect to JACK."), - false, - Gtk::MESSAGE_INFO, - (Gtk::ButtonsType)(Gtk::BUTTONS_NONE)); -win.set_secondary_text(_("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 \"ardour\".\n\ -\n\ -Please consider the possibilities, and perhaps (re)start JACK.")); - - win.add_button (Stock::QUIT, RESPONSE_CLOSE); - win.set_default_response (RESPONSE_CLOSE); - - win.show_all (); - win.set_position (Gtk::WIN_POS_CENTER); - - if (!no_splash) { - ui->hide_splash (); - } - - /* we just don't care about the result, but we want to block */ - - win.run (); -} - -static bool -maybe_load_session () -{ - /* If no session name is given: we're not loading a session yet, nor creating a new one */ - if (!session_name.length()) { - ui->hide_splash (); - if (!Config->get_no_new_session_dialog()) { - if (!ui->new_session ()) { - return false; - } - } - - return true; - } - - /* Load session or start the new session dialog */ - string name, path; - - bool isnew; - - if (Session::find_session (session_name, path, name, isnew)) { - error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; - return false; - } - - if (!new_session) { - - /* Loading a session, but the session doesn't exist */ - if (isnew) { - error << string_compose (_("\n\nNo session named \"%1\" exists.\n" - "To create it from the command line, start ardour as \"ardour --new %1"), path) - << endmsg; - return false; - } - - if (ui->load_session (path, name)) { - /* it failed */ - return false; - } - - } else { - - /* TODO: This bit of code doesn't work properly yet - Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path)); - ui->set_will_create_new_session_automatically (true); - */ - - /* Show the NSD */ - ui->hide_splash (); - if (!Config->get_no_new_session_dialog()) { - if (!ui->new_session ()) { - return false; - } - } - } - - return true; -} - #ifdef VST_SUPPORT /* this is called from the entry point of a wine-compiled executable that is linked against gtk2_ardour built @@ -168,7 +79,6 @@ int main (int argc, char *argv[]) #endif { - ARDOUR::AudioEngine *engine; vector<Glib::ustring> null_file_list; Glib::thread_init(); @@ -235,10 +145,6 @@ int main (int argc, char *argv[]) exit (1); } - if (!keybindings_path.empty()) { - ui->set_keybindings_path (keybindings_path); - } - if (!no_splash) { ui->show_splash (); if (session_name.length()) { @@ -246,45 +152,15 @@ int main (int argc, char *argv[]) } } - try { - ARDOUR::init (use_vst, try_hw_optimization); - setup_gtk_ardour_enums (); - Config->set_current_owner (ConfigVariableBase::Interface); - ui->setup_profile (); - - try { - engine = new ARDOUR::AudioEngine (jack_client_name); - } catch (AudioEngine::NoBackendAvailable& err) { - gui_jack_error (); - error << string_compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg; - return -1; - } - - ui->set_engine (*engine); - - } catch (failed_constructor& err) { - error << _("could not initialize Ardour.") << endmsg; - return -1; - } - - ui->start_engine (); - - if (maybe_load_session ()) { - ui->run (text_receiver); - ui = 0; + if (!keybindings_path.empty()) { + ui->set_keybindings_path (keybindings_path); } - delete engine; - ARDOUR::cleanup (); + ui->run (text_receiver); + ui = 0; - if (ui) { - ui->kill(); - } - + ARDOUR::cleanup (); pthread_cancel_all (); - - exit (0); - return 0; } #ifdef VST_SUPPORT diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index c25f3606d6..d5d635dafc 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -22,6 +22,7 @@ #include <ardour/recent_sessions.h> #include <ardour/session.h> +#include <ardour/profile.h> #include <gtkmm/entry.h> #include <gtkmm/filechooserbutton.h> @@ -41,9 +42,10 @@ using namespace Gtkmm2ext; NewSessionDialog::NewSessionDialog() : ArdourDialog ("session control") { + in_destructor = false; session_name_label = Gtk::manage(new class Gtk::Label(_("Name :"))); m_name = Gtk::manage(new class Gtk::Entry()); - m_name->set_text(GTK_ARDOUR::session_name); + m_name->set_text(ARDOUR_COMMAND_LINE::session_name); chan_count_label_1 = Gtk::manage(new class Gtk::Label(_("channels"))); chan_count_label_2 = Gtk::manage(new class Gtk::Label(_("channels"))); @@ -305,7 +307,10 @@ NewSessionDialog::NewSessionDialog() new_session_table->attach(*m_folder, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::FILL, 0, 0); new_session_table->attach(*session_template_label, 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0); new_session_table->attach(*m_template, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::FILL, 0, 0); - new_session_table->attach(*advanced_expander, 0, 2, 3, 4, Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 6); + + if (!ARDOUR::Profile->get_sae()) { + new_session_table->attach(*advanced_expander, 0, 2, 3, 4, Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 6); + } open_session_hbox->pack_start(*open_session_file_label, false, false, 12); open_session_hbox->pack_start(*m_open_filechooser, true, true, 12); @@ -333,12 +338,14 @@ NewSessionDialog::NewSessionDialog() recent_frame->set_label_widget(*recent_sesion_label); open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0); open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12); + m_notebook->set_flags(Gtk::CAN_FOCUS); m_notebook->set_scrollable(true); m_notebook->append_page(*new_session_table, _("New Session")); m_notebook->pages().back().set_tab_label_packing(false, true, Gtk::PACK_START); m_notebook->append_page(*open_session_vbox, _("Open Session")); m_notebook->pages().back().set_tab_label_packing(false, true, Gtk::PACK_START); + get_vbox()->set_homogeneous(false); get_vbox()->set_spacing(0); get_vbox()->pack_start(*m_notebook, Gtk::PACK_SHRINK, 0); @@ -355,7 +362,7 @@ NewSessionDialog::NewSessionDialog() // add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CANCEL); add_button(Gtk::Stock::CLEAR, Gtk::RESPONSE_NONE); - m_okbutton = add_button(Gtk::Stock::NEW, Gtk::RESPONSE_OK); + m_okbutton = add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); recent_model = Gtk::TreeStore::create (recent_columns); m_treeview->set_model (recent_model); @@ -411,7 +418,7 @@ NewSessionDialog::NewSessionDialog() set_default_response (Gtk::RESPONSE_OK); - if (!GTK_ARDOUR::session_name.length()) { + if (!ARDOUR_COMMAND_LINE::session_name.length()) { set_response_sensitive (Gtk::RESPONSE_OK, false); set_response_sensitive (Gtk::RESPONSE_NONE, false); } else { @@ -436,12 +443,36 @@ NewSessionDialog::NewSessionDialog() m_name->grab_focus(); } +NewSessionDialog::~NewSessionDialog() +{ + in_destructor = true; +} + +void +NewSessionDialog::set_have_engine (bool yn) +{ + if (yn) { + cerr << "removing audio page\n"; + m_notebook->remove_page (engine_control); + } else { + cerr << "appending audio page\n"; + m_notebook->append_page (engine_control, _("Audio Setup")); + m_notebook->show_all_children(); + } +} + void NewSessionDialog::set_session_name(const Glib::ustring& name) { m_name->set_text(name); } +void +NewSessionDialog::set_session_folder(const Glib::ustring& dir) +{ + // XXX DO SOMETHING +} + std::string NewSessionDialog::session_name() const { @@ -605,11 +636,13 @@ NewSessionDialog::on_new_session_name_entry_changed () void NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum) { + if (in_destructor) { + return; + } + if (pagenum == 1) { on_new_session_page = false; - m_okbutton->set_label(_("Open")); set_response_sensitive (Gtk::RESPONSE_NONE, false); - // m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))); if (m_treeview->get_selection()->count_selected_rows() == 0) { set_response_sensitive (Gtk::RESPONSE_OK, false); } else { @@ -620,8 +653,6 @@ NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum) if (m_name->get_text() != "") { set_response_sensitive (Gtk::RESPONSE_NONE, true); } - m_okbutton->set_label(_("New")); - // m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON))); if (m_name->get_text() == "") { set_response_sensitive (Gtk::RESPONSE_OK, false); } else { diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h index 8d1ae77358..2a72670a92 100644 --- a/gtk2_ardour/new_session_dialog.h +++ b/gtk2_ardour/new_session_dialog.h @@ -38,6 +38,7 @@ #include <glibmm/refptr.h> #include "ardour_dialog.h" +#include "engine_dialog.h" namespace Gtk { class Entry; @@ -54,8 +55,10 @@ class NewSessionDialog : public ArdourDialog public: NewSessionDialog(); + ~NewSessionDialog (); void set_session_name(const Glib::ustring& name); + void set_session_folder(const Glib::ustring& folder); std::string session_name() const; std::string session_folder() const; @@ -88,11 +91,14 @@ public: // reset everything to default values. void reset(); + EngineControl engine_control; + void set_have_engine (bool yn); + protected: void reset_name(); void reset_template(); - + Gtk::Label * session_name_label; Gtk::Label * session_location_label; Gtk::Label * session_template_label; @@ -170,6 +176,7 @@ protected: RecentSessionModelColumns recent_columns; Glib::RefPtr<Gtk::TreeStore> recent_model; + bool in_destructor; void recent_session_selection_changed (); void nsd_redisplay_recent_sessions(); @@ -193,8 +200,7 @@ protected: void monitor_bus_button_clicked (); bool on_new_session_page; - - + bool have_engine; }; #endif // NEW_SESSION_DIALOG_H diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc index 6e3e760a35..665233ea1f 100644 --- a/gtk2_ardour/opts.cc +++ b/gtk2_ardour/opts.cc @@ -27,19 +27,19 @@ using namespace std; -string GTK_ARDOUR::session_name = ""; -string GTK_ARDOUR::jack_client_name = "ardour"; -bool GTK_ARDOUR::show_key_actions = false; -bool GTK_ARDOUR::no_splash = true; -bool GTK_ARDOUR::just_version = false; -bool GTK_ARDOUR::use_vst = true; -bool GTK_ARDOUR::new_session = false; -char* GTK_ARDOUR::curvetest_file = 0; -bool GTK_ARDOUR::try_hw_optimization = true; -string GTK_ARDOUR::keybindings_path = ""; /* empty means use builtin default */ -string GTK_ARDOUR::menus_file = "ardour.menus"; - -using namespace GTK_ARDOUR; +Glib::ustring ARDOUR_COMMAND_LINE::session_name = ""; +string ARDOUR_COMMAND_LINE::jack_client_name = "ardour"; +bool ARDOUR_COMMAND_LINE::show_key_actions = false; +bool ARDOUR_COMMAND_LINE::no_splash = true; +bool ARDOUR_COMMAND_LINE::just_version = false; +bool ARDOUR_COMMAND_LINE::use_vst = true; +bool ARDOUR_COMMAND_LINE::new_session = false; +char* ARDOUR_COMMAND_LINE::curvetest_file = 0; +bool ARDOUR_COMMAND_LINE::try_hw_optimization = true; +Glib::ustring ARDOUR_COMMAND_LINE::keybindings_path = ""; /* empty means use builtin default */ +Glib::ustring ARDOUR_COMMAND_LINE::menus_file = "ardour.menus"; + +using namespace ARDOUR_COMMAND_LINE; int print_help (const char *execname) @@ -66,11 +66,15 @@ print_help (const char *execname) } int -GTK_ARDOUR::parse_opts (int argc, char *argv[]) +ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[]) { const char *optstring = "U:hSbvVnOc:C:m:N:k:"; const char *execname = strrchr (argv[0], '/'); + if (getenv ("ARDOUR_SAE")) { + menus_file = "ardour-sae.menus"; + } + if (execname == 0) { execname = argv[0]; } else { diff --git a/gtk2_ardour/opts.h b/gtk2_ardour/opts.h index 8f88b5224b..ff3bf0b481 100644 --- a/gtk2_ardour/opts.h +++ b/gtk2_ardour/opts.h @@ -21,23 +21,22 @@ #define __ardour_opts_h__ #include <string> +#include <glibmm/ustring.h> -using std::string; +namespace ARDOUR_COMMAND_LINE { -namespace GTK_ARDOUR { - -extern string session_name; +extern Glib::ustring session_name; extern bool show_key_actions; extern bool no_splash; extern bool just_version; -extern string jack_client_name; +extern std::string jack_client_name; extern bool use_vst; extern bool new_session; extern char* curvetest_file; extern bool try_hw_optimization; extern bool use_gtk_theme; -extern string keybindings_path; -extern string menus_file; +extern Glib::ustring keybindings_path; +extern Glib::ustring menus_file; extern int32_t parse_opts (int argc, char *argv[]); diff --git a/libs/ardour/ardour/profile.h b/libs/ardour/ardour/profile.h index 3347447915..4257607887 100644 --- a/libs/ardour/ardour/profile.h +++ b/libs/ardour/ardour/profile.h @@ -29,6 +29,7 @@ class RuntimeProfile { public: enum Element { SmallScreen, + SAE, LastElement }; @@ -38,6 +39,9 @@ class RuntimeProfile { void set_small_screen() { bits[SmallScreen] = true; } bool get_small_screen() const { return bits[SmallScreen]; } + void set_sae () { bits[SAE] = true; } + bool get_sae () const { return bits[SAE]; } + private: boost::dynamic_bitset<uint64_t> bits; diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 3654e647a3..457c68ce3b 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -1034,10 +1034,6 @@ AudioEngine::connect_to_jack (string client_name) return -1; } - if (status & JackServerStarted) { - info << _("JACK server started") << endmsg; - } - if (status & JackNameNotUnique) { jack_client_name = jack_get_client_name (_jack); } |