diff options
author | dhewg | 2011-02-26 14:53:02 +0100 |
---|---|---|
committer | dhewg | 2011-02-27 09:04:36 +0100 |
commit | 25d895b859af0df8ea6daa85ba6ec5a0acb81f9d (patch) | |
tree | 3ef520562d76f45753c26c53a4995f42658c326d /backends/platform/android/jni.h | |
parent | 983e16b36a68292021833aa9b69305a37ffe2f91 (diff) | |
download | scummvm-rg350-25d895b859af0df8ea6daa85ba6ec5a0acb81f9d.tar.gz scummvm-rg350-25d895b859af0df8ea6daa85ba6ec5a0acb81f9d.tar.bz2 scummvm-rg350-25d895b859af0df8ea6daa85ba6ec5a0acb81f9d.zip |
ANDROID: Rework audio system
Move the audio thread to the bright side
Diffstat (limited to 'backends/platform/android/jni.h')
-rw-r--r-- | backends/platform/android/jni.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h index 02eabba569..a1fc3df67e 100644 --- a/backends/platform/android/jni.h +++ b/backends/platform/android/jni.h @@ -48,7 +48,6 @@ public: static void attachThread(); static void detachThread(); - static int getAudioSampleRate(); static void initBackend(); static void getPluginDirectories(Common::FSList &dirs); static void setWindowCaption(const char *caption); @@ -60,10 +59,18 @@ public: static inline void destroySurface(); static inline bool swapBuffers(); + static void setAudioPause(); + static void setAudioPlay(); + static void setAudioStop(); + + static inline int writeAudio(JNIEnv *env, jbyteArray &data, int offset, + int size); + private: static JavaVM *_vm; // back pointer to (java) peer instance static jobject _jobj; + static jobject _jobj_audio_track; static Common::Archive *_asset_archive; static OSystem_Android *_system; @@ -81,7 +88,6 @@ private: static jmethodID _MID_displayMessageOnOSD; static jmethodID _MID_setWindowCaption; static jmethodID _MID_initBackend; - static jmethodID _MID_audioSampleRate; static jmethodID _MID_showVirtualKeyboard; static jmethodID _MID_getSysArchives; static jmethodID _MID_getPluginDirectories; @@ -89,16 +95,21 @@ private: static jmethodID _MID_destroyScummVMSurface; static jmethodID _MID_swapBuffers; + static jmethodID _MID_AudioTrack_pause; + static jmethodID _MID_AudioTrack_play; + static jmethodID _MID_AudioTrack_stop; + static jmethodID _MID_AudioTrack_write; + static const JNINativeMethod _natives[]; static void throwByName(JNIEnv *env, const char *name, const char *msg); // natives for the dark side - static void create(JNIEnv *env, jobject self, jobject am); + static void create(JNIEnv *env, jobject self, jobject am, jobject at, + jint sample_rate, jint buffer_size); static void destroy(JNIEnv *env, jobject self); static jint main(JNIEnv *env, jobject self, jobjectArray args); static void pushEvent(JNIEnv *env, jobject self, jobject java_event); - static void audioMixCallback(JNIEnv *env, jobject self, jbyteArray jbuf); static void setConfManInt(JNIEnv *env, jclass cls, jstring key_obj, jint value); static void setConfManString(JNIEnv *env, jclass cls, jstring key_obj, @@ -128,6 +139,10 @@ inline bool JNI::swapBuffers() { return env->CallBooleanMethod(_jobj, _MID_swapBuffers); } +inline int JNI::writeAudio(JNIEnv *env, jbyteArray &data, int offset, int size) { + return env->CallIntMethod(_jobj_audio_track, _MID_AudioTrack_write, data, offset, size); +} + #endif #endif |