summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-08-13 15:36:21 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-08-13 15:36:21 +0000
commit0b1c369e15af54cf809140b75af99d72edce24ae (patch)
treec7cd072b03cfd49aab44a1e5bb150c301d155663
parentc25496008816325bf85ac5f777978f7ce351fb1e (diff)
engine dialog work, new -m option for menu file selection, new obolean automation line work starting up
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2293 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/SConscript1
-rw-r--r--gtk2_ardour/actions.cc3
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc9
-rw-r--r--gtk2_ardour/automation_line.cc10
-rw-r--r--gtk2_ardour/automation_line.h2
-rw-r--r--gtk2_ardour/boolean_automation_line.cc59
-rw-r--r--gtk2_ardour/boolean_automation_line.h19
-rw-r--r--gtk2_ardour/engine_dialog.cc474
-rw-r--r--gtk2_ardour/engine_dialog.h53
-rw-r--r--gtk2_ardour/option_editor.cc7
-rw-r--r--gtk2_ardour/opts.cc15
-rw-r--r--gtk2_ardour/opts.h1
-rw-r--r--gtk2_ardour/redirect_box.cc9
-rw-r--r--libs/ardour/insert.cc2
-rw-r--r--libs/pbd/pbd/convert.h10
15 files changed, 597 insertions, 77 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript
index 7a2fa3cbda..b58b94433c 100644
--- a/gtk2_ardour/SConscript
+++ b/gtk2_ardour/SConscript
@@ -100,6 +100,7 @@ automation_line.cc
automation_pan_line.cc
automation_time_axis.cc
axis_view.cc
+boolean_automation_line.cc
canvas-imageframe.c
canvas-simpleline.c
simpleline.cc
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index 40af880f9c..7583d69273 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -32,6 +32,7 @@
#include <ardour/ardour.h>
#include "actions.h"
+#include "opts.h"
#include "i18n.h"
using namespace std;
@@ -65,7 +66,7 @@ ActionManager::init ()
{
ui_manager = UIManager::create ();
- std::string ui_file = ARDOUR::find_config_file("ardour.menus");
+ std::string ui_file = ARDOUR::find_config_file(GTK_ARDOUR::menus_file);
bool loaded = false;
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 15cbc6d58f..c04608825e 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -34,6 +34,7 @@
#include "ardour_ui.h"
#include "public_editor.h"
#include "audio_clock.h"
+#include "engine_dialog.h"
#include "editor.h"
#include "actions.h"
@@ -80,6 +81,8 @@ ARDOUR_UI::install_actions ()
/* menus + submenus that need action items */
ActionManager::register_action (main_actions, X_("Session"), _("Session"));
+ ActionManager::register_action (main_actions, X_("Files"), _("Files"));
+ ActionManager::register_action (main_actions, X_("Regions"), _("Regions"));
ActionManager::register_action (main_actions, X_("Cleanup"), _("Cleanup"));
ActionManager::register_action (main_actions, X_("Sync"), _("Sync"));
ActionManager::register_action (main_actions, X_("Options"), _("Options"));
@@ -157,7 +160,11 @@ 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);
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index d4431ff0f2..83d77490ae 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -1202,14 +1202,20 @@ AutomationLine::reset_callback (const AutomationList& events)
double translated_y = (*ai)->value;
model_to_view_y (translated_y);
- tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
- _height - (translated_y * _height)));
+ add_model_point (tmp_points, (*ai)->when, translated_y);
}
determine_visible_control_points (tmp_points);
}
void
+AutomationLine::add_model_point (ALPoints& tmp_points, double frame, double yfract)
+{
+ tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit (frame),
+ _height - (yfract * _height)));
+}
+
+void
AutomationLine::reset ()
{
update_pending = false;
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index 76afff5097..5c9bf71724 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -204,6 +204,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
void list_changed ();
virtual bool event_handler (GdkEvent*);
+ virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract);
private:
uint32_t drags;
@@ -237,5 +238,6 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
friend class AudioRegionGainLine;
};
+
#endif /* __ardour_automation_line_h__ */
diff --git a/gtk2_ardour/boolean_automation_line.cc b/gtk2_ardour/boolean_automation_line.cc
new file mode 100644
index 0000000000..e2db137644
--- /dev/null
+++ b/gtk2_ardour/boolean_automation_line.cc
@@ -0,0 +1,59 @@
+/*
+ Copyright (C) 2007 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.
+
+*/
+
+#include "boolean_automation_line.h"
+#include "time_axis_view.h"
+#include "public_editor.h"
+
+using namespace std;
+using namespace sigc;
+using namespace ARDOUR;
+using namespace PBD;
+
+void
+BooleanAutomationLine::model_to_view_y (double& y)
+{
+ if (y > 0.5) {
+ y = 1.0;
+ } else {
+ y = 0.0;
+ }
+}
+
+void
+BooleanAutomationLine::view_to_model_y (double& y)
+{
+ if (y > 0.5) {
+ y = 1.0;
+ } else {
+ y = 0.0;
+ }
+}
+
+void
+BooleanAutomationLine::add_model_point (AutomationLine::ALPoints& tmp_points, double frame, double yfract)
+{
+ /* add two points, one to represent "on" and one to represent "off" */
+
+ double x = trackview.editor.frame_to_unit (frame);
+
+ tmp_points.push_back (ALPoint (x > 0 ? x - 1 : 0, _height > 4 ? 2 : 0));
+ tmp_points.push_back (ALPoint (x + 1, _height > 2 ? _height - 2 : _height));
+}
+
diff --git a/gtk2_ardour/boolean_automation_line.h b/gtk2_ardour/boolean_automation_line.h
new file mode 100644
index 0000000000..09d91d155a
--- /dev/null
+++ b/gtk2_ardour/boolean_automation_line.h
@@ -0,0 +1,19 @@
+#ifndef __ardour_gtk_boolean_automation_line_h__
+#define __ardour_gtk_boolean_automation_line_h__
+
+#include "automation_line.h"
+
+class BooleanAutomationLine : public AutomationLine
+{
+ public:
+ BooleanAutomationLine (const string & name, TimeAxisView&, ArdourCanvas::Group&, ARDOUR::AutomationList&);
+ virtual ~BooleanAutomationLine ();
+
+ void view_to_model_y (double&);
+ void model_to_view_y (double&);
+
+ protected:
+ void add_model_point (AutomationLine::ALPoints& tmp_points, double frame, double yfract);
+};
+
+#endif /* __ardour_gtk_boolean_automation_line_h__ */
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc
index 850e93092c..d080141251 100644
--- a/gtk2_ardour/engine_dialog.cc
+++ b/gtk2_ardour/engine_dialog.cc
@@ -1,33 +1,46 @@
#include <vector>
+#include <glibmm.h>
+
+#include <jack/jack.h>
+
#include <gtkmm/stock.h>
#include <gtkmm2ext/utils.h>
+#include <pbd/convert.h>
+
#include "engine_dialog.h"
#include "i18n.h"
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
+using namespace PBD;
+using namespace Glib;
EngineDialog::EngineDialog ()
: ArdourDialog (_("Audio Engine"), false, true),
+ periods_adjustment (2, 2, 16, 1, 2),
+ periods_spinner (periods_adjustment),
+ priority_adjustment (60, 10, 90, 1, 10),
+ priority_spinner (priority_adjustment),
+ ports_adjustment (128, 8, 1024, 1, 16),
+ ports_spinner (ports_adjustment),
realtime_button (_("Realtime")),
no_memory_lock_button (_("Do not lock memory")),
unlock_memory_button (_("Unlock memory")),
soft_mode_button (_("No zombies")),
- monitor_button (_("Monitor ports")),
+ monitor_button (_("Provide monitor ports")),
force16bit_button (_("Force 16 bit")),
hw_monitor_button (_("H/W monitoring")),
hw_meter_button (_("H/W metering")),
verbose_output_button (_("Verbose output")),
- basic_packer (2, 2),
- options_packer (11, 2),
- device_packer (10, 2)
+ basic_packer (5, 2),
+ options_packer (12, 2),
+ device_packer (3, 2)
{
using namespace Notebook_Helpers;
Label* label;
-
vector<string> strings;
strings.push_back (_("8000Hz"));
@@ -38,6 +51,7 @@ EngineDialog::EngineDialog ()
strings.push_back (_("96000Hz"));
strings.push_back (_("192000Hz"));
set_popdown_strings (sample_rate_combo, strings);
+ sample_rate_combo.set_active_text ("48000Hz");
strings.clear ();
strings.push_back ("32");
@@ -50,38 +64,12 @@ EngineDialog::EngineDialog ()
strings.push_back ("4096");
strings.push_back ("8192");
set_popdown_strings (period_size_combo, strings);
+ period_size_combo.set_active_text ("1024");
- /* parameters */
+ /* basic parameters */
basic_packer.set_spacings (6);
- label = manage (new Label (_("Sample Rate")));
- basic_packer.attach (*label, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0);
- basic_packer.attach (sample_rate_combo, 1, 2, 0, 1, FILL|EXPAND, (AttachOptions) 0);
-
- label = manage (new Label (_("Period Size")));
- basic_packer.attach (*label, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
- basic_packer.attach (period_size_combo, 1, 2, 1, 2, FILL|EXPAND, (AttachOptions) 0);
-
-
- /* options */
-
- options_packer.attach (realtime_button, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (no_memory_lock_button, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (unlock_memory_button, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (monitor_button, 0, 1, 3, 4, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (soft_mode_button, 0, 1, 4, 5, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (force16bit_button, 0, 1, 5, 6, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (hw_monitor_button, 0, 1, 6, 7, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (hw_meter_button, 0, 1, 7, 8, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (verbose_output_button, 0, 1, 8, 9, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (priority_spinner, 0, 1, 9, 10, FILL|EXPAND, (AttachOptions) 0);
- options_packer.attach (periods_spinner, 0, 1, 10, 11, FILL|EXPAND, (AttachOptions) 0);
-
- /* device */
-
- device_packer.set_spacings (6);
-
strings.clear ();
#ifndef __APPLE
strings.push_back (X_("ALSA"));
@@ -95,6 +83,12 @@ EngineDialog::EngineDialog ()
set_popdown_strings (driver_combo, strings);
driver_combo.set_active_text (strings.front());
+ /* figure out available devices and set up interface_combo */
+
+ enumerate_devices ();
+ driver_combo.signal_changed().connect (mem_fun (*this, &EngineDialog::driver_changed));
+ driver_changed ();
+
strings.clear ();
strings.push_back (_("Duplex"));
strings.push_back (_("Playback only"));
@@ -103,32 +97,128 @@ EngineDialog::EngineDialog ()
audio_mode_combo.set_active_text (strings.front());
label = manage (new Label (_("Driver")));
- device_packer.attach (*label, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (driver_combo, 1, 2, 0, 1, FILL|EXPAND, (AttachOptions) 0);
+ 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);
+
label = manage (new Label (_("Interface")));
- device_packer.attach (*label, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (interface_combo, 1, 2, 1, 2, FILL|EXPAND, (AttachOptions) 0);
+ basic_packer.attach (*label, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
+ basic_packer.attach (interface_combo, 1, 2, 1, 2, FILL|EXPAND, (AttachOptions) 0);
+
+ label = manage (new Label (_("Sample Rate")));
+ 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")));
+ 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")));
+ 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")));
- device_packer.attach (*label, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (audio_mode_combo, 1, 2, 2, 3, FILL|EXPAND, (AttachOptions) 0);
+ 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);
+
+ /* options */
+
+ options_packer.attach (realtime_button, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0);
+ label = manage (new Label (_("Realtime Priority")));
+ options_packer.attach (*label, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
+ 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_changed ();
+
+#ifndef __APPLE
+ options_packer.attach (no_memory_lock_button, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (unlock_memory_button, 0, 1, 3, 4, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (soft_mode_button, 0, 1, 4, 5, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (monitor_button, 0, 1, 5, 6, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (force16bit_button, 0, 1, 6, 7, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (hw_monitor_button, 0, 1, 7, 8, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (hw_meter_button, 0, 1, 8, 9, FILL|EXPAND, (AttachOptions) 0);
+ options_packer.attach (verbose_output_button, 0, 1, 9, 10, FILL|EXPAND, (AttachOptions) 0);
+#else
+ options_packer.attach (verbose_output_button, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0);
+#endif
+
+ strings.clear ();
+ strings.push_back (_("Ignore"));
+ strings.push_back ("500 msec");
+ strings.push_back ("1 sec");
+ strings.push_back ("2 sec");
+ strings.push_back ("10 sec");
+ set_popdown_strings (timeout_combo, strings);
+ timeout_combo.set_active_text (strings.front ());
+
+ label = manage (new Label (_("Client timeout")));
+ options_packer.attach (*label, 0, 1, 11, 12, (AttachOptions) 0, (AttachOptions) 0);
+ options_packer.attach (timeout_combo, 1, 2, 11, 12, FILL|EXPAND, AttachOptions(0));
+
+ label = manage (new Label (_("Number of ports")));
+ options_packer.attach (*label, 0, 1, 12, 13, (AttachOptions) 0, (AttachOptions) 0);
+ options_packer.attach (ports_spinner, 1, 2, 12, 13, FILL|EXPAND, AttachOptions(0));
+
+ strings.clear ();
+
+ if (Glib::file_test ("/usr/bin/jackd", FILE_TEST_EXISTS)) {
+ strings.push_back ("/usr/bin/jackd");
+ }
+ if (Glib::file_test ("/usr/local/bin/jackd", FILE_TEST_EXISTS)) {
+ strings.push_back ("/usr/local/bin/jackd");
+ }
+ if (Glib::file_test ("/opt/bin/jackd", FILE_TEST_EXISTS)) {
+ strings.push_back ("/opt/bin/jackd");
+ }
+ if (Glib::file_test ("/usr/bin/jackdmp", FILE_TEST_EXISTS)) {
+ strings.push_back ("/usr/bin/jackd");
+ }
+ if (Glib::file_test ("/usr/local/bin/jackdmp", FILE_TEST_EXISTS)) {
+ strings.push_back ("/usr/local/bin/jackd");
+ }
+ if (Glib::file_test ("/opt/bin/jackdmp", FILE_TEST_EXISTS)) {
+ strings.push_back ("/opt/bin/jackd");
+ }
+
+ if (strings.empty()) {
+ fatal << _("No JACK server found anywhere on this system. Please install JACK and restart") << endmsg;
+ /*NOTREACHED*/
+ }
+
+ set_popdown_strings (serverpath_combo, strings);
+ serverpath_combo.set_active_text (strings.front());
+
+ if (strings.size() > 1) {
+ label = manage (new Label (_("Server:")));
+ options_packer.attach (*label, 0, 1, 11, 12, (AttachOptions) 0, (AttachOptions) 0);
+ options_packer.attach (serverpath_combo, 1, 2, 11, 12, FILL|EXPAND, (AttachOptions) 0);
+ }
+
+ /* device settings */
+
+ device_packer.set_spacings (6);
+
label = manage (new Label (_("Input device")));
- device_packer.attach (*label, 0, 1, 3, 4, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (input_device_combo, 1, 2, 3, 4, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (*label, 0, 1, 0, 1, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (input_device_combo, 1, 2, 0, 1, FILL|EXPAND, (AttachOptions) 0);
label = manage (new Label (_("Output device")));
- device_packer.attach (*label, 0, 1, 4, 5, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (output_device_combo, 1, 2, 4, 5, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (*label, 0, 1, 1, 2, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (output_device_combo, 1, 2, 1, 2, FILL|EXPAND, (AttachOptions) 0);
label = manage (new Label (_("Input channels")));
- device_packer.attach (*label, 0, 1, 5, 6, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (input_channels, 1, 2, 5, 6, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (*label, 0, 1, 2, 3, FILL|EXPAND, (AttachOptions) 0);
+ device_packer.attach (input_channels, 1, 2, 2, 3, FILL|EXPAND, (AttachOptions) 0);
label = manage (new Label (_("Output channels")));
- device_packer.attach (*label, 0, 1, 6, 7, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (output_channels, 1, 2, 6, 7, FILL|EXPAND, (AttachOptions) 0);
+ 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")));
- device_packer.attach (*label, 0, 1, 7, 8, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (input_latency, 1, 2, 7, 8, FILL|EXPAND, (AttachOptions) 0);
+ 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")));
- device_packer.attach (*label, 0, 1, 8, 9, FILL|EXPAND, (AttachOptions) 0);
- device_packer.attach (output_latency, 1, 2, 8, 9, FILL|EXPAND, (AttachOptions) 0);
+ 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 (options_packer, _("Options")));
@@ -138,9 +228,291 @@ EngineDialog::EngineDialog ()
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);
+
+ 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));
+
}
EngineDialog::~EngineDialog ()
{
}
+
+void
+EngineDialog::build_command_line (vector<string>& cmd)
+{
+ string str;
+ bool using_oss = false;
+ bool using_alsa = false;
+ bool using_coreaudio = false;
+ bool using_netjack = false;
+ bool using_ffado = false;
+
+ /* first, path to jackd */
+
+ cmd.push_back (serverpath_combo.get_active_text ());
+
+ /* now jackd arguments */
+
+ str = timeout_combo.get_active_text ();
+ if (str != _("Ignore")) {
+ double secs;
+ uint32_t msecs;
+ atof (str);
+ msecs = (uint32_t) floor (secs * 1000.0);
+ cmd.push_back ("-t");
+ cmd.push_back (to_string (msecs, std::dec));
+ }
+
+ if (no_memory_lock_button.get_active()) {
+ cmd.push_back ("-m"); /* no munlock */
+ }
+
+ cmd.push_back ("-p"); /* port max */
+ cmd.push_back (to_string ((uint32_t) floor (ports_spinner.get_value()), std::dec));
+
+ if (realtime_button.get_active()) {
+ cmd.push_back ("-R");
+ cmd.push_back ("-P");
+ cmd.push_back (to_string ((uint32_t) floor (priority_spinner.get_value()), std::dec));
+ }
+
+ if (unlock_memory_button.get_active()) {
+ cmd.push_back ("-u");
+ }
+
+ if (verbose_output_button.get_active()) {
+ cmd.push_back ("-v");
+ }
+
+ /* now add fixed arguments (not user-selectable) */
+
+ cmd.push_back ("-T"); // temporary */
+
+ /* next the driver */
+
+ cmd.push_back ("-d");
+
+ str = driver_combo.get_active_text ();
+ if (str == X_("ALSA")) {
+ using_alsa = true;
+ cmd.push_back ("alsa");
+ } else if (str == X_("OSS")) {
+ using_oss = true;
+ cmd.push_back ("oss");
+ } else if (str == X_("CoreAudio")) {
+ using_coreaudio = true;
+ cmd.push_back ("coreaudio");
+ } else if (str == X_("NetJACK")) {
+ using_netjack = true;
+ cmd.push_back ("netjack");
+ } else if (str == X_("FFADO")) {
+ using_ffado = true;
+ cmd.push_back ("ffado");
+ }
+
+ /* driver arguments */
+
+ str = audio_mode_combo.get_active_text();
+ if (str == _("Duplex")) {
+ /* relax */
+ } else if (str == _("Playback only")) {
+ cmd.push_back ("-P");
+ } else if (str == _("Capture only")) {
+ cmd.push_back ("-C");
+ }
+
+ cmd.push_back ("-n");
+ 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 ("-p");
+ cmd.push_back (period_size_combo.get_active_text());
+
+ if (using_alsa) {
+
+ if (hw_meter_button.get_active()) {
+ cmd.push_back ("-M");
+ }
+
+ if (hw_monitor_button.get_active()) {
+ cmd.push_back ("-H");
+ }
+
+ str = dither_mode_combo.get_active_text();
+ if (str == _("None")) {
+ } else if (str == _("Triangular")) {
+ cmd.push_back ("-z triangular");
+ } else if (str == _("Rectangular")) {
+ cmd.push_back ("-z rectangular");
+ } else if (str == _("Shaped")) {
+ cmd.push_back ("-z shaped");
+ }
+
+ if (force16bit_button.get_active()) {
+ cmd.push_back ("-S");
+ }
+
+ if (soft_mode_button.get_active()) {
+ cmd.push_back ("-s");
+ }
+
+ } else if (using_coreaudio) {
+
+ cmd.push_back ("-I");
+ cmd.push_back (interface_combo.get_active_text());
+
+ } else if (using_oss) {
+
+ } else if (using_netjack) {
+
+ }
+}
+
+bool
+EngineDialog::engine_running ()
+{
+ jack_status_t status;
+ jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
+
+ if (status == 0) {
+ jack_client_close (c);
+ return true;
+ }
+ return false;
+}
+
+void
+EngineDialog::start_engine ()
+{
+ vector<string> args;
+ std::string cwd;
+
+ build_command_line (args);
+
+ cerr << "will execute:\n";
+ for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) {
+ cerr << (*i) << ' ';
+ }
+ cerr << endl;
+
+ try {
+ // 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";
+ }
+}
+
+void
+EngineDialog::stop_engine ()
+{
+ spawn_close_pid (engine_pid);
+}
+
+void
+EngineDialog::realtime_changed ()
+{
+ priority_spinner.set_sensitive (realtime_button.get_active());
+}
+
+void
+EngineDialog::enumerate_devices ()
+{
+ /* note: case matters for the map keys */
+
+#ifdef __APPLE
+ devices["CoreAudio"] = enumerate_coreaudio_devices ();
+#else
+ devices["ALSA"] = enumerate_alsa_devices ();
+ devices["FFADO"] = enumerate_ffado_devices ();
+ devices["OSS"] = enumerate_oss_devices ();
+ devices["Dummy"] = enumerate_dummy_devices ();
+ devices["NetJACK"] = enumerate_netjack_devices ();
+#endif
+}
+
+#ifdef __APPLE
+vector<string>
+EngineDialog::enumerate_coreaudio_devices ()
+{
+ vector<string> devs;
+ return devs;
+}
+#else
+vector<string>
+EngineDialog::enumerate_alsa_devices ()
+{
+ vector<string> devs;
+ devs.push_back ("hw:0");
+ devs.push_back ("hw:1");
+ devs.push_back ("plughw:0");
+ devs.push_back ("plughw:1");
+ return devs;
+}
+vector<string>
+EngineDialog::enumerate_ffado_devices ()
+{
+ vector<string> devs;
+ return devs;
+}
+vector<string>
+EngineDialog::enumerate_oss_devices ()
+{
+ vector<string> devs;
+ return devs;
+}
+vector<string>
+EngineDialog::enumerate_dummy_devices ()
+{
+ vector<string> devs;
+ return devs;
+}
+vector<string>
+EngineDialog::enumerate_netjack_devices ()
+{
+ vector<string> devs;
+ return devs;
+}
+#endif
+
+void
+EngineDialog::driver_changed ()
+{
+ string driver = driver_combo.get_active_text();
+ vector<string>& strings = devices[driver];
+
+ set_popdown_strings (interface_combo, strings);
+
+ if (!strings.empty()) {
+ interface_combo.set_active_text (strings.front());
+ }
+
+ if (driver == "ALSA") {
+ soft_mode_button.set_sensitive (true);
+ force16bit_button.set_sensitive (true);
+ hw_monitor_button.set_sensitive (true);
+ hw_meter_button.set_sensitive (true);
+ monitor_button.set_sensitive (true);
+ } else {
+ soft_mode_button.set_sensitive (false);
+ force16bit_button.set_sensitive (false);
+ hw_monitor_button.set_sensitive (false);
+ hw_meter_button.set_sensitive (false);
+ monitor_button.set_sensitive (false);
+ }
+}
diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h
index 1e6ac40ccb..3744d1d121 100644
--- a/gtk2_ardour/engine_dialog.h
+++ b/gtk2_ardour/engine_dialog.h
@@ -1,11 +1,17 @@
#ifndef __gtk2_ardour_engine_dialog_h__
#define __gtk2_ardour_engine_dialog_h__
+#include <map>
+#include <vector>
+#include <string>
+
#include <gtkmm/checkbutton.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/notebook.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/table.h>
+#include <gtkmm/expander.h>
+#include <gtkmm/box.h>
#include "ardour_dialog.h"
@@ -14,7 +20,20 @@ class EngineDialog : public ArdourDialog {
EngineDialog ();
~EngineDialog ();
+ static bool engine_running ();
+
private:
+ Gtk::Adjustment periods_adjustment;
+ Gtk::SpinButton periods_spinner;
+ Gtk::Adjustment priority_adjustment;
+ Gtk::SpinButton priority_spinner;
+ Gtk::Adjustment ports_adjustment;
+ Gtk::SpinButton ports_spinner;
+ Gtk::SpinButton input_channels;
+ Gtk::SpinButton output_channels;
+ Gtk::SpinButton input_latency;
+ Gtk::SpinButton output_latency;
+
Gtk::CheckButton realtime_button;
Gtk::CheckButton no_memory_lock_button;
Gtk::CheckButton unlock_memory_button;
@@ -24,13 +43,6 @@ class EngineDialog : public ArdourDialog {
Gtk::CheckButton hw_monitor_button;
Gtk::CheckButton hw_meter_button;
Gtk::CheckButton verbose_output_button;
-
- Gtk::SpinButton priority_spinner;
- Gtk::SpinButton periods_spinner;
- Gtk::SpinButton input_channels;
- Gtk::SpinButton output_channels;
- Gtk::SpinButton input_latency;
- Gtk::SpinButton output_latency;
Gtk::ComboBoxText sample_rate_combo;
Gtk::ComboBoxText period_size_combo;
@@ -39,7 +51,6 @@ class EngineDialog : public ArdourDialog {
Gtk::ComboBoxText serverpath_combo;
Gtk::ComboBoxText driver_combo;
Gtk::ComboBoxText interface_combo;
- Gtk::ComboBoxText port_maximum_combo;
Gtk::ComboBoxText timeout_combo;
Gtk::ComboBoxText dither_mode_combo;
Gtk::ComboBoxText audio_mode_combo;
@@ -51,6 +62,32 @@ class EngineDialog : public ArdourDialog {
Gtk::Table device_packer;
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;
+ int engine_stderr;
+
+ std::map<std::string,std::vector<std::string> > devices;
+ void enumerate_devices ();
+#ifdef __APPLE
+ std::vector<std::string> enumerate_coreaudio_devices ();
+#else
+ std::vector<std::string> enumerate_alsa_devices ();
+ std::vector<std::string> enumerate_oss_devices ();
+ std::vector<std::string> enumerate_netjack_devices ();
+ std::vector<std::string> enumerate_ffado_devices ();
+ std::vector<std::string> enumerate_dummy_devices ();
+#endif
};
#endif /* __gtk2_ardour_engine_dialog_h__ */
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index c81423dab8..e68be7149c 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -359,6 +359,9 @@ OptionEditor::setup_midi_options ()
redisplay_midi_ports ();
+ mmc_receive_device_id_adjustment.set_value (Config->get_mmc_receive_device_id());
+ mmc_send_device_id_adjustment.set_value (Config->get_mmc_send_device_id());
+
mmc_receive_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_receive_device_id_adjusted));
mmc_send_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_send_device_id_adjusted));
@@ -704,7 +707,6 @@ void
OptionEditor::mmc_receive_device_id_adjusted ()
{
uint8_t id = (uint8_t) mmc_receive_device_id_spinner.get_value();
-
Config->set_mmc_receive_device_id (id);
}
@@ -712,9 +714,6 @@ void
OptionEditor::mmc_send_device_id_adjusted ()
{
uint8_t id = (uint8_t) mmc_send_device_id_spinner.get_value();
-
- cerr << "New send ID = " << (int) id << endl;
-
Config->set_mmc_send_device_id (id);
}
diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc
index 608f684fc9..6e3e760a35 100644
--- a/gtk2_ardour/opts.cc
+++ b/gtk2_ardour/opts.cc
@@ -37,6 +37,7 @@ 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;
@@ -49,9 +50,10 @@ print_help (const char *execname)
<< _(" -b, --bindings Print all possible keyboard binding names\n")
<< _(" -n, --show-splash Show splash screen\n")
<< _(" -c, --name name Use a specific jack client name, default is ardour\n")
- << _(" -N, --new session-name Create a new session from the command line\n")
+ << _(" -m, --menus file Use \"file\" for Ardour menus\n")
+ << _(" -N, --new session-name Create a new session from the command line\n")
<< _(" -O, --no-hw-optimizations Disable h/w specific optimizations\n")
- << _(" -S, --sync Draw the gui synchronously \n")
+ << _(" -S, --sync Draw the gui synchronously \n")
#ifdef VST_SUPPORT
<< _(" -V, --novst Do not use VST support\n")
#endif
@@ -65,9 +67,8 @@ print_help (const char *execname)
int
GTK_ARDOUR::parse_opts (int argc, char *argv[])
-
{
- const char *optstring = "U:hSbvVnOc:C:N:k:";
+ const char *optstring = "U:hSbvVnOc:C:m:N:k:";
const char *execname = strrchr (argv[0], '/');
if (execname == 0) {
@@ -81,6 +82,7 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[])
{ "help", 0, 0, 'h' },
{ "bindings", 0, 0, 'b' },
{ "show-splash", 0, 0, 'n' },
+ { "menus", 1, 0, 'm'} ,
{ "name", 1, 0, 'c' },
{ "novst", 0, 0, 'V' },
{ "new", 1, 0, 'N' },
@@ -112,10 +114,15 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[])
print_help (execname);
exit (0);
break;
+
case 'b':
show_key_actions = true;
break;
+ case 'm':
+ menus_file = optarg;
+ break;
+
case 'n':
no_splash = false;
break;
diff --git a/gtk2_ardour/opts.h b/gtk2_ardour/opts.h
index fb780fc8aa..8f88b5224b 100644
--- a/gtk2_ardour/opts.h
+++ b/gtk2_ardour/opts.h
@@ -37,6 +37,7 @@ extern char* curvetest_file;
extern bool try_hw_optimization;
extern bool use_gtk_theme;
extern string keybindings_path;
+extern string menus_file;
extern int32_t parse_opts (int argc, char *argv[]);
diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc
index ecff9a697d..438edcb1a6 100644
--- a/gtk2_ardour/redirect_box.cc
+++ b/gtk2_ardour/redirect_box.cc
@@ -395,13 +395,12 @@ RedirectBox::insert_plugin_chosen (boost::shared_ptr<Plugin> plugin)
boost::shared_ptr<Redirect> redirect (new PluginInsert (_session, plugin, _placement));
- redirect->active_changed.connect (bind (mem_fun (*this, &RedirectBox::show_redirect_active_r), boost::weak_ptr<Redirect>(redirect)));
-
uint32_t err_streams;
if (_route->add_redirect (redirect, this, &err_streams)) {
weird_plugin_dialog (*plugin, err_streams, _route);
- // XXX SHAREDPTR delete plugin here .. do we even need to care?
+ } else {
+ redirect->active_changed.connect (bind (mem_fun (*this, &RedirectBox::show_redirect_active_r), boost::weak_ptr<Redirect>(redirect)));
}
}
}
@@ -648,14 +647,14 @@ RedirectBox::show_redirect_active_r (Redirect* r, void *src, boost::weak_ptr<Red
void
RedirectBox::show_redirect_active (boost::weak_ptr<Redirect> weak_redirect)
{
- ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_active), weak_redirect));
-
boost::shared_ptr<Redirect> redirect (weak_redirect.lock());
if (!redirect) {
return;
}
+ ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_active), weak_redirect));
+
Gtk::TreeModel::Children children = model->children();
Gtk::TreeModel::Children::iterator iter = children.begin();
diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc
index f8650c7ee1..78b53e641c 100644
--- a/libs/ardour/insert.cc
+++ b/libs/ardour/insert.cc
@@ -166,7 +166,7 @@ PluginInsert::~PluginInsert ()
void
PluginInsert::automation_list_creation_callback (uint32_t which, AutomationList& alist)
{
- alist.automation_state_changed.connect (sigc::bind (mem_fun (*this, &PluginInsert::auto_state_changed), (which)));
+ alist.automation_state_changed.connect (sigc::bind (mem_fun (*this, &PluginInsert::auto_state_changed), (which)));
}
void
diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h
index 00176659cf..458e4aebe9 100644
--- a/libs/pbd/pbd/convert.h
+++ b/libs/pbd/pbd/convert.h
@@ -22,6 +22,8 @@
#include <string>
#include <vector>
+#include <sstream>
+#include <iostream>
namespace PBD {
@@ -37,6 +39,14 @@ std::string length2string (const int64_t frames, const double sample_rate);
std::vector<std::string> internationalize (const char *, const char **);
bool strings_equal_ignore_case (const std::string& a, const std::string& b);
+template <class T> std::string
+to_string (T t, std::ios_base & (*f)(std::ios_base&))
+{
+ std::ostringstream oss;
+ oss << f << t;
+ return oss.str();
+}
+
} //namespace PBD
#endif /* __pbd_convert_h__ */