standalone_android.h
A plugin's standalone, as an Android app.
#include <sonore/standalone_android.h>- 1type
- Guides: Getting started, Platforms and formats
On this page
Design notes
The same App the desktop standalone runs (standalone.h) -- the plugin's Instance, processBlock, the same parameters and state -- inside an Android activity (android_app.h) instead of a desktop window:
- The editor fills the screen, by the choice every format makes: the plugin's page in a WebView when it has one (webview_android.h), else the SDK-drawn native editor, sized to the surface in logical pixels at the screen's density, re-laid out when the phone turns. An instrument's editor carries its on-screen keyboard, which a finger plays.
- A MIDI keyboard plugged in plays it: every device that sends MIDI, the ones plugged in later too (Android 10 and later; midi_input.h).
- Sound runs while the app is on screen: AAudio opens at start and closes at stop. An app that keeps playing in the background needs a foreground service, which is the app's to declare, not this file's.
- An effect hears the microphone, once the user has allowed it -- and only while the sound goes to headphones (or another private route). Through the speaker the microphone would hear the effect's own output and howl, so the input stays closed there and the log says why.
- A keyboard that comes and goes, a route that changes under the stream: the output and input are reopened when AAudio reports them lost.
sonore_add_standalone builds this into an APK on Android (no Java of its own: NativeActivity loads the library and calls ANativeActivity_onCreate below), and also the command-line program, which renders and verifies on a device from an adb shell.
Types 1
class AndroidApp : public android::ActivityHooks
The plugin as an Android app: the activity's hooks over one App.