QAmbientSound#
A stereo overlay sound. More…
Synopsis#
Properties#
Functions#
Slots#
Signals#
def
autoPlayChanged()def
loopsChanged()def
sourceChanged()def
volumeChanged()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
QAmbientSound represents a position and orientation independent sound. It’s commonly used for background sounds (e.g. music) that is supposed to be independent of the listeners position and orientation.
- class PySide6.QtSpatialAudio.QAmbientSound(engine)#
- Parameters:
engine –
PySide6.QtSpatialAudio.QAudioEngine
Creates a stereo sound source for engine.
Note
Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.
- property PᅟySide6.QtSpatialAudio.QAmbientSound.autoPlay: bool#
Determines whether the sound should automatically start playing when a source gets specified.
The default value is true.
- Access functions:
autoPlay()setAutoPlay(autoPlay)Signal
autoPlayChanged()
- property PᅟySide6.QtSpatialAudio.QAmbientSound.loops: int#
Determines how many times the sound is played before the player stops. Set to Infinite to play the current sound in a loop forever.
The default value is 1.
- Access functions:
loops()setLoops(loops)Signal
loopsChanged()
- property PᅟySide6.QtSpatialAudio.QAmbientSound.source: PySide6.QtCore.QUrl#
The source file for the sound to be played.
- Access functions:
source()setSource(url)Signal
sourceChanged()
- property PᅟySide6.QtSpatialAudio.QAmbientSound.volume: float#
Defines the volume of the sound.
Values between 0 and 1 will attenuate the sound, while values above 1 provide an additional gain boost.
- Access functions:
volume()setVolume(volume)Signal
volumeChanged()
- PySide6.QtSpatialAudio.QAmbientSound.Loops#
Lets you control the playback loop using the following values:
Constant
Description
QAmbientSound.Infinite
Loops infinitely
QAmbientSound.Once
Stops playback after running once
- PySide6.QtSpatialAudio.QAmbientSound.autoPlay()#
- Return type:
bool
See also
Getter of property autoPlay .
- PySide6.QtSpatialAudio.QAmbientSound.autoPlayChanged()#
Notification signal of property autoPlay .
- PySide6.QtSpatialAudio.QAmbientSound.engine()#
- Return type:
Returns the engine associated with this sound.
- PySide6.QtSpatialAudio.QAmbientSound.loops()#
- Return type:
int
See also
Getter of property loops .
- PySide6.QtSpatialAudio.QAmbientSound.loopsChanged()#
Notification signal of property loops .
- PySide6.QtSpatialAudio.QAmbientSound.pause()#
Pauses sound playback. Calling play() will continue playback.
- PySide6.QtSpatialAudio.QAmbientSound.play()#
Starts playing back the sound. Does nothing if the sound is already playing.
- PySide6.QtSpatialAudio.QAmbientSound.setAutoPlay(autoPlay)#
- Parameters:
autoPlay – bool
See also
Setter of property autoPlay .
Setter of property loops .
- PySide6.QtSpatialAudio.QAmbientSound.setSource(url)#
- Parameters:
url –
PySide6.QtCore.QUrl
See also
Setter of property source .
- PySide6.QtSpatialAudio.QAmbientSound.setVolume(volume)#
- Parameters:
volume – float
See also
Setter of property volume .
- PySide6.QtSpatialAudio.QAmbientSound.source()#
- Return type:
See also
Getter of property source .
- PySide6.QtSpatialAudio.QAmbientSound.sourceChanged()#
Notification signal of property source .
- PySide6.QtSpatialAudio.QAmbientSound.stop()#
Stops sound playback and resets the current position and current loop count to 0. Calling play() will start playback at the beginning of the sound file.
- PySide6.QtSpatialAudio.QAmbientSound.volume()#
- Return type:
float
See also
Getter of property volume .
- PySide6.QtSpatialAudio.QAmbientSound.volumeChanged()#
Notification signal of property volume .