Addressed review points

-cleanup vmu that gets replaced by the mic
-got rid of confusing old commented code
-stopped big memory leak if mic data was not getting read but it was
recording
This commit is contained in:
Bryan Barnes 2014-02-02 21:40:18 -05:00
parent 6df7f8912c
commit f571b187b0
2 changed files with 4 additions and 16 deletions

View File

@ -14,6 +14,7 @@
#include "cfg/cfg.h"
#include "rend/TexCache.h"
#include "hw/maple/maple_devs.h"
#include "hw/maple/maple_if.h"
#include "util.h"
@ -214,6 +215,7 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_setupMic(JNIEnv *env,jobj
{
sipemu = env->NewGlobalRef(sip);
getmicdata = env->GetMethodID(env->GetObjectClass(sipemu),"getData","()[B");
delete MapleDevices[0][1];
mcfg_Create(MDT_Microphone,0,1);
}

View File

@ -1,6 +1,5 @@
package com.reicast.emulator;
import java.util.LinkedList;
import java.util.concurrent.ConcurrentLinkedQueue;
import android.media.AudioFormat;
@ -37,7 +36,6 @@ public class SipEmulator extends Thread {
init();
}
private void init(){
@ -55,7 +53,6 @@ public class SipEmulator extends Thread {
continueRecording = false;
firstGet = true;
}
public void startRecording(){
Log.d(TAG, "SipEmulator startRecording called");
@ -97,26 +94,15 @@ public class SipEmulator extends Thread {
public void run() {
Log.d(TAG, "recordThread starting");
//sleep to let some data come in
// try {
// Thread.sleep(TIME_TO_WAIT_BETWEEN_POLLS);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
while(continueRecording){
byte[] freshData = new byte[ONE_BLIP_SIZE];
// read blocks
int bytesRead = record.read(freshData, 0, ONE_BLIP_SIZE);
//Log.d(TAG, "recordThread recorded: "+bytesRead);
bytesReadBuffer.add(freshData);
/*
try {
Thread.sleep(TIME_TO_WAIT_BETWEEN_POLLS);
} catch (InterruptedException e) {
e.printStackTrace();
if(!firstGet){
bytesReadBuffer.add(freshData);
}
*/
}
}