fix SNAFU with jack driver selection, caused by enabling FFADO driver (exposing a...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 15 Jan 2008 02:44:35 +0000 (02:44 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 15 Jan 2008 02:44:35 +0000 (02:44 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2917 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/engine_dialog.cc
gtk2_ardour/engine_dialog.h
svn_revision.h

index fc0a52a042fb030a70aa81ad1ba30ed2eda122ba..d0085b685bbe6e61d18410cca02ad2ae8af6773e 100644 (file)
@@ -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 {
index 5cd4528983a80183ca26f48c867e30a44f4aa234..f8549e0e65d34bb4ce8b56288e7d6ccad6f8f98a 100644 (file)
@@ -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<string>& 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<string>& 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<string>
 EngineControl::enumerate_oss_devices ()
 {
@@ -794,11 +800,19 @@ void
 EngineControl::driver_changed ()
 {
        string driver = driver_combo.get_active_text();
-       vector<string>& strings = devices[driver];
        string::size_type maxlen = 0;
        int maxindex = -1;
        int n = 0;
 
+       enumerate_devices (driver);
+
+       vector<string>& strings = devices[driver];
+
+       if (strings.empty()) {
+               error << string_compose (_("No devices found for driver \"%1\""), driver) << endmsg;
+               return;
+       }
+       
        for (vector<string>::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;
                }
index 925d12acbb7e8b099aae0b7c27a991d7fc4ddde1..9e6eaf42d6be4761db0a72dfe4631728fe2598f6 100644 (file)
@@ -83,7 +83,7 @@ class EngineControl : public Gtk::VBox {
 
        std::map<std::string,std::vector<std::string> > devices;
        std::vector<std::string> backend_devs;
-       void enumerate_devices ();
+       void enumerate_devices (const string& driver);
 
 #ifdef __APPLE__
        std::vector<std::string> enumerate_coreaudio_devices ();
index 82e05f6d6ebb24f9e843273db35b6cf1a3a3641e..d417a995ab84fd67bb921f1846517e72ab9c3468 100644 (file)
@@ -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