Issue #32 new

device order patch

Anonymous created an issue

Hi, aldrin crashes on a few systems that I tried, that provide multiple input/output devices per sound card. Unfortunately, the underlying armstrong api does not provide us the default sound device (I will write a patch for that if I find time). Here is a patch that will select the first device that is detected instead of the last one, as the first device is more likely to be the default one. {{{

!patch

diff -rupN aldrin.old/src/components/driver.py aldrin/src/components/driver.py --- aldrin.old/src/components/driver.py 2009-01-09 16:25:22.000000000 -0500 +++ aldrin/src/components/driver.py 2010-03-06 04:32:27.000000000 -0500 @@ -155,22 +155,33 @@ class AudioDriver:

            # second round: if we didnt find them from the config,
            # pick good alternatives.

+ + # regardless of what was chosen as input, if output + # has an input as well, prefer that one first. + # We also prefer the first device since it is usually the + # default system device. Unfortunately, the armstrong api + # does not provide us a default value. + if (output == -1 and input == -1): + for i in range(self.driver.get_count()): + if (self.driver.is_output(i) and self.driver.is_input(i)): + output = i + input = i + break

            if output == -1:
                    for i in range(self.driver.get_count()):
                            if self.driver.is_output(i):
                                    output = i

- - # regardless of what was chosen as input, if output - # has an input as well, prefer that one first. - if self.driver.is_input(output): - input = output + break

            # take output channel if it supports input
            if input == -1:
                    for i in range(self.driver.get_count()):
                            if self.driver.is_input(i):
                                    input = i
  • break
  • if self.driver.is_input(output):
  • input = output

            if output == -1:
                    raise self.AudioInitException
    

    }}}

Comments (3)

  1. Log in to comment