mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 19:55:27 +02:00
Enable threaded audio on Symbian.
This commit is contained in:
+2
-6
@@ -156,23 +156,19 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
vibra = CHWRMVibra::NewL();
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
MainAudio *audio = new MainAudio();
|
||||
#else
|
||||
QThread* thread = new QThread;
|
||||
MainAudio *audio = new MainAudio();
|
||||
audio->moveToThread(thread);
|
||||
QObject::connect(thread, SIGNAL(started()), audio, SLOT(run()));
|
||||
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
thread->start();
|
||||
#endif
|
||||
|
||||
int ret = a.exec();
|
||||
delete audio;
|
||||
#ifdef __SYMBIAN32__
|
||||
delete vibra;
|
||||
#else
|
||||
thread->quit();
|
||||
#endif
|
||||
thread->quit();
|
||||
NativeShutdown();
|
||||
net::Shutdown();
|
||||
return ret;
|
||||
|
||||
+15
-9
@@ -186,6 +186,21 @@ class MainAudio: public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainAudio() {
|
||||
}
|
||||
~MainAudio() {
|
||||
if (feed != NULL) {
|
||||
killTimer(timer);
|
||||
feed->close();
|
||||
}
|
||||
if (output) {
|
||||
output->stop();
|
||||
delete output;
|
||||
}
|
||||
if (mixbuf)
|
||||
free(mixbuf);
|
||||
}
|
||||
public slots:
|
||||
void run() {
|
||||
QAudioFormat fmt;
|
||||
fmt.setSampleRate(AUDIO_FREQ);
|
||||
fmt.setCodec("audio/pcm");
|
||||
@@ -201,15 +216,6 @@ public:
|
||||
if (feed != NULL)
|
||||
timer = startTimer(1000*AUDIO_SAMPLES / AUDIO_FREQ);
|
||||
}
|
||||
~MainAudio() {
|
||||
if (feed != NULL) {
|
||||
killTimer(timer);
|
||||
feed->close();
|
||||
}
|
||||
output->stop();
|
||||
delete output;
|
||||
free(mixbuf);
|
||||
}
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *) {
|
||||
|
||||
Reference in New Issue
Block a user