QAmbientSound Class

스테레오 오버레이 사운드. 더 보기...

헤더: #include <QAmbientSound>
CMake: find_package(Qt6 REQUIRED COMPONENTS SpatialAudio)
target_link_libraries(mytarget PRIVATE Qt6::SpatialAudio)
qmake: QT += spatialaudio
상속합니다: QObject

공용 유형

enum Loops { Infinite, Once }

속성

공용 기능

QAmbientSound(QAudioEngine *engine)
bool autoPlay() const
QAudioEngine *engine() const
int loops() const
void setAutoPlay(bool autoPlay)
void setLoops(int loops)
void setSource(const QUrl &url)
void setVolume(float volume)
QUrl source() const
float volume() const

공용 슬롯

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

신호

상세 설명

QAmbientSound는 위치와 방향에 독립적인 사운드를 나타냅니다. 일반적으로 청취자의 위치 및 방향과 무관해야 하는 배경 사운드(예: 음악)에 사용됩니다.

멤버 유형 문서

enum QAmbientSound::Loops

다음 값을 사용하여 재생 루프를 제어할 수 있습니다:

상수설명
QAmbientSound::Infinite-1무한 반복
QAmbientSound::Once1한 번 실행 후 재생을 중지합니다.

프로퍼티 문서

autoPlay : bool

소스가 지정될 때 자동으로 사운드 재생을 시작할지 여부를 결정합니다.

기본값은 true 입니다.

기능에 액세스합니다:

bool autoPlay() const
void setAutoPlay(bool autoPlay)

알림 신호:

void autoPlayChanged()

loops : int

플레이어가 멈추기 전에 사운드를 재생할 횟수를 결정합니다. 현재 사운드를 영원히 반복 재생하려면 QAmbientSound::Infinite 로 설정합니다.

기본값은 1 입니다.

기능에 액세스합니다:

int loops() const
void setLoops(int loops)

알림 신호:

void loopsChanged()

source : QUrl

재생할 사운드의 소스 파일입니다.

기능에 접근합니다:

QUrl source() const
void setSource(const QUrl &url)

알림 신호:

void sourceChanged()

volume : float

소리의 볼륨을 정의합니다.

0에서 1 사이의 값은 사운드를 감쇠시키고, 1을 초과하는 값은 추가적인 게인 부스트를 제공합니다.

기능에 액세스합니다:

float volume() const
void setVolume(float volume)

알림 신호:

void volumeChanged()

멤버 함수 문서

[explicit] QAmbientSound::QAmbientSound(QAudioEngine *engine)

engine 에 대한 스테레오 음원을 생성합니다.

QAudioEngine *QAmbientSound::engine() const

이 사운드와 연관된 엔진을 반환합니다.

[slot] void QAmbientSound::pause()

사운드 재생을 일시 중지합니다. play ()를 호출하면 재생이 계속됩니다.

[slot] void QAmbientSound::play()

사운드 재생을 시작합니다. 사운드가 이미 재생 중이면 아무 작업도 수행하지 않습니다.

[slot] void QAmbientSound::stop()

사운드 재생을 중지하고 현재 위치와 현재 루프 횟수를 0으로 초기화합니다. play()를 호출하면 사운드 파일의 시작 부분부터 재생이 시작됩니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.