74class QSoundEffectPrivateWithPlayer
final :
public QObject,
public QSoundEffectPrivate
78 Q_DISABLE_COPY_MOVE(QSoundEffectPrivateWithPlayer)
79 ~QSoundEffectPrivateWithPlayer() override;
98 void play(std::shared_ptr<QSoundEffectVoice>);
99 void setStatus(QSoundEffect::Status status);
100 [[nodiscard]]
bool updatePlayer(
const SharedSamplePtr &sample);
101 std::optional<VoiceId> activeVoice()
const;
102 static bool formatIsSupported(
const QAudioFormat &);
103 void setResolvedAudioDevice(QAudioDevice device);
104 void resolveAudioDevice();
106 QSoundEffect *q_ptr{};
107 QAudioDevice m_audioDevice;
108 QAudioDevice m_resolvedAudioDevice;
109 std::shared_ptr<QRtAudioEngine> m_player;
110 QMetaObject::Connection m_voiceFinishedConnection;
111 std::set<std::shared_ptr<QSoundEffectVoice>, QRtAudioEngineVoiceCompare> m_voices;
113 void setLoopsRemaining(
int);
114 int m_loopsRemaining{ 0 };
116 std::optional<QFuture<
void>> m_sampleLoadFuture;
117 SharedSamplePtr m_sample;
118 float m_volume = 1.f;
119 bool m_muted =
false;
121 bool m_playPending =
false;
123 QSoundEffect::Status m_status{};
125 QMediaDevices m_mediaDevices;
126 QAudioDevice m_defaultAudioDevice;
127 QChronoTimer m_playerReleaseTimer{
128 std::chrono::seconds(2),