Getting started with the Android SDK (C++)

Adding Superpowered to your project

Download the SDK from here. We recommend copying the libSuperpoweredAudioAndroid*.a files and the .h header files from the Superpowered directory to your project's directory.

Please note, to add Superpowered to your project you need to set up the Android NDK first as Superpowered runs in the native layer instead of Java to support high-performance, real-time audio processing. You can find more information about the Android NDK here.

Integrate Superpowered with CMake

Make sure that the CMakeLists.txt file is added and configured in your Android project. You need to make the following changes in this file to integrate Superpowered:

Include the Superpowered headers.

include_directories(../libs/superpowered)

Link the Superpowered library using the target_link_libraries function.

target_link_libraries(native-lib ../libs/Superpowered/libSuperpoweredAndroid${ANDROID_ABI}.a)

Initializing Superpowered

Before you can start using Superpowered you need to initialize the library. Include the Superpowered.h header file and call the Superpowered::Initialize function.

#include "Superpowered.h"
...
Superpowered::Initialize(
"ExampleLicenseKey-WillExpire-OnNextUpdate"
);

Integrating Superpowered with Android audio

To quickly integrate Superpowered with Android audio you can copy the SuperpoweredAndroidAudioIO.h and SuperpoweredAndroidAudioIO.cpp files from the Superpowered SDK package to your project. This file implements a class that uses OpenSL ES or AAudio to set up audio I/O, and an audio processing callback.

// Initialize audio engine and pass callback function.
outputIO = new SuperpoweredAndroidAudioIO (
samplerate, // device native sample rate
buffersize, // device native buffer size
false, // enableInput
true, // enableOutput
audioProcessing, // audio callback function
this, // clientData
-1, // inputStreamType (-1 = default)
SL_ANDROID_STREAM_MEDIA // outputStreamType (-1 = default)
);
...
// Audio callback function. Called by the audio engine.
static bool audioProcessing (
void *clientdata, // A custom pointer your callback receives.
short int *audioIO, // 16-bit stereo interleaved audio input and/or output.
int numFrames, // The number of frames received and/or requested.
int samplerate // The current sample rate in Hz.
) {
// ...
return false;
}
Javascript

is not supported here.

v1.0.6