From ef75aee0a24f72f7e8ba5ce1aefb354309c48626 Mon Sep 17 00:00:00 2001 From: Sacha Date: Tue, 15 Jan 2013 20:45:26 +1000 Subject: [PATCH] Fix Qt audio for all platforms. --- base/QtMain.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/base/QtMain.h b/base/QtMain.h index 0cf76cefa1..21c8fb45bb 100644 --- a/base/QtMain.h +++ b/base/QtMain.h @@ -159,10 +159,9 @@ public: mixlen = 2*AUDIO_CHANNELS*AUDIO_SAMPLES; mixbuf = (char*)malloc(mixlen); output = new QAudioOutput(fmt); - output->setNotifyInterval(1000*AUDIO_SAMPLES / AUDIO_FREQ); output->setBufferSize(mixlen); - connect(output, SIGNAL(notify()), this, SLOT(writeData())); feed = output->start(); + startTimer(1000*AUDIO_SAMPLES / AUDIO_FREQ); } ~MainAudio() { feed->close(); @@ -172,8 +171,8 @@ public: free(mixbuf); } -private slots: - void writeData() { +protected: + void timerEvent(QTimerEvent *) { memset(mixbuf, 0, mixlen); NativeMix((short *)mixbuf, mixlen / 4); feed->write(mixbuf, mixlen);