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

AttenuationModelInverse QML Type

Defines a non-linear attenuation curve for a Sound.

This type was introduced in Qt 5.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

AttenuationModelInverse QML Type

  • Import Statement: import QtAudioEngine 1.1

  • Since: Qt 5.0

  • Inherits: Item

  • Group: AttenuationModelInverse is part of multimedia_audioengine

Detailed Description

AttenuationModelInverse must be defined inside AudioEngine or be added to it using AudioEngine.addAttenuationModel() if AttenuationModelInverse is created dynamically.

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

    AudioEngine {
        id:audioengine

        AttenuationModelInverse {
           name:"linear"
           start: 20
           end: 500
           rolloff: 1.5
        }

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

        Sound {
            name:"explosion"
            attenuationModel: "linear"
            PlayVariation {
                sample:"explosion"
            }
        }
    }
}

Attenuation factor is calculated as below:

distance: distance from sound to listener d = min(max(distance, start), end); attenuation = start / (start + (d - start) * rolloff);

Property Documentation

 

end : real

This property holds the end distance. There will be no further attenuation if the distance from sound to listener is larger than this. The default value is 1000.

name : string

This property holds the name of AttenuationModelInverse, must be unique among all attenuation models and only defined once.

rolloff : real

This property holds the rolloff factor. The bigger the value is, the faster the sound attenuates. The default value is 1.

start : real

This property holds the start distance. There will be no attenuation if the distance from sound to listener is within this range. The default value is 1.

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