Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Python访问DirectSound设备信息?_Python_Directx_Ctypes - Fatal编程技术网

如何从Python访问DirectSound设备信息?

如何从Python访问DirectSound设备信息?,python,directx,ctypes,Python,Directx,Ctypes,我在上找到了关于如何使用.NET枚举声音设备信息的信息,但我不知道如何在Python中使用这些信息。正如您可能知道的,我几乎没有Windows API编程经验 我可以找到如何通过WMI获取基本信息,但我需要更多信息,可能下面的C#代码片段就是我需要的,但我不知道如何从Python访问DirectSound对象。我已经了解了一些关于CType的基本知识,但我不知道该加载哪个或如何加载DirectX.dll DevicesCollection devColl = new DevicesCollect

我在上找到了关于如何使用.NET枚举声音设备信息的信息,但我不知道如何在Python中使用这些信息。正如您可能知道的,我几乎没有Windows API编程经验

我可以找到如何通过WMI获取基本信息,但我需要更多信息,可能下面的C#代码片段就是我需要的,但我不知道如何从Python访问DirectSound对象。我已经了解了一些关于CType的基本知识,但我不知道该加载哪个或如何加载DirectX.dll

DevicesCollection devColl = new DevicesCollection();
    foreach (DeviceInformation devInfo in devColl)
    {
        Device dev = new Device(devInfo.DriverGuid);   

        //use dev.Caps, devInfo to access a fair bit of info about the sound device
    }
有什么建议吗?

对于“穷人的.NET库访问”,请查看

但是,由于DirectSound的.NET绑定通过其
clr
库,因此使用可能更容易访问DirectSound设备

提示来自:

:

有关在IronPython中使用托管DirectX的更全面教程,请参见

“穷人的.NET库访问”,请参阅

但是,由于DirectSound的.NET绑定通过其
clr
库,因此使用可能更容易访问DirectSound设备

提示来自:

:


有关在IronPython中使用托管DirectX的更全面教程,请参见

您正在使用哪种Python?IronPython对吗?我目前正在使用CPython,但如果需要的话,我可以毫无问题地切换到IronPython。您使用的是哪种Python?IronPython对吗?我目前正在使用CPython,但如果需要,我可以毫无问题地切换到IronPython。
import clr
clr.AddReference('Microsoft.DirectX.AudioVideoPlayback')
from Microsoft.DirectX import AudioVideoPlayback
mp3 = AudioVideoPlayback.Audio("C:\\myreallyfunky.mp3")
mp3.Play()