AudioCategory QML Type

Control all active sound instances by group. 更多...

导入语句: import QtAudioEngine 1.1
Since: Qt 5.0
继承:

Item

特性

方法

详细描述

An instance of AudioCategory can be accessed through AudioEngine.categories with its unique name and must be defined inside AudioEngine or be added to it using AudioEngine.addAudioCategory() if AudioCategory is created dynamically.

Rectangle {
    color:"white"
    width: 300
    height: 500
    AudioEngine {
        id:audioengine
        AudioCategory {
            name: "sfx"
            volume: 0.8
        }
        AudioSample {
            name:"explosion"
            source: "explosion-02.wav"
        }
        Sound {
            name:"explosion"
            category: "sfx"
            PlayVariation {
                sample:"explosion"
            }
        }
    }
    MouseArea {
        anchors.fill: parent
        onPressed: {
            audioengine.categories["sfx"].volume = 0.5;
        }
    }
}
					

Sound instances can be grouped together by specifying the category property. When you change the volume of a category, all audio output from related instances will be affected as well.

Note: there will always be an AudioCategory 命名 default whether you explicitly define it or not. If you do not specify any category for a Sound , it will be grouped into the default 类别。

特性文档编制

name : string

This property holds the name of AudioCategory . The name must be unique among all categories and only defined once. The name cannot be changed after the instance has been initialized.


volume : real

This property holds the volume of the category and will modulate all audio output from the instances which belong to this category.


方法文档编制

pause ()

Resumes all active sound instances from paused state which belong to this category.


pause ()

Pauses all active sound instances which belong to this category.


stop ()

Stops all active sound instances which belong to this category.