fix egregious widespread bug now that JACK has physical MIDI ports; make sample rate label in import dialog red when SR doesn't match

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2438 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-09-09 15:30:01 +00:00
parent 40bc1c239e
commit de97630a21
7 changed files with 68 additions and 58 deletions

View file

@ -87,15 +87,20 @@ Editor::external_audio_dialog ()
sfbrowser->show_all (); sfbrowser->show_all ();
again:
int response = sfbrowser->run (); int response = sfbrowser->run ();
sfbrowser->hide ();
switch (response) { switch (response) {
case RESPONSE_APPLY:
// leave the dialog open
break;
case RESPONSE_OK: case RESPONSE_OK:
sfbrowser->hide ();
break; break;
default: default:
// cancel from the browser - we are done // cancel from the browser - we are done
sfbrowser->hide ();
return; return;
} }
@ -128,6 +133,10 @@ Editor::external_audio_dialog ()
} else { } else {
do_embed (paths, chns, mode, where); do_embed (paths, chns, mode, where);
} }
if (response == RESPONSE_APPLY) {
goto again;
}
} }
boost::shared_ptr<AudioTrack> boost::shared_ptr<AudioTrack>

View file

@ -396,6 +396,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
found_entry.signal_activate().connect(mem_fun(*this, &SoundFileBrowser::found_search_clicked)); found_entry.signal_activate().connect(mem_fun(*this, &SoundFileBrowser::found_search_clicked));
add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::CANCEL, RESPONSE_CANCEL);
add_button (Stock::APPLY, RESPONSE_APPLY);
add_button (Stock::OK, RESPONSE_OK); add_button (Stock::OK, RESPONSE_OK);
} }

View file

@ -121,18 +121,18 @@ class AudioEngine : public sigc::trackable
const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags); const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags);
uint32_t n_physical_outputs () const; uint32_t n_physical_audio_outputs () const;
uint32_t n_physical_inputs () const; uint32_t n_physical_audio_inputs () const;
void get_physical_outputs (std::vector<std::string>&); void get_physical_audio_outputs (std::vector<std::string>&);
void get_physical_inputs (std::vector<std::string>&); void get_physical_audio_inputs (std::vector<std::string>&);
std::string get_nth_physical_output (uint32_t n) { std::string get_nth_physical_audio_output (uint32_t n) {
return get_nth_physical (n, JackPortIsInput); return get_nth_physical_audio (n, JackPortIsInput);
} }
std::string get_nth_physical_input (uint32_t n) { std::string get_nth_physical_audio_input (uint32_t n) {
return get_nth_physical (n, JackPortIsOutput); return get_nth_physical_audio (n, JackPortIsOutput);
} }
nframes_t get_port_total_latency (const Port&); nframes_t get_port_total_latency (const Port&);
@ -225,7 +225,7 @@ class AudioEngine : public sigc::trackable
PortConnections port_connections; PortConnections port_connections;
void remove_connections_for (Port*); void remove_connections_for (Port*);
std::string get_nth_physical (uint32_t which, int flags); std::string get_nth_physical_audio (uint32_t which, int flags);
static int _xrun_callback (void *arg); static int _xrun_callback (void *arg);
static int _graph_order_callback (void *arg); static int _graph_order_callback (void *arg);

View file

@ -1695,8 +1695,8 @@ class Session : public PBD::StatefulDestructible
based on max (requested,available) based on max (requested,available)
*/ */
uint32_t n_physical_outputs; uint32_t n_physical_audio_outputs;
uint32_t n_physical_inputs; uint32_t n_physical_audio_inputs;
int find_all_sources (std::string path, std::set<std::string>& result); int find_all_sources (std::string path, std::set<std::string>& result);
int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot); int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot);

View file

