diff --git a/base/QtMain.cpp b/base/QtMain.cpp index fc29b26fba..3b475bd1b2 100644 --- a/base/QtMain.cpp +++ b/base/QtMain.cpp @@ -162,21 +162,12 @@ static int mainInternal(QApplication &a) SDL_CloseAudio(); } } - - // Audio must be unpaused _after_ NativeInit() SDL_PauseAudio(0); #else - QScopedPointer thread(new QThread); QScopedPointer audio(new MainAudio()); - audio->moveToThread(thread.data()); - QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); - thread->start(); + audio->run(); #endif - int ret = a.exec(); -#ifndef QT_HAS_SDL - thread->terminate(); -#endif - return ret; + return a.exec(); } #ifndef QT_HAS_SDL diff --git a/base/QtMain.h b/base/QtMain.h index 3ded3ddbc1..85685a4a50 100644 --- a/base/QtMain.h +++ b/base/QtMain.h @@ -269,19 +269,19 @@ public slots: fmt.setSampleSize(AUDIO_SAMPLESIZE); fmt.setByteOrder(QAudioFormat::LittleEndian); fmt.setSampleType(QAudioFormat::SignedInt); - mixlen = 5*2*AUDIO_CHANNELS*AUDIO_SAMPLES; + mixlen = 2*AUDIO_CHANNELS*AUDIO_SAMPLES; mixbuf = (char*)malloc(mixlen); output = new QAudioOutput(fmt); output->setBufferSize(mixlen); feed = output->start(); if (feed != NULL) - timer = startTimer(1000*AUDIO_SAMPLES / AUDIO_FREQ); + timer = startTimer((1000*AUDIO_SAMPLES) / AUDIO_FREQ); } protected: void timerEvent(QTimerEvent *) { memset(mixbuf, 0, mixlen); - size_t frames = NativeMix((short *)mixbuf, 5*AUDIO_SAMPLES); + size_t frames = NativeMix((short *)mixbuf, AUDIO_SAMPLES); if (frames > 0) feed->write(mixbuf, sizeof(short) * 2 * frames); }