QAmbientSound#

A stereo overlay sound. More

Inheritance diagram of PySide6.QtSpatialAudio.QAmbientSound

Synopsis#

Properties#

Functions#

Slots#

Signals#

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:

enginePySide6.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:
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:
property PᅟySide6.QtSpatialAudio.QAmbientSound.source: PySide6.QtCore.QUrl#

The source file for the sound to be played.

Access functions:
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:
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

setAutoPlay()

Getter of property autoPlay .

PySide6.QtSpatialAudio.QAmbientSound.autoPlayChanged()#

Notification signal of property autoPlay .

PySide6.QtSpatialAudio.QAmbientSound.engine()#
Return type:

PySide6.QtSpatialAudio.QAudioEngine

Returns the engine associated with this sound.

PySide6.QtSpatialAudio.QAmbientSound.loops()#
Return type:

int

See also

setLoops()

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

autoPlay()

Setter of property autoPlay .

PySide6.QtSpatialAudio.QAmbientSound.setLoops(loops)#
Parameters:

loops – int

See also

loops()

Setter of property loops .

PySide6.QtSpatialAudio.QAmbientSound.setSource(url)#
Parameters:

urlPySide6.QtCore.QUrl

See also

source()

Setter of property source .

PySide6.QtSpatialAudio.QAmbientSound.setVolume(volume)#
Parameters:

volume – float

See also

volume()

Setter of property volume .

PySide6.QtSpatialAudio.QAmbientSound.source()#
Return type:

PySide6.QtCore.QUrl

See also

setSource()

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

setVolume()

Getter of property volume .

PySide6.QtSpatialAudio.QAmbientSound.volumeChanged()#

Notification signal of property volume .