PySide6.QtSpatialAudio.QSpatialSound¶
- class QSpatialSound¶
A sound object in 3D space. More…
Synopsis¶
Properties¶
Methods¶
def
__init__()
def
autoPlay()
def
directivity()
def
distanceCutoff()
def
distanceModel()
def
engine()
def
loops()
def
nearFieldGain()
def
position()
def
rotation()
def
setAutoPlay()
def
setDirectivity()
def
setLoops()
def
setPosition()
def
setRotation()
def
setSize()
def
setSource()
def
setVolume()
def
size()
def
source()
def
volume()
Slots¶
Signals¶
def
loopsChanged()
def
sizeChanged()
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¶
QSpatialSound
represents an audible object in 3D space. You can define its position and orientation in space, set the sound it is playing and define a volume for the object.The object can have different attenuation behavior, emit sound mainly in one direction or spherically, and behave as if occluded by some other object.
- class Loops¶
(inherits
enum.IntEnum
) Lets you control the sound playback loop using the following values:Constant
Description
QSpatialSound.Infinite
Playback infinitely
QSpatialSound.Once
Playback once
- class DistanceModel¶
Defines how the volume of the sound scales with distance to the listener.
Constant
Description
QSpatialSound.DistanceModel.Logarithmic
Volume decreases logarithmically with distance.
QSpatialSound.DistanceModel.Linear
Volume decreases linearly with distance.
QSpatialSound.DistanceModel.ManualAttenuation
Attenuation is defined manually using the
manualAttenuation
property.
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 directivityᅟ: float¶
Defines the directivity of the sound source. A value of 0 implies that the sound is emitted equally in all directions, while a value of 1 implies that the source mainly emits sound in the forward direction.
Valid values are between 0 and 1, the default is 0.
- Access functions:
- property directivityOrderᅟ: float¶
Defines the order of the directivity of the sound source. A higher order implies a sharper localization of the sound cone.
The minimum value and default for this property is 1.
- Access functions:
- property distanceCutoffᅟ: float¶
Defines a distance beyond which sound coming from the source will cutoff. If the listener is further away from the sound object than the cutoff distance it won’t be audible anymore.
- Access functions:
- property distanceModelᅟ: QSpatialSound.DistanceModel¶
Defines distance model for this sound source. The volume starts scaling down from
size
todistanceCutoff
. The volume is constant for distances smaller than size and zero for distances larger than the cutoff distance.See also
- 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:
Signal
loopsChanged()
- property manualAttenuationᅟ: float¶
Defines a manual attenuation factor if
distanceModel
is set toManualAttenuation
.- Access functions:
- property nearFieldGainᅟ: float¶
Defines the near field gain for the sound source. Valid values are between 0 and 1. A near field gain of 1 will raise the volume of the sound signal by approx 20 dB for distances very close to the listener.
- Access functions:
- property occlusionIntensityᅟ: float¶
Defines how much the object is occluded. 0 implies the object is not occluded at all, 1 implies the sound source is fully occluded by another object.
A fully occluded object will still be audible, but especially higher frequencies will be dampened. In addition, the object will still participate in generating reverb and reflections in the room.
Values larger than 1 are possible to further dampen the direct sound coming from the source.
The default is 0.
- Access functions:
Defines the position of the sound source in 3D space. Units are in centimeters by default.
See also
- Access functions:
- property rotationᅟ: QQuaternion¶
Defines the orientation of the sound source in 3D space.
- Access functions:
- property sizeᅟ: float¶
Defines the size of the sound source. If the listener is closer to the sound object than the size, volume will stay constant. The size is also used to for occlusion calculations, where large sources can be partially occluded by a wall.
- Access functions:
Signal
sizeChanged()
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 spatial sound source for
engine
. The object can be placed in 3D space and will be louder the closer to the listener it is.- autoPlay()¶
- Return type:
bool
See also
Getter of property
autoPlayᅟ
.- autoPlayChanged()¶
Notification signal of property
autoPlayᅟ
.- directivity()¶
- Return type:
float
See also
Getter of property
directivityᅟ
.- directivityChanged()¶
Notification signal of property
directivityᅟ
.- directivityOrder()¶
- Return type:
float
See also
Getter of property
directivityOrderᅟ
.- directivityOrderChanged()¶
Notification signal of property
directivityOrderᅟ
.- distanceCutoff()¶
- Return type:
float
See also
Getter of property
distanceCutoffᅟ
.- distanceCutoffChanged()¶
Notification signal of property
distanceCutoffᅟ
.- distanceModel()¶
- Return type:
See also
Getter of property
distanceModelᅟ
.- distanceModelChanged()¶
Notification signal of property
distanceModelᅟ
.- engine()¶
- Return type:
Returns the engine associated with this listener.
- loops()¶
- Return type:
int
See also
Getter of property
loopsᅟ
.- loopsChanged()¶
Notification signal of property
loopsᅟ
.- manualAttenuation()¶
- Return type:
float
See also
Getter of property
manualAttenuationᅟ
.- manualAttenuationChanged()¶
Notification signal of property
manualAttenuationᅟ
.- nearFieldGain()¶
- Return type:
float
See also
Getter of property
nearFieldGainᅟ
.- nearFieldGainChanged()¶
Notification signal of property
nearFieldGainᅟ
.- occlusionIntensity()¶
- Return type:
float
See also
Getter of property
occlusionIntensityᅟ
.- occlusionIntensityChanged()¶
Notification signal of property
occlusionIntensityᅟ
.- pause()¶
Pauses sound playback. Calling
play()
will continue playback.- play()¶
Starts playing back the sound. Does nothing if the sound is already playing.
- position()¶
- Return type:
See also
Getter of property
positionᅟ
.- positionChanged()¶
Notification signal of property
positionᅟ
.- rotation()¶
- Return type:
See also
Getter of property
rotationᅟ
.- rotationChanged()¶
Notification signal of property
rotationᅟ
.- setAutoPlay(autoPlay)¶
- Parameters:
autoPlay – bool
See also
Setter of property
autoPlayᅟ
.- setDirectivity(alpha)¶
- Parameters:
alpha – float
See also
Setter of property
directivityᅟ
.- setDirectivityOrder(alpha)¶
- Parameters:
alpha – float
See also
Setter of property
directivityOrderᅟ
.- setDistanceCutoff(cutoff)¶
- Parameters:
cutoff – float
See also
Setter of property
distanceCutoffᅟ
.- setDistanceModel(model)¶
- Parameters:
model –
DistanceModel
See also
Setter of property
distanceModelᅟ
.Setter of property
loopsᅟ
.- setManualAttenuation(attenuation)¶
- Parameters:
attenuation – float
See also
Setter of property
manualAttenuationᅟ
.- setNearFieldGain(gain)¶
- Parameters:
gain – float
See also
Setter of property
nearFieldGainᅟ
.- setOcclusionIntensity(occlusion)¶
- Parameters:
occlusion – float
See also
Setter of property
occlusionIntensityᅟ
.Setter of property
positionᅟ
.- setRotation(q)¶
- Parameters:
q –
QQuaternion
See also
Setter of property
rotationᅟ
.Setter of property
sizeᅟ
.Setter of property
sourceᅟ
.Setter of property
volumeᅟ
.Getter of property
sizeᅟ
.- sizeChanged()¶
Notification signal of property
sizeᅟ
.- 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ᅟ
.