fix(cpn): recreate QAudioOutput per playback to fix silent preview on macOS (#7516)
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
bf3137efff
commit
02432d4811
@@ -31,7 +31,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||||||
functions(model ? model->customFn : generalSettings.customFn),
|
functions(model ? model->customFn : generalSettings.customFn),
|
||||||
mediaPlayerCurrent(-1),
|
mediaPlayerCurrent(-1),
|
||||||
mediaPlayer(nullptr),
|
mediaPlayer(nullptr),
|
||||||
audioOutput(new QAudioOutput()),
|
|
||||||
modelsUpdateCnt(0)
|
modelsUpdateCnt(0)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
@@ -279,7 +278,7 @@ bool CustomFunctionsPanel::playSound(int index)
|
|||||||
stopSound(mediaPlayerCurrent);
|
stopSound(mediaPlayerCurrent);
|
||||||
|
|
||||||
mediaPlayer = new QMediaPlayer(this);
|
mediaPlayer = new QMediaPlayer(this);
|
||||||
mediaPlayer->setAudioOutput(audioOutput);
|
mediaPlayer->setAudioOutput(new QAudioOutput(mediaPlayer));
|
||||||
|
|
||||||
if (functions[index].func == FuncPlaySound)
|
if (functions[index].func == FuncPlaySound)
|
||||||
mediaPlayer->setSource(QUrl(path.prepend("qrc")));
|
mediaPlayer->setSource(QUrl(path.prepend("qrc")));
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ class CustomFunctionsPanel : public GenericPanel
|
|||||||
QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS];
|
QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS];
|
||||||
QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS];
|
QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS];
|
||||||
QMediaPlayer * mediaPlayer;
|
QMediaPlayer * mediaPlayer;
|
||||||
QAudioOutput * audioOutput;
|
|
||||||
|
|
||||||
int selectedIndex;
|
int selectedIndex;
|
||||||
int fswCapability;
|
int fswCapability;
|
||||||
|
|||||||
Reference in New Issue
Block a user