0

I'm using JavaCV on Android, and I'm following along with this sample activity. https://code.google.com/p/javacv/source/browse/samples/RecordActivity.java

However the line that i'm having trouble with is

 recorder.record( ShortBuffer.wrap(audioData, 0, bufferReadResult). );

But i'm getting exceptions for that line as it is expecting a Buffer[]. However reading into Buffer and ShortBuffer, I'm not sure why it wont take it.

Declarations for record()

public void record(com.googlecode.javacv.cpp.opencv_core.IplImage image) throws com.googlecode.javacv.FrameRecorder.Exception { /* compiled code */ }

public void record(com.googlecode.javacv.cpp.opencv_core.IplImage image, int pixelFormat) throws com.googlecode.javacv.FrameRecorder.Exception { /* compiled code */ }

public void record(java.nio.Buffer[] samples) throws com.googlecode.javacv.FrameRecorder.Exception { /* compiled code */ }

This is my first time using the Buffer classes, so I'm a bit confused how they work.

Israel Lopez
  • 1,135
  • 3
  • 11
  • 25

1 Answers1

1
Buffer[] barray = new Buffer[1];
barray[0] = ShortBuffer.wrap(audioData, 0, bufferReadResult);
recorder.record(barray);
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307