AmbientSound QML Type | Qt Spatial Audio | Qt 6.11.1
Description: A stereo overlay sound.

- Qt 6.11
- Qt Spatial Audio
- QML Types
- AmbientSound
- Technology Preview

# AmbientSound QML Type

A stereo overlay sound. More...

Import Statement: | `import QtQuick3D.SpatialAudio`

- List of all members, including inherited members

## Properties

- autoPlay : bool
- loops : int
- source : url
- volume : real

## Methods

- void pause()
- void play()
- void stop()

## Detailed Description

A AmbientSound 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.

## Property Documentation

### autoPlay : bool

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

The default value is `true`.

### loops : int

Determines how often the sound is played before the player stops. Set to QAmbienSound::Infinite to loop the current sound forever.

The default value is `1`.

### source : url

The source file for the sound to be played.

### volume : real

Defines an overall volume for this sound source.

## Method Documentation

### void pause()

Pauses sound playback at the current position. Calling play() will continue playback.

### void play()

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

### void stop()

Stops sound playback and resets the current position and loop count to 0. Calling play() will begin playback at the beginning of the sound file.