From 8bea8385ab5a95eb6eeefc1410a1031f1d245b55 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 15 Jan 2008 02:44:35 +0000 Subject: fix SNAFU with jack driver selection, caused by enabling FFADO driver (exposing a lurking bug); reduce per-scroll-event step when h-scrolling with mousewheel git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2917 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_canvas_events.cc | 4 +- gtk2_ardour/engine_dialog.cc | 76 ++++++++++++++++++++++--------------- gtk2_ardour/engine_dialog.h | 2 +- svn_revision.h | 2 +- 4 files changed, 49 insertions(+), 35 deletions(-) diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index fc0a52a042..d0085b685b 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -133,7 +133,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) break; case GDK_SCROLL_LEFT: - xdelta = (current_page_frames() / 2); + xdelta = (current_page_frames() / 8); if (leftmost_frame > xdelta) { reset_x_origin (leftmost_frame - xdelta); } else { @@ -142,7 +142,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) break; case GDK_SCROLL_RIGHT: - xdelta = (current_page_frames() / 2); + xdelta = (current_page_frames() / 8); if (max_frames - xdelta > leftmost_frame) { reset_x_origin (leftmost_frame + xdelta); } else { diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 5cd4528983..f8549e0e65 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -122,9 +122,6 @@ EngineControl::EngineControl () 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, &EngineControl::driver_changed)); driver_changed (); @@ -366,7 +363,7 @@ EngineControl::build_command_line (vector& cmd) bool using_coreaudio = false; bool using_netjack = false; bool using_ffado = false; - bool using_dummy = false; + bool using_dummy = false; /* first, path to jackd */ @@ -466,10 +463,10 @@ EngineControl::build_command_line (vector& cmd) cmd.push_back ("-C"); } - if (! using_dummy ) { - cmd.push_back ("-n"); - cmd.push_back (to_string ((uint32_t) floor (periods_spinner.get_value()), std::dec)); - } + if (! using_dummy ) { + cmd.push_back ("-n"); + cmd.push_back (to_string ((uint32_t) floor (periods_spinner.get_value()), std::dec)); + } } cmd.push_back ("-r"); @@ -577,19 +574,25 @@ EngineControl::realtime_changed () } void -EngineControl::enumerate_devices () +EngineControl::enumerate_devices (const string& driver) { /* 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 (); + if (driver == "CoreAudio") { +#ifdef __APPLE__ + devices[driver] = enumerate_coreaudio_devices (); #endif + } else if (driver == "ALSA") { + devices[driver] = enumerate_alsa_devices (); + } else if (driver == "FFADO") { + devices[driver] = enumerate_ffado_devices (); + } else if (driver == "OSS") { + devices[driver] = enumerate_oss_devices (); + } else if (driver == "Dummy") { + devices[driver] = enumerate_dummy_devices (); + } else if (driver == "NetJACK") { + devices[driver] = enumerate_netjack_devices (); + } } #ifdef __APPLE__ @@ -679,6 +682,7 @@ EngineControl::enumerate_coreaudio_devices () delete [] coreDeviceIDs; } + if (devs.size() == 0) { MessageDialog msg (_("\ You do not have any audio devices capable of\n\ @@ -699,6 +703,7 @@ Ardour and choose the relevant device then." exit (1); } + return devs; } #else @@ -770,6 +775,7 @@ EngineControl::enumerate_ffado_devices () backend_devs.clear (); return devs; } + vector EngineControl::enumerate_oss_devices () { @@ -794,11 +800,19 @@ void EngineControl::driver_changed () { string driver = driver_combo.get_active_text(); - vector& strings = devices[driver]; string::size_type maxlen = 0; int maxindex = -1; int n = 0; + enumerate_devices (driver); + + vector& strings = devices[driver]; + + if (strings.empty()) { + error << string_compose (_("No devices found for driver \"%1\""), driver) << endmsg; + return; + } + for (vector::iterator i = strings.begin(); i != strings.end(); ++i, ++n) { if ((*i).length() > maxlen) { maxlen = (*i).length(); @@ -1071,19 +1085,18 @@ EngineControl::set_state (const XMLNode& root) XMLNodeConstIterator citer; XMLNode* child; XMLProperty* prop; - - bool using_dummy = false; - + bool using_dummy = false; + int val; string strval; - - if ( (child = root.child("driver"))){ - prop = child->property("val"); - if (prop && (prop->value() == "Dummy") ) { - using_dummy = true; - } - } - + + if ( (child = root.child ("driver"))){ + prop = child->property("val"); + if (prop && (prop->value() == "Dummy") ) { + using_dummy = true; + } + } + clist = root.children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { @@ -1093,8 +1106,9 @@ EngineControl::set_state (const XMLNode& root) prop = child->property ("val"); if (!prop || prop->value().empty()) { - if ( using_dummy && ( child->name() == "interface" || child->name() == "inputdevice" || child->name() == "outputdevice" )) - continue; + + if ( using_dummy && ( child->name() == "interface" || child->name() == "inputdevice" || child->name() == "outputdevice" )) + continue; error << string_compose (_("AudioSetup value for %1 is missing data"), child->name()) << endmsg; continue; } diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 925d12acbb..9e6eaf42d6 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -83,7 +83,7 @@ class EngineControl : public Gtk::VBox { std::map > devices; std::vector backend_devs; - void enumerate_devices (); + void enumerate_devices (const string& driver); #ifdef __APPLE__ std::vector enumerate_coreaudio_devices (); diff --git a/svn_revision.h b/svn_revision.h index 82e05f6d6e..d417a995ab 100644 --- a/svn_revision.h +++ b/svn_revision.h @@ -1,4 +1,4 @@ #ifndef __ardour_svn_revision_h__ #define __ardour_svn_revision_h__ -static const char* ardour_svn_revision = "2903"; +static const char* ardour_svn_revision = "2914"; #endif -- cgit v1.2.3