Я хочу реализовать OpenSL ES
для улучшения качества звука. Я пытаюсь интегрировать openSL libs , но у меня есть некоторые проблемы, как я упоминаю ниже
error: undefined reference to 'slCreateEngine'
error: undefined reference to 'SL_IID_ENGINE'
Я получил код из ссылки ниже git
https://github.com/googlesamples/android-ndk/tree/master/native-audio
Мой код Java
/** Native methods, implemented in jni folder */
public static native void createEngine();
public static native void createBufferQueueAudioPlayer(int sampleRate, int samplesPerBuf);
public static native boolean createAudioRecorder();
public static native void startRecording();
public static native void shutdown();
public static native boolean selectClip(int which, int count);
public static native void setPlayingAssetAudioPlayer(boolean isPlaying);
public static native void setPlayingUriAudioPlayer(boolean isPlaying);
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("native-lib");
}
Я включаю мой CMakeLists.text файл в мой Gradle
android {
compileSdkVersion 28
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
version "3.10.2"
path "src/main/cpp/CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
}
Error
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:185: error: undefined reference to 'slCreateEngine'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_ENGINE'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_ENVIRONMENTALREVERB'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_ENVIRONMENTALREVERB'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:228: error: undefined reference to 'SL_IID_ANDROIDSIMPLEBUFFERQUEUE'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_RECORD'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_ANDROIDSIMPLEBUFFERQUEUE'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_EFFECTSEND'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_VOLUME'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_BUFFERQUEUE'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_PLAY'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_BUFFERQUEUE'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_EFFECTSEND'
D:/android-ndk-abc/MyApp/app/src/main/cpp/native-lib.cpp:0: error: undefined reference to 'SL_IID_VOLUME'
Примечание:
Я нахожу тот же вопрос неопределенная ссылка на slCreateEngine , но нет ответа, чтобы помочь.
Заранее спасибо.