@ -769,7 +769,7 @@ AudioEngine::halted (void *arg)
} }
uint32_t uint32_t
AudioEngine::n_physical_outputs () const AudioEngine::n_physical_audio_outputs () const
{ {
const char ** ports; const char ** ports;
uint32_t i = 0; uint32_t i = 0;
@ -778,7 +778,7 @@ AudioEngine::n_physical_outputs () const
return 0; return 0;
} }
if ((ports = jack_get_ports (_jack, NULL, NULL, JackPortIsPhysical|JackPortIsInput)) == 0) { if ((ports = jack_get_ports (_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsInput)) == 0) {
return 0; return 0;
} }
@ -790,7 +790,7 @@ AudioEngine::n_physical_outputs () const
} }
uint32_t uint32_t
AudioEngine::n_physical_inputs () const AudioEngine::n_physical_audio_inputs () const
{ {
const char ** ports; const char ** ports;
uint32_t i = 0; uint32_t i = 0;
@ -799,7 +799,7 @@ AudioEngine::n_physical_inputs () const
return 0; return 0;
} }
if ((ports = jack_get_ports (_jack, NULL, NULL, JackPortIsPhysical|JackPortIsOutput)) == 0) { if ((ports = jack_get_ports (_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsOutput)) == 0) {
return 0; return 0;
} }
@ -811,7 +811,7 @@ AudioEngine::n_physical_inputs () const
} }
void void
AudioEngine::get_physical_inputs (vector<string>& ins) AudioEngine::get_physical_audio_inputs (vector<string>& ins)
{ {
const char ** ports; const char ** ports;
uint32_t i = 0; uint32_t i = 0;
@ -820,7 +820,7 @@ AudioEngine::get_physical_inputs (vector<string>& ins)
return; return;
} }
if ((ports = jack_get_ports (_jack, NULL, NULL, JackPortIsPhysical|JackPortIsOutput)) == 0) { if ((ports = jack_get_ports (_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsOutput)) == 0) {
return; return;
} }
@ -833,7 +833,7 @@ AudioEngine::get_physical_inputs (vector<string>& ins)
} }
void void
AudioEngine::get_physical_outputs (vector<string>& outs) AudioEngine::get_physical_audio_outputs (vector<string>& outs)
{ {
const char ** ports; const char ** ports;
uint32_t i = 0; uint32_t i = 0;
@ -842,7 +842,7 @@ AudioEngine::get_physical_outputs (vector<string>& outs)
return; return;
} }
if ((ports = jack_get_ports (_jack, NULL, NULL, JackPortIsPhysical|JackPortIsInput)) == 0) { if ((ports = jack_get_ports (_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsInput)) == 0) {
return; return;
} }
@ -855,7 +855,7 @@ AudioEngine::get_physical_outputs (vector<string>& outs)
} }
string string
AudioEngine::get_nth_physical (uint32_t n, int flag) AudioEngine::get_nth_physical_audio (uint32_t n, int flag)
{ {
const char ** ports; const char ** ports;
uint32_t i; uint32_t i;
@ -870,7 +870,7 @@ AudioEngine::get_nth_physical (uint32_t n, int flag)
} }
} }
ports = jack_get_ports (_jack, NULL, NULL, JackPortIsPhysical|flag); ports = jack_get_ports (_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|flag);
if (ports == 0) { if (ports == 0) {
return ""; return "";

View file

@ -45,11 +45,11 @@ Auditioner::Auditioner (Session& s)
string right = Config->get_auditioner_output_right(); string right = Config->get_auditioner_output_right();
if (left == "default") { if (left == "default") {
left = _session.engine().get_nth_physical_output (0); left = _session.engine().get_nth_physical_audio_output (0);
} }
if (right == "default") { if (right == "default") {
right = _session.engine().get_nth_physical_output (1); right = _session.engine().get_nth_physical_audio_output (1);
} }
if ((left.length() == 0) && (right.length() == 0)) { if ((left.length() == 0) && (right.length() == 0)) {
@ -195,7 +195,7 @@ Auditioner::output_changed (IOChange change, void* src)
const char ** connections; const char ** connections;
connections = output (0)->get_connections (); connections = output (0)->get_connections ();
if (connections) { if (connections) {
phys = _session.engine().get_nth_physical_output (0); phys = _session.engine().get_nth_physical_audio_output (0);
if (phys != connections[0]) { if (phys != connections[0]) {
Config->set_auditioner_output_left (connections[0]); Config->set_auditioner_output_left (connections[0]);
} else { } else {
@ -208,7 +208,7 @@ Auditioner::output_changed (IOChange change, void* src)
connections = output (1)->get_connections (); connections = output (1)->get_connections ();
if (connections) { if (connections) {
phys = _session.engine().get_nth_physical_output (1); phys = _session.engine().get_nth_physical_audio_output (1);
if (phys != connections[0]) { if (phys != connections[0]) {
Config->set_auditioner_output_right (connections[0]); Config->set_auditioner_output_right (connections[0]);
} else { } else {

View file

@ -282,8 +282,8 @@ Session::Session (AudioEngine &eng,
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (1)" << endl; cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (1)" << endl;
n_physical_outputs = _engine.n_physical_outputs(); n_physical_audio_outputs = _engine.n_physical_audio_outputs();
n_physical_inputs = _engine.n_physical_inputs(); n_physical_audio_inputs = _engine.n_physical_audio_inputs();
first_stage_init (fullpath, snapshot_name); first_stage_init (fullpath, snapshot_name);
@ -344,15 +344,15 @@ Session::Session (AudioEngine &eng,
cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (2)" << endl; cerr << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (2)" << endl;
n_physical_outputs = _engine.n_physical_outputs(); n_physical_audio_outputs = _engine.n_physical_audio_outputs();
n_physical_inputs = _engine.n_physical_inputs(); n_physical_audio_inputs = _engine.n_physical_audio_inputs();
if (n_physical_inputs) { if (n_physical_audio_inputs) {
n_physical_inputs = max (requested_physical_in, n_physical_inputs); n_physical_audio_inputs = max (requested_physical_in, n_physical_audio_inputs);
} }
if (n_physical_outputs) { if (n_physical_audio_outputs) {
n_physical_outputs = max (requested_physical_out, n_physical_outputs); n_physical_audio_outputs = max (requested_physical_out, n_physical_audio_outputs);
} }
first_stage_init (fullpath, snapshot_name); first_stage_init (fullpath, snapshot_name);
@ -707,7 +707,7 @@ Session::when_engine_running ()
/* default state for Click */ /* default state for Click */
first_physical_output = _engine.get_nth_physical_output (0); first_physical_output = _engine.get_nth_physical_audio_output (0);
if (first_physical_output.length()) { if (first_physical_output.length()) {
if (_click_io->add_output_port (first_physical_output, this)) { if (_click_io->add_output_port (first_physical_output, this)) {
@ -735,33 +735,33 @@ Session::when_engine_running ()
/* ONE: MONO */ /* ONE: MONO */
for (uint32_t np = 0; np < n_physical_outputs; ++np) { for (uint32_t np = 0; np < n_physical_audio_outputs; ++np) {
char buf[32]; char buf[32];
snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1);
Connection* c = new OutputConnection (buf, true); Connection* c = new OutputConnection (buf, true);
c->add_port (); c->add_port ();
c->add_connection (0, _engine.get_nth_physical_output (np)); c->add_connection (0, _engine.get_nth_physical_audio_output (np));
add_connection (c); add_connection (c);
} }
for (uint32_t np = 0; np < n_physical_inputs; ++np) { for (uint32_t np = 0; np < n_physical_audio_inputs; ++np) {
char buf[32]; char buf[32];
snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1);
Connection* c = new InputConnection (buf, true); Connection* c = new InputConnection (buf, true);
c->add_port (); c->add_port ();
c->add_connection (0, _engine.get_nth_physical_input (np)); c->add_connection (0, _engine.get_nth_physical_audio_input (np));
add_connection (c); add_connection (c);
} }
/* TWO: STEREO */ /* TWO: STEREO */
for (uint32_t np = 0; np < n_physical_outputs; np +=2) { for (uint32_t np = 0; np < n_physical_audio_outputs; np +=2) {
char buf[32]; char buf[32];
snprintf (buf, sizeof (buf), _("out %" PRIu32 "+%" PRIu32), np+1, np+2); snprintf (buf, sizeof (buf), _("out %" PRIu32 "+%" PRIu32), np+1, np+2);
@ -769,13 +769,13 @@ Session::when_engine_running ()
c->add_port (); c->add_port ();
c->add_port (); c->add_port ();
c->add_connection (0, _engine.get_nth_physical_output (np)); c->add_connection (0, _engine.get_nth_physical_audio_output (np));
c->add_connection (1, _engine.get_nth_physical_output (np+1)); c->add_connection (1, _engine.get_nth_physical_audio_output (np+1));
add_connection (c); add_connection (c);
} }
for (uint32_t np = 0; np < n_physical_inputs; np +=2) { for (uint32_t np = 0; np < n_physical_audio_inputs; np +=2) {
char buf[32]; char buf[32];
snprintf (buf, sizeof (buf), _("in %" PRIu32 "+%" PRIu32), np+1, np+2); snprintf (buf, sizeof (buf), _("in %" PRIu32 "+%" PRIu32), np+1, np+2);
@ -783,8 +783,8 @@ Session::when_engine_running ()
c->add_port (); c->add_port ();
c->add_port (); c->add_port ();
c->add_connection (0, _engine.get_nth_physical_input (np)); c->add_connection (0, _engine.get_nth_physical_audio_input (np));
c->add_connection (1, _engine.get_nth_physical_input (np+1)); c->add_connection (1, _engine.get_nth_physical_audio_input (np+1));
add_connection (c); add_connection (c);
} }
@ -817,7 +817,7 @@ Session::when_engine_running ()
} }
n = 0; n = 0;
while ((int) _master_out->n_outputs() < _master_out->output_maximum()) { while ((int) _master_out->n_outputs() < _master_out->output_maximum()) {
if (_master_out->add_output_port (_engine.get_nth_physical_output (n), this)) { if (_master_out->add_output_port (_engine.get_nth_physical_audio_output (n), this)) {
error << _("cannot setup master outputs") error << _("cannot setup master outputs")
<< endmsg; << endmsg;
break; break;
@ -926,7 +926,7 @@ Session::hookup_io ()
} }
n = 0; n = 0;
while ((int) _control_out->n_outputs() < _control_out->output_maximum()) { while ((int) _control_out->n_outputs() < _control_out->output_maximum()) {
if (_control_out->add_output_port (_engine.get_nth_physical_output (n), this)) { if (_control_out->add_output_port (_engine.get_nth_physical_audio_output (n), this)) {
error << _("cannot set up master outputs") error << _("cannot set up master outputs")
<< endmsg; << endmsg;
break; break;
@ -1689,8 +1689,8 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
uint32_t nphysical_in; uint32_t nphysical_in;
uint32_t nphysical_out; uint32_t nphysical_out;
_engine.get_physical_outputs (physoutputs); _engine.get_physical_audio_outputs (physoutputs);
_engine.get_physical_inputs (physinputs); _engine.get_physical_audio_inputs (physinputs);
control_id = ntracks() + nbusses() + 1; control_id = ntracks() + nbusses() + 1;
while (how_many) { while (how_many) {
@ -1714,13 +1714,13 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
} while (track_id < (UINT_MAX-1)); } while (track_id < (UINT_MAX-1));
if (Config->get_input_auto_connect() & AutoConnectPhysical) { if (Config->get_input_auto_connect() & AutoConnectPhysical) {
nphysical_in = min (n_physical_inputs, (uint32_t) physinputs.size()); nphysical_in = min (n_physical_audio_inputs, (uint32_t) physinputs.size());
} else { } else {
nphysical_in = 0; nphysical_in = 0;
} }
if (Config->get_output_auto_connect() & AutoConnectPhysical) { if (Config->get_output_auto_connect() & AutoConnectPhysical) {
nphysical_out = min (n_physical_outputs, (uint32_t) physinputs.size()); nphysical_out = min (n_physical_audio_outputs, (uint32_t) physinputs.size());
} else { } else {
nphysical_out = 0; nphysical_out = 0;
} }
@ -1876,8 +1876,8 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
vector<string> physinputs; vector<string> physinputs;
vector<string> physoutputs; vector<string> physoutputs;
_engine.get_physical_outputs (physoutputs); _engine.get_physical_audio_outputs (physoutputs);
_engine.get_physical_inputs (physinputs); _engine.get_physical_audio_inputs (physinputs);
control_id = ntracks() + nbusses() + 1; control_id = ntracks() + nbusses() + 1;
while (how_many) { while (how_many) {
@ -1903,12 +1903,12 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
goto failure; goto failure;
} }
for (uint32_t x = 0; n_physical_inputs && x < bus->n_inputs(); ++x) { for (uint32_t x = 0; n_physical_audio_inputs && x < bus->n_inputs(); ++x) {
port = ""; port = "";
if (Config->get_input_auto_connect() & AutoConnectPhysical) { if (Config->get_input_auto_connect() & AutoConnectPhysical) {
port = physinputs[((n+x)%n_physical_inputs)]; port = physinputs[((n+x)%n_physical_audio_inputs)];
} }
if (port.length() && bus->connect_input (bus->input (x), port, this)) { if (port.length() && bus->connect_input (bus->input (x), port, this)) {
@ -1916,12 +1916,12 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
} }
} }
for (uint32_t x = 0; n_physical_outputs && x < bus->n_outputs(); ++x) { for (uint32_t x = 0; n_physical_audio_outputs && x < bus->n_outputs(); ++x) {
port = ""; port = "";
if (Config->get_output_auto_connect() & AutoConnectPhysical) { if (Config->get_output_auto_connect() & AutoConnectPhysical) {
port = physoutputs[((n+x)%n_physical_outputs)]; port = physoutputs[((n+x)%n_physical_audio_outputs)];
} else if (Config->get_output_auto_connect() & AutoConnectMaster) { } else if (Config->get_output_auto_connect() & AutoConnectMaster) {
if (_master_out) { if (_master_out) {
port = _master_out->input (x%_master_out->n_inputs())->name(); port = _master_out->input (x%_master_out->n_inputs())->name();