[tuxdroid-svn] r5499 - software_suite_v3/smart-core/smart-server/trunk/util/system
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-09-25 10:00:33
|
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"
|