diff options
author | dhewg | 2011-03-03 11:35:21 +0100 |
---|---|---|
committer | dhewg | 2011-03-03 20:47:27 +0100 |
commit | a7a7542d1de3f6bb8d076b04cf63a761f01472e1 (patch) | |
tree | 05ee92d3923c04229fa79d7827ee6d8fbbaef47c /backends/platform/android | |
parent | 1e3c96b3efaea537dfe82b1d535d1d46cc82a8a0 (diff) | |
download | scummvm-rg350-a7a7542d1de3f6bb8d076b04cf63a761f01472e1.tar.gz scummvm-rg350-a7a7542d1de3f6bb8d076b04cf63a761f01472e1.tar.bz2 scummvm-rg350-a7a7542d1de3f6bb8d076b04cf63a761f01472e1.zip |
ANDROID: Remove an indirection when pausing
Diffstat (limited to 'backends/platform/android')
-rw-r--r-- | backends/platform/android/android.cpp | 5 | ||||
-rw-r--r-- | backends/platform/android/jni.cpp | 6 | ||||
-rw-r--r-- | backends/platform/android/jni.h | 2 | ||||
-rw-r--r-- | backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 14 | ||||
-rw-r--r-- | backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java | 4 |
5 files changed, 13 insertions, 18 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 2d396f2c48..35a6421ede 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -196,6 +196,11 @@ void *OSystem_Android::audioThreadFunc(void *arg) { while (!system->_audio_thread_exit) { if (JNI::pause) { + JNI::setAudioStop(); + + paused = true; + silence_count = 33; + LOGD("audio thread going to sleep"); sem_wait(&JNI::pause_sem); LOGD("audio thread woke up"); diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp index e1acabd6d3..73b74394c0 100644 --- a/backends/platform/android/jni.cpp +++ b/backends/platform/android/jni.cpp @@ -97,8 +97,8 @@ const JNINativeMethod JNI::_natives[] = { (void *)JNI::pushEvent }, { "enableZoning", "(Z)V", (void *)JNI::enableZoning }, - { "pauseEngine", "(Z)V", - (void *)JNI::pauseEngine } + { "setPause", "(Z)V", + (void *)JNI::setPause } }; JNI::JNI() { @@ -625,7 +625,7 @@ void JNI::enableZoning(JNIEnv *env, jobject self, jboolean enable) { _system->enableZoning(enable); } -void JNI::pauseEngine(JNIEnv *env, jobject self, jboolean value) { +void JNI::setPause(JNIEnv *env, jobject self, jboolean value) { if (!_system) return; diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h index 84688137df..146938636d 100644 --- a/backends/platform/android/jni.h +++ b/backends/platform/android/jni.h @@ -134,7 +134,7 @@ private: static void pushEvent(JNIEnv *env, jobject self, jobject java_event); static void enableZoning(JNIEnv *env, jobject self, jboolean enable); - static void pauseEngine(JNIEnv *env, jobject self, jboolean pause); + static void setPause(JNIEnv *env, jobject self, jboolean value); }; inline bool JNI::haveSurface() { diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index ffb0109e6c..20e0382c00 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -44,9 +44,9 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable { final private native void destroy(); final private native void setSurface(int width, int height); final private native int main(String[] args); - final private native void pauseEngine(boolean pause); - // Set scummvm config options + // pause the engine and all native threads + final public native void setPause(boolean pause); final public native void enableZoning(boolean enable); // Feed an event to ScummVM. Safe to call from other threads. final public native void pushEvent(Event e); @@ -135,16 +135,6 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable { System.exit(res); } - public void pause(boolean pause) { - if (audio_track != null && !pause) - audio_track.play(); - - pauseEngine(pause); - - if (audio_track != null && pause) - audio_track.stop(); - } - final private void initEGL() throws Exception { egl = (EGL10)EGLContext.getEGL(); eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java index 22ccaf0b62..921e248211 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -175,7 +175,7 @@ public class ScummVMActivity extends Activity { super.onResume(); if (scummvm != null) - scummvm.pause(false); + scummvm.setPause(false); } @Override @@ -185,7 +185,7 @@ public class ScummVMActivity extends Activity { super.onPause(); if (scummvm != null) - scummvm.pause(true); + scummvm.setPause(true); } @Override |