From 02432d48112a7d37afd6c97c842484542d13a670 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Fri, 28 Aug 2026 11:29:58 +0200 Subject: [PATCH] fix(cpn): recreate QAudioOutput per playback to fix silent preview on macOS (#7516) Co-authored-by: Claude Sonnet 4.6 (1M context) --- companion/src/modeledit/customfunctions.cpp | 3 +-- companion/src/modeledit/customfunctions.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index b50a0e971..1436401b9 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -31,7 +31,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, functions(model ? model->customFn : generalSettings.customFn), mediaPlayerCurrent(-1), mediaPlayer(nullptr), - audioOutput(new QAudioOutput()), modelsUpdateCnt(0) { lock = true; @@ -279,7 +278,7 @@ bool CustomFunctionsPanel::playSound(int index) stopSound(mediaPlayerCurrent); mediaPlayer = new QMediaPlayer(this); - mediaPlayer->setAudioOutput(audioOutput); + mediaPlayer->setAudioOutput(new QAudioOutput(mediaPlayer)); if (functions[index].func == FuncPlaySound) mediaPlayer->setSource(QUrl(path.prepend("qrc"))); diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index e2a765fe9..47a0a4994 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -110,7 +110,6 @@ class CustomFunctionsPanel : public GenericPanel QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS]; QMediaPlayer * mediaPlayer; - QAudioOutput * audioOutput; int selectedIndex; int fswCapability;