Sound

Define a variety of samples and parameters to be used for SoundInstance. 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.

Sound can be accessed through QtAudioEngine1::AudioEngine::sounds 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

        AudioSample {
            name:"explosion01"
            source: "explosion-01.wav"
        }

        AudioSample {
            name:"explosion02"
            source: "explosion-02.wav"
        }

        Sound {
            name:"explosion"
            PlayVariation {
                sample:"explosion01"
                minPitch: 0.8
                maxPitch: 1.1
            }
            PlayVariation {
                sample:"explosion01"
                minGain: 1.1
                maxGain: 1.5
            }
        }
    }
    MouseArea {
        anchors.fill: parent
        onPressed: {
            audioengine.sounds["explosion"].play();
        }
    }
}