mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
api-impl-jni: SoundPool: fix formatting
This commit is contained in:
parent
6d73fd7a99
commit
b19f2c35d2
1 changed files with 16 additions and 12 deletions
|
@ -3,18 +3,21 @@
|
|||
#include "../defines.h"
|
||||
#include "../generated_headers/android_media_SoundPool.h"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_media_SoundPool_native_1constructor(JNIEnv *env, jclass) {
|
||||
JNIEXPORT jlong JNICALL Java_android_media_SoundPool_native_1constructor(JNIEnv *env, jclass)
|
||||
{
|
||||
GArray *sound_pool_array = g_array_new(FALSE, FALSE, sizeof(GtkMediaStream *));
|
||||
return _INTPTR(sound_pool_array);
|
||||
}
|
||||
|
||||
static void on_prepared(GtkMediaStream *media_stream) {
|
||||
static void on_prepared(GtkMediaStream *media_stream)
|
||||
{
|
||||
// play once muted to ensure file is fully loaded
|
||||
gtk_media_stream_set_muted(media_stream, TRUE);
|
||||
gtk_media_stream_play(media_stream);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_media_SoundPool_nativeLoad(JNIEnv *env, jclass, jlong pool, jstring path) {
|
||||
JNIEXPORT jint JNICALL Java_android_media_SoundPool_nativeLoad(JNIEnv *env, jclass, jlong pool, jstring path)
|
||||
{
|
||||
GArray *sound_pool_array = _PTR(pool);
|
||||
const char* nativePath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
GtkMediaStream *media_stream = gtk_media_file_new_for_filename(nativePath);
|
||||
|
@ -23,7 +26,8 @@ JNIEXPORT jint JNICALL Java_android_media_SoundPool_nativeLoad(JNIEnv *env, jcla
|
|||
return g_array_append_val(sound_pool_array, media_stream)->len - 1;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_media_SoundPool_nativePlay(JNIEnv *env, jclass, jlong pool, jint soundID) {
|
||||
JNIEXPORT jint JNICALL Java_android_media_SoundPool_nativePlay(JNIEnv *env, jclass, jlong pool, jint soundID)
|
||||
{
|
||||
GArray *sound_pool_array = _PTR(pool);
|
||||
GtkMediaStream *media_stream = g_array_index(sound_pool_array, GtkMediaStream *, soundID);
|
||||
gtk_media_stream_set_muted(media_stream, FALSE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue