PySide6.QtSpatialAudio.QAmbientSound¶
- class QAmbientSound¶
- A stereo overlay sound. More… - Synopsis¶- Properties¶- Methods¶- def - __init__()
- def - autoPlay()
- def - engine()
- def - loops()
- def - setAutoPlay()
- def - setLoops()
- def - setSource()
- def - setVolume()
- def - source()
- def - volume()
 - Slots¶- Signals¶
- 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¶- QAmbientSoundrepresents 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¶
- (inherits - enum.IntEnum) 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_propertyis 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 - Infiniteto play the current sound in a loop forever.- The default value is - 1.- Access functions:
- Signal - loopsChanged()
 
 - The source file for the sound to be played. - Access functions:
- Signal - sourceChanged()
 
 - 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:
- Signal - volumeChanged()
 
 - __init__(engine)¶
- Parameters:
- engine – - QAudioEngine
 
 - Creates a stereo sound source for - engine.- autoPlay()¶
- Return type:
- bool 
 - See also 
 - Getter of property - autoPlayᅟ.- autoPlayChanged()¶
 - Notification signal of property - autoPlayᅟ.- engine()¶
- Return type:
 
 - Returns the engine associated with this sound. - loops()¶
- Return type:
- int 
 - See also 
 - 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 
 - Setter of property - autoPlayᅟ.- Setter of property - loopsᅟ.- Setter of property - sourceᅟ.- Setter of property - volumeᅟ.- source()¶
- Return type:
 - See also 
 - 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 
 - Getter of property - volumeᅟ.- volumeChanged()¶
 - Notification signal of property - volumeᅟ.