Mercurial > vba-clojure
diff src/clojure/clojure.cpp @ 524:7ef5c73ea8fa
working on recording sound. almost have it, but there is still unexplained popping sounds.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 23 Jun 2012 23:10:31 -0500 |
parents | d00096b6bf17 |
children | fa7676dbf6f2 |
line wrap: on
line diff
1.1 --- a/src/clojure/clojure.cpp Sat Jun 23 20:34:14 2012 -0500 1.2 +++ b/src/clojure/clojure.cpp Sat Jun 23 23:10:31 2012 -0500 1.3 @@ -348,20 +348,30 @@ 1.4 return (jint) gbReadMemory((u16) address); 1.5 } 1.6 1.7 - 1.8 /* 1.9 * Class: com_aurellem_gb_Gb 1.10 * Method: getFrameSound 1.11 - * Signature: ([I)V 1.12 + * Signature: ([B)V 1.13 */ 1.14 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getFrameSound 1.15 -(JNIEnv *env, jclass clazz, jintArray arr){ 1.16 - jint *sound_store = env->GetIntArrayElements(arr, 0); 1.17 +(JNIEnv *env, jclass clazz, jbyteArray arr){ 1.18 + jbyte *sound_store = env->GetByteArrayElements(arr, 0); 1.19 int i; 1.20 - for (i = 0; i < 44100; i++){ 1.21 - sound_store[i] = (jint) soundFrameSound[i]; 1.22 + 1.23 + 1.24 + u8* soundBytes = (u8*) soundFrameSound; 1.25 + for (i = 0; i < 44100*2; i++){ 1.26 + sound_store[i] = (jbyte) soundBytes[i]; 1.27 } 1.28 - env->ReleaseIntArrayElements(arr, sound_store, 0); 1.29 + 1.30 + /* 1.31 + u8* soundBytes = (u8*) soundFinalWave; 1.32 + for (i = 0; i < 1470*2 ; i++){ 1.33 + sound_store[i] = (jbyte) soundBytes[i]; 1.34 + } 1.35 + */ 1.36 + 1.37 + env->ReleaseByteArrayElements(arr, sound_store, 0); 1.38 } 1.39 1.40