Skip to content

Commit

Permalink
Version 1.4.2
Browse files Browse the repository at this point in the history
Minor bug fix and easier ndk config.
  • Loading branch information
Gabor Szanto committed Nov 11, 2015
1 parent c2b5fc8 commit 92de186
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Android/app/build.gradle
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 11
targetSdkVersion 21
versionCode 3
versionName "1.4"
versionName "1.4.2"

sourceSets.main {
jniLibs.srcDir 'src/main/libs'
Expand All @@ -24,9 +24,10 @@ android {
}
}
task ndkBuild(type: Exec) {
commandLine '/android/ndk/ndk-build', '-B', '-C', file('src/main/jni').absolutePath
// Windows users:
// commandLine 'C:\\Android\\ndk\\ndk-build.cmd', '-B', '-C', file('src/main/jni').absolutePath
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkDir = properties.getProperty('ndk.dir')
commandLine "$ndkDir/ndk-build", '-B', '-C', file('src/main/jni').absolutePath
}

lintOptions {
Expand Down
3 changes: 1 addition & 2 deletions Android/app/src/main/jni/SuperpoweredLatency.cpp
Expand Up @@ -118,15 +118,14 @@ JNIEXPORT void Java_com_superpowered_superpoweredlatency_MainActivity_Superpower
SLDataSink inputSink = { &inputLocator, &inputFormat };
const SLInterfaceID inputInterfaces[1] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE };
(*openSLEngineInterface)->CreateAudioRecorder(openSLEngineInterface, &inputBufferQueue, &inputSource, &inputSink, 1, inputInterfaces, requireds);
(*inputBufferQueue)->Realize(inputBufferQueue, SL_BOOLEAN_FALSE);

// Configure the voice recognition preset which has no signal processing for lower latency.
SLAndroidConfigurationItf inputConfiguration;
if ((*inputBufferQueue)->GetInterface(inputBufferQueue, SL_IID_ANDROIDCONFIGURATION, &inputConfiguration) == SL_RESULT_SUCCESS) {
SLuint32 presetValue = SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION;
(*inputConfiguration)->SetConfiguration(inputConfiguration, SL_ANDROID_KEY_RECORDING_PRESET, &presetValue, sizeof(SLuint32));
(*inputBufferQueue)->Realize(inputBufferQueue, SL_BOOLEAN_FALSE);
};
(*inputBufferQueue)->Realize(inputBufferQueue, SL_BOOLEAN_FALSE);

// Create the output buffer queue.
SLDataLocator_AndroidSimpleBufferQueue outputLocator = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 1 };
Expand Down
3 changes: 2 additions & 1 deletion Android/app/src/main/jni/latencyMeasurer.cpp
Expand Up @@ -29,7 +29,8 @@ static int sumAudio(short int *audio, int numberOfSamples) {
int sum = 0;
while (numberOfSamples) {
numberOfSamples--;
sum += abs(*audio++) + abs(*audio++);
sum += abs(audio[0]) + abs(audio[1]);
audio += 2;
};
return sum;
}
Expand Down

0 comments on commit 92de186

Please sign in to comment.