Author: remi
Date: 2009-09-25 12:00:21 +0200 (Fri, 25 Sep 2009)
New Revision: 5499

Modified:
   software_suite_v3/smart-core/smart-server/trunk/util/system/Device.py
Log:
* Fixed audio cards index.

Modified: software_suite_v3/smart-core/smart-server/trunk/util/system/Device.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/system/Device.py       
2009-09-25 07:38:16 UTC (rev 5498)
+++ software_suite_v3/smart-core/smart-server/trunk/util/system/Device.py       
2009-09-25 10:00:21 UTC (rev 5499)
@@ -20,21 +20,12 @@
         @param deviceKeyword: Device keyword.
         @return: A tuple (device index, device name)
         """
-        from ctypes import windll
-        winmm = windll.winmm
-        wvcps = ' ' * 52
-        cardsCount = winmm.waveOutGetNumDevs()
-        firstDevice = ""
-        for i in range(cardsCount):
-            try:
-                if winmm.waveOutGetDevCapsA(i, wvcps,len(wvcps)) == 0:
-                    deviceName = wvcps[8:].split("\0")[0]
-                    if i == 0:
-                        firstDevice = deviceName
-                    if wvcps.lower().find(deviceKeyword.lower()) != -1:
-                        return i, deviceName
-            except:
-                pass
+        import win32com.directsound.directsound as ds
+        devices = ds.DirectSoundEnumerate()
+        for i, device in enumerate(devices):
+            deviceName = device[1]
+            if deviceName.lower().find(deviceKeyword.lower()) != -1:
+                return i, deviceName
         return -1, None
 
     # 
--------------------------------------------------------------------------
@@ -99,7 +90,6 @@
             if idx == -1:
                 return "dsound:device=1"
             else:
-                idx += 1
                 return "dsound:device=%d" % idx
         else:
             return "alsa:device=plughw=TuxDroid,0"


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to