Skip to content

Commit

Permalink
AWWWW YEA
Browse files Browse the repository at this point in the history
SOMEONE TRY THIS
  • Loading branch information
hooby3dfx committed Feb 1, 2014
1 parent b24e401 commit 841ed65
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions shell/android/jni/src/Android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,12 @@ void get_mic_data(u8* buffer)
{
LOGD("get_mic_data called");
jbyteArray jdata = (jbyteArray)jenv->CallObjectMethod(sipemu,getmicdata);
if(jdata==NULL){
LOGD("get_mic_data jdata NULL");
return;
}
LOGD("CallObjectMethod happened");
jenv->GetByteArrayRegion(jdata, 0, 512, (jbyte*)buffer);
LOGD("GetByteArrayRegion happened");
jenv->DeleteLocalRef(jdata);
}
9 changes: 9 additions & 0 deletions shell/android/src/com/reicast/emulator/SipEmulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class SipEmulator extends Thread{

private Thread recordThread;
private boolean continueRecording;
private boolean firstGet;

/*
16-bit PCM @ 11025 hz
Expand Down Expand Up @@ -51,6 +52,8 @@ record = new AudioRecord(

bytesReadBuffer = new LinkedList<byte[]>();

continueRecording = false;
firstGet = true;
}


Expand All @@ -73,6 +76,12 @@ public void stopRecording(){
public byte[] getData(){
//Log.d(TAG, "SipEmulator getData called");
Log.d(TAG, "SipEmulator getData bytesReadBuffer size: "+bytesReadBuffer.size());
if(firstGet){
firstGet = false;
byte[] last = bytesReadBuffer.removeLast();
bytesReadBuffer.clear();
return last;
}
return bytesReadBuffer.poll();
}

Expand Down

0 comments on commit 841ed65

Please sign in to comment.