summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-01-18 19:58:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-01-18 19:58:34 +0000
commitdf1da084eddfb2f9b2016595649b435be43c15d3 (patch)
treec28f5b9bf75fb803a722a72949f3b68172dc5a0f /libs
parent7356c65a2a35c8059d5132df7e9f149617952232 (diff)
permit OSX native package without JACK; prevent excessive track name lengths from messing up JACK port names; splash screen tweaks for OS X; new region gain control operations ; work on AU plugin GUIs (totally incomplete); don't needlessly create prompters in a barcontroller (create on demand)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2938 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/io.h5
-rw-r--r--libs/ardour/audio_unit.cc2
-rw-r--r--libs/ardour/audioengine.cc3
-rw-r--r--libs/ardour/io.cc146
-rw-r--r--libs/ardour/rb_effect.cc22
-rw-r--r--libs/gtkmm2ext/binding_proxy.cc22
-rw-r--r--libs/gtkmm2ext/gtk_ui.cc3
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/binding_proxy.h4
8 files changed, 117 insertions, 90 deletions
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 1bd913aec9..db0a097490 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -399,8 +399,9 @@ class IO : public PBD::StatefulDestructible
bool ensure_inputs_locked (uint32_t, bool clear, void *src);
bool ensure_outputs_locked (uint32_t, bool clear, void *src);
- int32_t find_input_port_hole ();
- int32_t find_output_port_hole ();
+ std::string build_legal_port_name (bool for_input);
+ int32_t find_input_port_hole (const char* base);
+ int32_t find_output_port_hole (const char* base);
};
} // namespace ARDOUR
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index c8dae0406a..dae5eea99e 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -512,7 +512,7 @@ PluginInfoList
AUPluginInfo::discover ()
{
PluginInfoList plugs;
-
+
discover_fx (plugs);
discover_music (plugs);
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 2d8d225630..2337e51481 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -1060,9 +1060,8 @@ AudioEngine::connect_to_jack (string client_name)
const char *server_name = NULL;
jack_client_name = client_name; /* might be reset below */
-
_jack = jack_client_open (jack_client_name.c_str(), options, &status, server_name);
-
+
if (_jack == NULL) {
/* just return without an error message. something else will take care of it */
return -1;
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index cc5c812af8..b3bfd82271 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -836,7 +836,6 @@ int
IO::add_output_port (string destination, void* src, DataType type)
{
Port* our_port;
- char name[64];
if (type == DataType::NIL)
type = _default_type;
@@ -854,15 +853,10 @@ IO::add_output_port (string destination, void* src, DataType type)
/* Create a new output port */
- // FIXME: naming scheme for differently typed ports?
- if (_output_maximum == 1) {
- snprintf (name, sizeof (name), _("%s/out"), _name.c_str());
- } else {
- snprintf (name, sizeof (name), _("%s/out %u"), _name.c_str(), find_output_port_hole());
- }
+ string portname = build_legal_port_name (false);
- if ((our_port = _session.engine().register_output_port (type, name)) == 0) {
- error << string_compose(_("IO: cannot register output port %1"), name) << endmsg;
+ if ((our_port = _session.engine().register_output_port (type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register output port %1"), portname) << endmsg;
return -1;
}
@@ -950,7 +944,6 @@ int
IO::add_input_port (string source, void* src, DataType type)
{
Port* our_port;
- char name[64];
if (type == DataType::NIL)
type = _default_type;
@@ -967,15 +960,10 @@ IO::add_input_port (string source, void* src, DataType type)
/* Create a new input port */
- // FIXME: naming scheme for differently typed ports?
- if (_input_maximum == 1) {
- snprintf (name, sizeof (name), _("%s/in"), _name.c_str());
- } else {
- snprintf (name, sizeof (name), _("%s/in %u"), _name.c_str(), find_input_port_hole());
- }
-
- if ((our_port = _session.engine().register_input_port (type, name)) == 0) {
- error << string_compose(_("IO: cannot register input port %1"), name) << endmsg;
+ string portname = build_legal_port_name (true);
+
+ if ((our_port = _session.engine().register_input_port (type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register input port %1"), portname) << endmsg;
return -1;
}
@@ -1067,21 +1055,14 @@ IO::ensure_inputs_locked (uint32_t n, bool clear, void* src)
while (_ninputs < n) {
- char buf[64];
-
/* Create a new input port (of the default type) */
- if (_input_maximum == 1) {
- snprintf (buf, sizeof (buf), _("%s/in"), _name.c_str());
- }
- else {
- snprintf (buf, sizeof (buf), _("%s/in %u"), _name.c_str(), find_input_port_hole());
- }
+ string portname = build_legal_port_name (true);
try {
- if ((input_port = _session.engine().register_input_port (_default_type, buf)) == 0) {
- error << string_compose(_("IO: cannot register input port %1"), buf) << endmsg;
+ if ((input_port = _session.engine().register_input_port (_default_type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register input port %1"), portname) << endmsg;
return -1;
}
}
@@ -1173,20 +1154,13 @@ IO::ensure_io (uint32_t nin, uint32_t nout, bool clear, void* src)
while (_ninputs < nin) {
- char buf[64];
-
/* Create a new input port */
- if (_input_maximum == 1) {
- snprintf (buf, sizeof (buf), _("%s/in"), _name.c_str());
- }
- else {
- snprintf (buf, sizeof (buf), _("%s/in %u"), _name.c_str(), find_input_port_hole());
- }
-
+ string portname = build_legal_port_name (true);
+
try {
- if ((port = _session.engine().register_input_port (_default_type, buf)) == 0) {
- error << string_compose(_("IO: cannot register input port %1"), buf) << endmsg;
+ if ((port = _session.engine().register_input_port (_default_type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register input port %1"), portname) << endmsg;
return -1;
}
}
@@ -1207,19 +1181,11 @@ IO::ensure_io (uint32_t nin, uint32_t nout, bool clear, void* src)
while (_noutputs < nout) {
- char buf[64];
-
- /* Create a new output port */
-
- if (_output_maximum == 1) {
- snprintf (buf, sizeof (buf), _("%s/out"), _name.c_str());
- } else {
- snprintf (buf, sizeof (buf), _("%s/out %u"), _name.c_str(), find_output_port_hole());
- }
-
+ string portname = build_legal_port_name (false);
+
try {
- if ((port = _session.engine().register_output_port (_default_type, buf)) == 0) {
- error << string_compose(_("IO: cannot register output port %1"), buf) << endmsg;
+ if ((port = _session.engine().register_output_port (_default_type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register output port %1"), portname) << endmsg;
return -1;
}
}
@@ -1333,18 +1299,12 @@ IO::ensure_outputs_locked (uint32_t n, bool clear, void* src)
while (_noutputs < n) {
- char buf[64];
-
/* Create a new output port */
- if (_output_maximum == 1) {
- snprintf (buf, sizeof (buf), _("%s/out"), _name.c_str());
- } else {
- snprintf (buf, sizeof (buf), _("%s/out %u"), _name.c_str(), find_output_port_hole());
- }
+ string portname = build_legal_port_name (false);
- if ((output_port = _session.engine().register_output_port (_default_type, buf)) == 0) {
- error << string_compose(_("IO: cannot register output port %1"), buf) << endmsg;
+ if ((output_port = _session.engine().register_output_port (_default_type, portname)) == 0) {
+ error << string_compose(_("IO: cannot register output port %1"), portname) << endmsg;
return -1;
}
@@ -2665,8 +2625,54 @@ IO::transport_stopped (nframes_t frame)
_panner->transport_stopped (frame);
}
+string
+IO::build_legal_port_name (bool in)
+{
+ const int name_size = jack_port_name_size();
+ int limit;
+ char* suffix;
+ int maxports;
+
+ if (in) {
+ suffix = _("in");
+ maxports = _input_maximum;
+ } else {
+ suffix = _("out");
+ maxports = _output_maximum;
+ }
+
+ if (maxports == 1) {
+ // allow space for the slash + the suffix
+ limit = name_size - _session.engine().client_name().length() - (strlen (suffix) + 1);
+ char buf[name_size+1];
+ snprintf (buf, name_size+1, ("%.*s/%s"), limit, _name.c_str(), suffix);
+ return string (buf);
+ }
+
+ // allow up to 4 digits for the output port number, plus the slash, suffix and extra space
+
+ limit = name_size - _session.engine().client_name().length() - (strlen (suffix) + 5);
+
+ char buf1[name_size+1];
+ char buf2[name_size+1];
+
+ snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.c_str(), suffix);
+
+ int port_number;
+
+ if (in) {
+ port_number = find_input_port_hole (buf1);
+ } else {
+ port_number = find_output_port_hole (buf1);
+ }
+
+ snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
+
+ return string (buf2);
+}
+
int32_t
-IO::find_input_port_hole ()
+IO::find_input_port_hole (const char* base)
{
/* CALLER MUST HOLD IO LOCK */
@@ -2676,11 +2682,14 @@ IO::find_input_port_hole ()
return 1;
}
- for (n = 1; n < UINT_MAX; ++n) {
+ /* we only allow up to 4 characters for the port number
+ */
+
+ for (n = 1; n < 9999; ++n) {
char buf[jack_port_name_size()];
vector<Port*>::iterator i;
- snprintf (buf, jack_port_name_size(), _("%s/in %u"), _name.c_str(), n);
+ snprintf (buf, jack_port_name_size(), _("%s %u"), base, n);
for (i = _inputs.begin(); i != _inputs.end(); ++i) {
if ((*i)->short_name() == buf) {
@@ -2696,7 +2705,7 @@ IO::find_input_port_hole ()
}
int32_t
-IO::find_output_port_hole ()
+IO::find_output_port_hole (const char* base)
{
/* CALLER MUST HOLD IO LOCK */
@@ -2706,11 +2715,14 @@ IO::find_output_port_hole ()
return 1;
}
- for (n = 1; n < UINT_MAX; ++n) {
+ /* we only allow up to 4 characters for the port number
+ */
+
+ for (n = 1; n < 9999; ++n) {
char buf[jack_port_name_size()];
vector<Port*>::iterator i;
- snprintf (buf, jack_port_name_size(), _("%s/out %u"), _name.c_str(), n);
+ snprintf (buf, jack_port_name_size(), _("%s %u"), base, n);
for (i = _outputs.begin(); i != _outputs.end(); ++i) {
if ((*i)->short_name() == buf) {
diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc
index a8d22c13b3..f86248d44d 100644
--- a/libs/ardour/rb_effect.cc
+++ b/libs/ardour/rb_effect.cc
@@ -74,9 +74,12 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
nframes_t pos = 0;
int avail = 0;
+ double this_time_fraction = tsr.time_fraction * region->stretch ();
+ double this_pitch_fraction = tsr.pitch_fraction * region->shift ();
+
RubberBandStretcher stretcher (session.frame_rate(), region->n_channels(),
(RubberBandStretcher::Options) tsr.opts,
- tsr.time_fraction, tsr.pitch_fraction);
+ this_time_fraction, this_pitch_fraction);
stretcher.setExpectedInputDuration(region->length());
stretcher.setDebugLevel(1);
@@ -91,14 +94,14 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
digits just to disambiguate close but not identical FX
*/
- if (tsr.time_fraction == 1.0) {
- snprintf (suffix, sizeof (suffix), "@%d", (int) floor (tsr.pitch_fraction * 100.0f));
- } else if (tsr.pitch_fraction == 1.0) {
- snprintf (suffix, sizeof (suffix), "@%d", (int) floor (tsr.time_fraction * 100.0f));
+ if (this_time_fraction == 1.0) {
+ snprintf (suffix, sizeof (suffix), "@%d", (int) floor (this_pitch_fraction * 100.0f));
+ } else if (this_pitch_fraction == 1.0) {
+ snprintf (suffix, sizeof (suffix), "@%d", (int) floor (this_time_fraction * 100.0f));
} else {
snprintf (suffix, sizeof (suffix), "@%d-%d",
- (int) floor (tsr.time_fraction * 100.0f),
- (int) floor (tsr.pitch_fraction * 100.0f));
+ (int) floor (this_time_fraction * 100.0f),
+ (int) floor (this_pitch_fraction * 100.0f));
}
/* create new sources */
@@ -259,9 +262,8 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
nframes_t start;
nframes_t length;
- // note: tsr.time_fraction is a percentage of original length. 100 = no change,
- // 50 is half as long, 200 is twice as long, etc.
-
+ // note: this_time_fraction is a ratio of original length. 1.0 = no change,
+ // 0.5 is half as long, 2.0 is twice as long, etc.
float stretch = (*x)->stretch() * (tsr.time_fraction/100.0);
float shift = (*x)->shift() * tsr.pitch_fraction;
diff --git a/libs/gtkmm2ext/binding_proxy.cc b/libs/gtkmm2ext/binding_proxy.cc
index 3a2f5bbbc8..90f95f82ef 100644
--- a/libs/gtkmm2ext/binding_proxy.cc
+++ b/libs/gtkmm2ext/binding_proxy.cc
@@ -32,13 +32,19 @@ using namespace std;
using namespace PBD;
BindingProxy::BindingProxy (Controllable& c)
- : prompter (Gtk::WIN_POS_MOUSE, 30000, false),
+ : prompter (0),
controllable (c),
bind_button (2),
bind_statemask (Gdk::CONTROL_MASK)
{
- prompter.signal_unmap_event().connect (mem_fun (*this, &BindingProxy::prompter_hiding));
+}
+
+BindingProxy::~BindingProxy ()
+{
+ if (prompter) {
+ delete prompter;
+ }
}
void
@@ -61,8 +67,12 @@ BindingProxy::button_press_handler (GdkEventButton *ev)
if ((ev->state & bind_statemask) && ev->button == bind_button) {
if (Controllable::StartLearning (&controllable)) {
string prompt = _("operate controller now");
- prompter.set_text (prompt);
- prompter.touch (); // shows popup
+ if (prompter == 0) {
+ prompter = new PopUp (Gtk::WIN_POS_MOUSE, 30000, false);
+ prompter->signal_unmap_event().connect (mem_fun (*this, &BindingProxy::prompter_hiding));
+ }
+ prompter->set_text (prompt);
+ prompter->touch (); // shows popup
learning_connection = controllable.LearningFinished.connect (mem_fun (*this, &BindingProxy::learning_finished));
}
return true;
@@ -75,7 +85,9 @@ void
BindingProxy::learning_finished ()
{
learning_connection.disconnect ();
- prompter.touch (); // hides popup
+ if (prompter) {
+ prompter->touch (); // hides popup
+ }
}
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc
index eed78e1fdb..58178056c2 100644
--- a/libs/gtkmm2ext/gtk_ui.cc
+++ b/libs/gtkmm2ext/gtk_ui.cc
@@ -591,7 +591,8 @@ UI::flush_pending ()
bool
UI::just_hide_it (GdkEventAny *ev, Window *win)
{
- win->hide_all ();
+ cerr << "++++ JUST HIDING " << win->get_window() << endl;
+ win->hide ();
return true;
}
diff --git a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
index a26c8ace2a..d8f37c7649 100644
--- a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
+++ b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
@@ -33,7 +33,7 @@ class BindingProxy : public sigc::trackable
{
public:
BindingProxy (PBD::Controllable&);
- virtual ~BindingProxy() {}
+ virtual ~BindingProxy();
void set_bind_button_state (guint button, guint statemask);
void get_bind_button_state (guint &button, guint &statemask);
@@ -42,7 +42,7 @@ class BindingProxy : public sigc::trackable
protected:
- Gtkmm2ext::PopUp prompter;
+ Gtkmm2ext::PopUp* prompter;
PBD::Controllable& controllable;
guint bind_button;
guint bind_statemask;