AudioCategory

Control all active sound instances by group. More...

Import Statement: import QtAudioEngine 1.0
Since: Qt 5.0
Inherits:

Item

Detailed Description

This type is part of the QtAudioEngine 1.0 module.

An instance of AudioCategory can be accessed through QtAudioEngine1::AudioEngine::categories with its unique name and must be defined inside AudioEngine.

import QtQuick 2.0
import QtAudioEngine 1.0

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 named 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 category.