class QAmbientSound#

A stereo overlay sound. More

Inheritance diagram of PySide6.QtSpatialAudio.QAmbientSound

Synopsis#

Properties#

Methods#

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 Loops#

Lets you control the playback loop using the following values:

Constant

Description

QAmbientSound.Infinite

Loops infinitely

QAmbientSound.Once

Stops playback after running once

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property autoPlayᅟ: bool#

Determines whether the sound should automatically start playing when a source gets specified.

The default value is true.

Access functions:
property 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 sourceᅟ: QUrl#

The source file for the sound to be played.

Access functions:
property 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:
__init__(engine)#
Parameters:

engineQAudioEngine

Creates a stereo sound source for engine.

autoPlay()#
Return type:

bool

See also

setAutoPlay()

Getter of property autoPlayᅟ .

autoPlayChanged()#

Notification signal of property autoPlayᅟ .

engine()#
Return type:

QAudioEngine

Returns the engine associated with this sound.

loops()#
Return type:

int

See also

setLoops()

Getter of property loopsᅟ .

loopsChanged()#

Notification signal of property loopsᅟ .

pause()#

Pauses sound playback. Calling play() will continue playback.

play()#

Starts playing back the sound. Does nothing if the sound is already playing.

setAutoPlay(autoPlay)#
Parameters:

autoPlay – bool

See also

autoPlay()

Setter of property autoPlayᅟ .

setLoops(loops)#
Parameters:

loops – int

See also

loops()

Setter of property loopsᅟ .

setSource(url)#
Parameters:

urlQUrl

See also

source()

Setter of property sourceᅟ .

setVolume(volume)#
Parameters:

volume – float

See also

volume()

Setter of property volumeᅟ .

source()#
Return type:

QUrl

See also

setSource()

Getter of property sourceᅟ .

sourceChanged()#

Notification signal of property sourceᅟ .

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.

volume()#
Return type:

float

See also

setVolume()

Getter of property volumeᅟ .

volumeChanged()#

Notification signal of property volumeᅟ .