#include <fcntl.h>
#define N_CHANNELS 1
#else
+#include <hardware/audio.h>
#include <media/AudioRecord.h>
#include <media/mediarecorder.h>
using namespace android;
#endif
// TODO: get record buffer size from hardware.
record = new android::AudioRecord(
- android::AUDIO_SOURCE_DEFAULT,
+ AUDIO_SOURCE_DEFAULT,
sampleRate,
- android::AudioSystem::PCM_16_BIT,
- (numChannels > 1) ? android::AudioSystem::CHANNEL_IN_STEREO : android::AudioSystem::CHANNEL_IN_MONO,
+ AUDIO_FORMAT_PCM_16_BIT,
+ (numChannels > 1) ? AUDIO_CHANNEL_IN_STEREO : AUDIO_CHANNEL_IN_MONO,
8*1024,
0);
#include <media/AudioRecord.h>
#include <media/mediarecorder.h>
+#include <hardware/audio.h>
+
#include <jni.h>
using namespace android;
(JNIEnv *env, jclass clazz, jint sampleRate, jint fifoFrames) {
android::AudioRecord* ar = new android::AudioRecord(
- android::AUDIO_SOURCE_VOICE_RECOGNITION, sampleRate,
- android::AudioSystem::PCM_16_BIT, android::AudioSystem::CHANNEL_IN_MONO,
+ AUDIO_SOURCE_VOICE_RECOGNITION, sampleRate,
+ AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_MONO,
fifoFrames, 0);
if (ar == NULL) {
LOGE("Error creating AudioRecord");