IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

AudioListener QML Type

Control global listener parameters.

This type was introduced in Qt 5.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

AudioListener QML Type

  • Import Statement: import QtAudioEngine 1.1

  • Since: Qt 5.0

  • Inherits: Item

  • Group: AudioListener is part of multimedia_audioengine

Detailed Description

AudioListener will have only one global instance and you can either access it through the listener property of AudioEngine:

 
Sélectionnez
Rectangle {
    color:"white"
    width: 300
    height: 500

    AudioEngine {
        id:audioengine
        listener.up:"0,0,1"
        listener.velocity:"0,0,0"
        listener.direction:"0,1,0"
        listener.position:Qt.vector3d(observer.x, observer.y, 0);
    }

    Item {
        id: observer
        x: 10 + observer.percent * 100
        y: 20 + observer.percent * 80
        property real percent: 0
        SequentialAnimation on percent {
            loops: Animation.Infinite
            running: true
            NumberAnimation {
                duration: 8000
                from: 0
                to: 1
            }
        }
    }
}

or alternatively, by defining an AudioListener outside AudioEngine:

 
Sélectionnez
Rectangle {
    color:"white"
    width: 300
    height: 500

    AudioEngine {
        id:audioengine
        listener.up:"0,0,1"
        listener.velocity:"0,0,0"
        listener.direction:"0,1,0"
    }

    AudioListener {
        engine:audioengine
        position: Qt.vector3d(observer.x, observer.y, 0);
    }

    Item {
        id: observer
        x: 10 + observer.percent * 100
        y: 20 + observer.percent * 80
        property real percent: 0
        SequentialAnimation on percent {
            loops: Animation.Infinite
            running: true
            NumberAnimation {
                duration: 8000
                from: 0
                to: 1
            }
        }
    }
}

This separate AudioListener definition is allowed to make QML bindings easier in some cases.

Property Documentation

 

direction : vector3d

This property holds the normalized 3D direction vector of the listener.

engine : QtAudioEngine::AudioEngine

This property holds the reference to AudioEngine, and must only be set once.

gain : real

This property will modulate all audio output from audio engine instances.

position : vector3d

This property holds the 3D position of the listener.

up : vector3d

This property holds the normalized 3D up vector of the listener.

velocity : vector3d

This property holds the 3D velocity vector of the listener.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+