Android JNI QQ voice combat

  • Inheritance of c + + library
  • Configure Fmod in Android C++ environment
  • QQ voice actual combat ideas

Other articles:

Introduction to Android JNI

Android JNI Advanced (full Demo)

Inheritance of c + + library

To change the audio, call the C++ audio library Fmod

The Fmod opening screen looks like this:

\

Then register and download:

  • Red box: I was a MAC at the time of the download, so download the MAC, this is Fmod’s own audio adjustment software
  • Green box: is the Android platform. So file and so on

The red box will look like this:

\

Then you can turn it on. When you turn it on, the system has some audio:

\

Select this to open:

\

It opens like this: some simple Settings just look at the text

Configure Fmod in Android C++ environment

Step 1: Inc folder import

Open the downloaded Fmod engine

MAC path for: fmodstudioapi20109android API. Core. Inc Windows have similar pathCopy the code

Import the Inc folder:

Step 2: cmakelists. TXT file configuration

include_directories("inc")
Copy the code

Step 3: Import the library file

# CMAKE_SOURCE_DIR cmakelists. TXT # /.. # CMAKE_ANDROID_ARCH_ABI gets the current phone CPU architectureset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/.. /jniLibs/${CMAKE_ANDROID_ARCH_ABI}")
Copy the code

Step 4: Import the jniLibs file

Step 5: Import the JAR file



Remember to add dependencies:

 implementation files("libs\\fmod.jar")
Copy the code

Step 6: Configure the SO dynamic library file and link to our SO library

The last step

  • Yellow box: Specifies the CPU architecture CMake local library
  • Red box: Specify CPU architecture and type in APK file

Bonus: can you use adb to see what CPU architecture your phone is using

adb shell getprop ro.product.cpu.abi
Copy the code

Effect picture:

At this point the Fmod configuration is complete!

QQ voice actual combat ideas

  • It is used by the message engine System
  • Configure the Sound progress by Sound
  • Through the sound track (Channel) to integrate a variety of sound mix
  • Finally, the voice is processed by DSP(Digital Signal Process)

Here only provides the idea, if has another idea please download the complete code

Note:

If the so library returns an error, comment out the other two

In the same way, if you want to see JNI basic use (native simp-lib.cpp) code, then JNI advanced and QQ voice practice code comment out!

Only one CPP file can now exist

The complete code

Other JNI articles:

Introduction to Android JNI

Android JNI Advanced (full Demo)

Original is not easy, your praise is my biggest support ~