Skip to content

SpatialSound

Qt Base Class: QSpatialSound

Signature: QSpatialSound(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QSpatialSound
PySide6.QtSpatialAudio
QSpatialSound(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None

⋔ Inheritance diagram

graph TD
  1473574623424["spatialaudio.SpatialSound"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473574590240["QtSpatialAudio.QSpatialSound"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299815024 --> 1473574623424
  140713234304496 --> 1473299815024
  1473574590240 --> 1473574623424
  1473288842240 --> 1473574590240
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ObjectMixin, QSpatialSound

A sound object in 3D space.

Source code in prettyqt\spatialaudio\spatialsound.py
class SpatialSound(core.ObjectMixin, QtSpatialAudio.QSpatialSound):
    """A sound object in 3D space."""

    def set_distance_model(
        self, model: DistanceModelStr | QtSpatialAudio.QSpatialSound.DistanceModel
    ):
        """Set the distance model.

        Args:
            model: distance model
        """
        self.setDistanceModel(DISTANCE_MODEL.get_enum_value(model))

    def get_distance_model(self) -> DistanceModelStr:
        """Return current distance model.

        Returns:
            distance model
        """
        return DISTANCE_MODEL.inverse[self.distanceModel()]

    def set_position(self, position: datatypes.Vector3DType):
        self.setPosition(datatypes.to_vector3d(position))

get_distance_model() -> DistanceModelStr

Return current distance model.

Source code in prettyqt\spatialaudio\spatialsound.py
def get_distance_model(self) -> DistanceModelStr:
    """Return current distance model.

    Returns:
        distance model
    """
    return DISTANCE_MODEL.inverse[self.distanceModel()]

set_distance_model(model: DistanceModelStr | QtSpatialAudio.QSpatialSound.DistanceModel)

Set the distance model.

Parameters:

Name Type Description Default
model DistanceModelStr | DistanceModel

distance model

required
Source code in prettyqt\spatialaudio\spatialsound.py
def set_distance_model(
    self, model: DistanceModelStr | QtSpatialAudio.QSpatialSound.DistanceModel
):
    """Set the distance model.

    Args:
        model: distance model
    """
    self.setDistanceModel(DISTANCE_MODEL.get_enum_value(model))

⌗ Property table

Qt Property Type Doc
objectName QString
source QUrl
position QVector3D
rotation QQuaternion
volume float
distanceModel QSpatialSound::DistanceModel
size float
distanceCutoff float
manualAttenuation float
occlusionIntensity float
directivity float
directivityOrder float
nearFieldGain float
loops int
autoPlay bool