comparison src/clojure/clojure.cpp @ 525:fa7676dbf6f2

sound recording test now works.
author Robert McIntyre <rlm@mit.edu>
date Sun, 24 Jun 2012 13:12:51 -0500
parents 7ef5c73ea8fa
children
comparison
equal deleted inserted replaced
524:7ef5c73ea8fa 525:fa7676dbf6f2
363 for (i = 0; i < 44100*2; i++){ 363 for (i = 0; i < 44100*2; i++){
364 sound_store[i] = (jbyte) soundBytes[i]; 364 sound_store[i] = (jbyte) soundBytes[i];
365 } 365 }
366 366
367 /* 367 /*
368 u8* soundBytes = (u8*) soundFinalWave; 368 u8* soundBytes = (u8*) soundFinalWave;
369 for (i = 0; i < 1470*2 ; i++){ 369 for (i = 0; i < 1470*2 ; i++){
370 sound_store[i] = (jbyte) soundBytes[i]; 370 sound_store[i] = (jbyte) soundBytes[i];
371 } 371 }
372 */ 372 */
373 373
374 env->ReleaseByteArrayElements(arr, sound_store, 0); 374 env->ReleaseByteArrayElements(arr, sound_store, 0);
375 } 375 }
376 376
393 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_setSoundFrameWritten 393 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_setSoundFrameWritten
394 (JNIEnv *env, jclass clazz , jint newSoundFrameWritten){ 394 (JNIEnv *env, jclass clazz , jint newSoundFrameWritten){
395 soundFrameSoundWritten = newSoundFrameWritten; 395 soundFrameSoundWritten = newSoundFrameWritten;
396 } 396 }
397 397
398
399 /*
400 * Class: com_aurellem_gb_Gb
401 * Method: getFrameSound2
402 * Signature: ([B)V
403 */
404 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getFrameSound2
405 (JNIEnv *env, jclass clazz, jbyteArray arr){
406 setbuf(stdout, NULL);
407
408 jbyte *sound_store = env->GetByteArrayElements(arr, 0);
409 int i;
410
411 for (i = 0; i < 1470*2; i++){
412 sound_store[i] = (jbyte) soundCopyBuffer[i];
413 }
414
415 env->ReleaseByteArrayElements(arr, sound_store, 0);
416
417 }