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