QSoundEffect: don't duplicate voices on an output device change


setResolvedAudioDevice() moves the playing voices aside, builds a player
for the new device and replays a clone of each on it - then replays a
second clone of every one of them. Each device change therefore doubles
the voice count, and for QSoundEffect::Infinite the duplicates never
retire. They start at the same frame, so the effect plays at twice the
amplitude, and the second clone carries the old engine's format.

Drop the second loop. It is a rebase artifact - the pre-ef1b832fb
spelling of the loop above it, which passes the new engine's format so
that mono/stereo conversion follows the new device.

setAudioDevice_emitsSignalsInExpectedOrder already drives this path, but
only watches signals, and the second play() emits no playingChanged
because m_voices is not empty. The new test asserts the voice count, and
needs the class exported for its dynamic_cast to link, as
QSoundEffectPrivateSynchronous already is.

Fixes: QTBUG-149917
Task-number: QTBUG-142743
Pick-to: 6.11 6.12
Assisted-by: Claude Code
Change-Id: I1242781195d9c2719c45a641d897ece507bd9f6b
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
commit12861bfcd0884d2e901ae50ebf2982c5873808e8
parent5723beaf1fff3d0ead45cc214666b6425f3b25c1
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>
commit timeFri, 4 Sep 2026 01:49:10 +0000