• PySide 模块
  • PySide.QtMultimedia
  • 内容表

    上一话题

    QAudio

    下一话题

    QAudioFormat

    QAudioDeviceInfo

    详细描述

    PySide.QtMultimedia.QAudioDeviceInfo class provides an interface to query audio devices and their functionality.

    PySide.QtMultimedia.QAudioDeviceInfo lets you query for audio devices–such as sound cards and USB headsets–that are currently available on the system. The audio devices available are dependent on the platform or audio plugins installed.

    You can also query each device for the formats it supports. A format in this context is a set consisting of a specific byte order, channel, codec, frequency, sample rate, and sample type. A format is represented by the PySide.QtMultimedia.QAudioFormat 类。

    The values supported by the the device for each of these parameters can be fetched with PySide.QtMultimedia.QAudioDeviceInfo.supportedByteOrders() , PySide.QtMultimedia.QAudioDeviceInfo.supportedChannelCounts() , PySide.QtMultimedia.QAudioDeviceInfo.supportedCodecs() , PySide.QtMultimedia.QAudioDeviceInfo.supportedSampleRates() , PySide.QtMultimedia.QAudioDeviceInfo.supportedSampleSizes() ,和 PySide.QtMultimedia.QAudioDeviceInfo.supportedSampleTypes() . The combinations supported are dependent on the platform, audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with PySide.QtMultimedia.QAudioDeviceInfo.isFormatSupported() , or fetch a supported format that is as close as possible to the format with PySide.QtMultimedia.QAudioDeviceInfo.nearestFormat() . For instance:

    <Code snippet "doc/src/snippets/audio/main.cpp:6" not found>                ...
    <Code snippet "doc/src/snippets/audio/main.cpp:7" not found>
    									

    A PySide.QtMultimedia.QAudioDeviceInfo is used by Qt to construct classes that communicate with the device–such as PySide.QtMultimedia.QAudioInput ,和 PySide.QtMultimedia.QAudioOutput . The static functions PySide.QtMultimedia.QAudioDeviceInfo.defaultInputDevice() , PySide.QtMultimedia.QAudioDeviceInfo.defaultOutputDevice() ,和 PySide.QtMultimedia.QAudioDeviceInfo.availableDevices() let you get a list of all available devices. Devices are fetch according to the value of mode this is specified by the QAudio.Mode enum. The PySide.QtMultimedia.QAudioDeviceInfo returned are only valid for the QAudio.Mode .

    例如:

    foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
        qDebug() << "Device name: " << deviceInfo.deviceName();
    									

    In this code sample, we loop through all devices that are able to output sound, i.e., play an audio stream in a supported format. For each device we find, we simply print the PySide.QtMultimedia.QAudioDeviceInfo.deviceName() .

    class PySide.QtMultimedia. QAudioDeviceInfo
    class PySide.QtMultimedia. QAudioDeviceInfo ( other )
    参数: other PySide.QtMultimedia.QAudioDeviceInfo

    构造空 PySide.QtMultimedia.QAudioDeviceInfo 对象。

    构造副本为 other .

    static PySide.QtMultimedia.QAudioDeviceInfo. availableDevices ( mode )
    参数: mode PySide.QtMultimedia.QAudio.Mode
    返回类型:
    static PySide.QtMultimedia.QAudioDeviceInfo. defaultInputDevice ( )
    返回类型: PySide.QtMultimedia.QAudioDeviceInfo

    Returns the name of the default input audio device. All platform and audio plugin implementations provide a default audio device to use.

    static PySide.QtMultimedia.QAudioDeviceInfo. defaultOutputDevice ( )
    返回类型: PySide.QtMultimedia.QAudioDeviceInfo

    Returns the name of the default output audio device. All platform and audio plugin implementations provide a default audio device to use.

    PySide.QtMultimedia.QAudioDeviceInfo. deviceName ( )
    返回类型: unicode

    Returns human readable name of audio device.

    Device names vary depending on platform/audio plugin being used.

    They are a unique string identifiers for the audio device.

    eg. default, Intel, U0x46d0x9a4

    PySide.QtMultimedia.QAudioDeviceInfo. handle ( )
    返回类型: PySide.QtCore.QByteArray
    PySide.QtMultimedia.QAudioDeviceInfo. isFormatSupported ( format )
    参数: format PySide.QtMultimedia.QAudioFormat
    返回类型: PySide.QtCore.bool

    返回 true 若 settings are supported by the audio device of this PySide.QtMultimedia.QAudioDeviceInfo .

    PySide.QtMultimedia.QAudioDeviceInfo. isNull ( )
    返回类型: PySide.QtCore.bool

    Returns whether this PySide.QtMultimedia.QAudioDeviceInfo object holds a device definition.

    PySide.QtMultimedia.QAudioDeviceInfo. mode ( )
    返回类型: PySide.QtMultimedia.QAudio.Mode
    PySide.QtMultimedia.QAudioDeviceInfo. nearestFormat ( format )
    参数: format PySide.QtMultimedia.QAudioFormat
    返回类型: PySide.QtMultimedia.QAudioFormat

    Returns closest PySide.QtMultimedia.QAudioFormat to settings that system audio supports.

    These settings are provided by the platform/audio plugin being used.

    They also are dependent on the QAudio.Mode 被使用。

    PySide.QtMultimedia.QAudioDeviceInfo. preferredFormat ( )
    返回类型: PySide.QtMultimedia.QAudioFormat

    返回 PySide.QtMultimedia.QAudioFormat of default settings.

    These settings are provided by the platform/audio plugin being used.

    They also are dependent on the QAudio.Mode 被使用。

    A typical audio system would provide something like:

    • Input settings: 8000Hz mono 8 bit.
    • Output settings: 44100Hz stereo 16 bit little endian.
    PySide.QtMultimedia.QAudioDeviceInfo. realm ( )
    返回类型: unicode
    PySide.QtMultimedia.QAudioDeviceInfo. supportedByteOrders ( )
    返回类型:

    Returns a list of supported byte orders.

    PySide.QtMultimedia.QAudioDeviceInfo. supportedChannelCounts ( )
    返回类型:

    Returns a list of supported channel counts.

    PySide.QtMultimedia.QAudioDeviceInfo. supportedChannels ( )
    返回类型:

    Use supportedChannelCount() instead.

    PySide.QtMultimedia.QAudioDeviceInfo. supportedCodecs ( )
    返回类型: 字符串列表

    Returns a list of supported codecs.

    All platform and plugin implementations should provide support for:

    “audio/pcm” - Linear PCM

    For writing plugins to support additional codecs refer to:

    http://www.iana.org/assignments/media-types/audio/

    PySide.QtMultimedia.QAudioDeviceInfo. supportedFrequencies ( )
    返回类型:

    使用 PySide.QtMultimedia.QAudioDeviceInfo.supportedSampleRates() 代替。

    PySide.QtMultimedia.QAudioDeviceInfo. supportedSampleRates ( )
    返回类型:

    Returns a list of supported sample rates.

    PySide.QtMultimedia.QAudioDeviceInfo. supportedSampleSizes ( )
    返回类型:

    Returns a list of supported sample sizes.

    PySide.QtMultimedia.QAudioDeviceInfo. supportedSampleTypes ( )
    返回类型:

    Returns a list of supported sample types.