Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

SoundInstance

The SoundInstance type allows you to play 3d audio content. More...

Inherits Item

This type was introduced in Qt 5.0.

Properties

Signals

Methods

Detailed Description

This type is part of the QtAudioEngine 1.0 module.

There are two ways to create SoundInstance objects. You can obtain it by calling newInstance method of a Sound:

 import QtQuick 2.0
 import QtAudioEngine 1.0

 Rectangle {
     id:root
     color:"white"
     width: 300
     height: 500

     AudioEngine {
         id:audioengine

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

         Sound {
             name:"explosion"
             PlayVariation {
                 sample:"explosion01"
             }
         }
     }

     property variant soundEffect: audioengine.sounds["explosion"].newInstance();

     MouseArea {
         anchors.fill: parent
         onPressed: {
             root.soundEffect.play();
         }
     }
 }

Or alternatively, you can explicitly define SoundInstance outside of AudioEngine for easier qml bindings:

 import QtQuick 2.0
 import QtAudioEngine 1.0

 Rectangle {
     id:root
     color:"white"
     width: 300
     height: 500

     AudioEngine {
         id:audioengine

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

         Sound {
             name:"explosion"
             PlayVariation {
                 sample:"explosion01"
             }
         }
     }

     Item {
         id: animator
         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
             }

         }
     }

     SoundInstance {
         id:soundEffect
         engine:audioengine
         sound:"explosion"
         position:Qt.vector3d(animator.x, animator.y, 0);
     }

     MouseArea {
         anchors.fill: parent
         onPressed: {
             soundEffect.play();
         }
     }
 }

Property Documentation

direction : vector3d

This property holds the current 3d direction.


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


gain : vector3d

This property holds the gain adjustment which will be used to modulate the audio ouput level from this SoundInstance.


pitch : vector3d

This property holds the pitch adjustment which will be used to modulate the audio pitch from this SoundInstance.


position : vector3d

This property holds the current 3d position.


sound : string

This property specifies which Sound this SoundInstance will use. Unlike some properties in other types, this property can be changed dynamically.


read-onlystate : enumeration

This property holds the current playback state. It can be one of:

ValueDescription
StopppedStateThe SoundInstance is not playing, and when playback begins next it will play from position zero.
PlayingStateThe SoundInstance is playing the media.
PausedStateThe SoundInstance is not playing, and when playback begins next it will play from the position that it was paused at.

velocity : vector3d

This property holds the current 3d velocity.


Signal Documentation

SoundInstance::onDirectionChanged()

This handler is called when direction is changed


SoundInstance::onGainChanged()

This handler is called when gain is changed


SoundInstance::onPitchChanged()

This handler is called when pitch is changed


SoundInstance::onPositionChanged()

This handler is called when position is changed


SoundInstance::onSoundChanged()

This handler is called when sound is changed


SoundInstance::onStateChanged(state)

This handler is called when state is changed


SoundInstance::onVelocityChanged()

This handler is called when velocity is changed


Method Documentation

SoundInstance::play()

Starts playback.


Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web