SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::AndroidUSBAudio Class Reference

This class implements a custom low latency USB audio stack for Android, fully bypassing the Android system audio stack. More...

#include "SuperpoweredAndroidUSB.h"

Static Public Member Functions

static bool easyIO (int deviceID, int samplerate, int bitsPerSample, int numInputChannels, int numOutputChannels, AndroidUSBAudioBufferSize bufferSize, void *clientdata, AndroidUSBAudioProcessingCallback callback)
 
static void getBestIO (int deviceID, int *inputIOindex, int *outputIOindex, int samplerate, int bitsPerSample, int numInputChannels, int numOutputChannels, bool strict)
 Returns with the best input and output index for some audio parameters. More...
 
static void getConfigurationInfo (int deviceID, int *numConfigurations, char ***configurationNames)
 Get information about a USB audio device's configurations. More...
 
static void getInfo (int deviceID, const char **manufacturer, const char **product, const char **info)
 Get basic information about a USB audio device. More...
 
static int getInputs (int deviceID, AndroidUSBAudioIOInfo **info)
 
static void getIOOptions (int deviceID, bool input, int IOindex, int **paths, char ***pathNames, int *numPaths, int **thruPaths, char ***thruPathNames, int *numThruPaths)
 Returns with information about an input or output. More...
 
static int getOutputs (int deviceID, AndroidUSBAudioIOInfo **info)
 
static void getPathInfo (int deviceID, int pathIndex, int *numFeatures, float **minVolumes, float **maxVolumes, float **curVolumes, char **mutes)
 Returns with information about an audio path. More...
 
static void setConfiguration (int deviceID, int configurationIndex)
 Set the active configuration of USB audio device. More...
 
static bool setMute (int deviceID, int pathIndex, int channel, bool mute)
 
static float setVolume (int deviceID, int pathIndex, int channel, float db)
 
static bool startIO (int deviceID, int inputIOindex, int outputIOindex, AndroidUSBAudioBufferSize bufferSize, void *clientdata, AndroidUSBAudioProcessingCallback callback)
 
static void stopIO (int deviceID)
 Stops audio input/output. More...
 

Detailed Description

This class implements a custom low latency USB audio stack for Android, fully bypassing the Android system audio stack.

It simplifies the unlimited possibilities of the USB Audio Class to a hierarchy with 3 levels:

  1. configuration
  2. inputs and outputs
  3. paths

Member Function Documentation

◆ easyIO()

static bool Superpowered::AndroidUSBAudio::easyIO ( int  deviceID,
int  samplerate,
int  bitsPerSample,
int  numInputChannels,
int  numOutputChannels,
AndroidUSBAudioBufferSize  bufferSize,
void *  clientdata,
AndroidUSBAudioProcessingCallback  callback 
)
static
Returns
Starts audio input/output and returns with success (true) or failure (false).
Parameters
deviceIDDevice identifier.
sampleratePreferred sample rate in Hz.
bitsPerSamplePreferred bit depth.
numInputChannelsPreferred number of input channels. Set to 0 if you are not interested in audio input.
numOutputChannelsPreferred number of output channels. Set to 0 if you are not interested in audio output.
bufferSizeBuffer size
clientdataCustom pointer for the callback.
callbackThe callback to be called periodically.

◆ getBestIO()

static void Superpowered::AndroidUSBAudio::getBestIO ( int  deviceID,
int *  inputIOindex,
int *  outputIOindex,
int  samplerate,
int  bitsPerSample,
int  numInputChannels,
int  numOutputChannels,
bool  strict 
)
static

Returns with the best input and output index for some audio parameters.

Parameters
deviceIDDevice identifier.
inputIOindexReturns the best input index.
outputIOindexReturns the best output index.
samplerateSample rate in Hz.
bitsPerSampleBit depth.
numInputChannelsNumber of input channels. Set to 0 if you are not interested in input.
numOutputChannelsNumber of output channels. Set to 0 if you are not interested in output.
strictSet to true to return with indexes fully matching the parameters. Set to false to return with indexes matching the parameters as close as possible.

◆ getConfigurationInfo()

static void Superpowered::AndroidUSBAudio::getConfigurationInfo ( int  deviceID,
int *  numConfigurations,
char ***  configurationNames 
)
static

Get information about a USB audio device's configurations.

Parameters
deviceIDDevice identifier.
numConfigurationsNumber of configurations.
configurationNamesName of each configuration.

◆ getInfo()

static void Superpowered::AndroidUSBAudio::getInfo ( int  deviceID,
const char **  manufacturer,
const char **  product,
const char **  info 
)
static

Get basic information about a USB audio device.

Parameters
deviceIDDevice identifier.
manufacturerManufacturer name.
productProduct name.
infoDetailed USB information about the device.

◆ getInputs()

static int Superpowered::AndroidUSBAudio::getInputs ( int  deviceID,
AndroidUSBAudioIOInfo **  info 
)
static
Returns
Get information about audio inputs. Returns the number of inputs.
Parameters
deviceIDDevice identifier.
infoArray of AndroidUSBAudioIOInfo for each input.

◆ getIOOptions()

static void Superpowered::AndroidUSBAudio::getIOOptions ( int  deviceID,
bool  input,
int  IOindex,
int **  paths,
char ***  pathNames,
int *  numPaths,
int **  thruPaths,
char ***  thruPathNames,
int *  numThruPaths 
)
static

Returns with information about an input or output.

Parameters
deviceIDDevice identifier.
inputTrue for input, false for output.
IOindexThe index of the input or output.
pathsReturns the path indexes.
pathNamesReturns the path names.
numPathsReturns the number of paths.
thruPathsReturns the audio-thru path indexes (input only).
thruPathNamesReturns the audio-thru path names (input only).
numThruPathsReturns the number of audio-thru paths (input only).

◆ getOutputs()

static int Superpowered::AndroidUSBAudio::getOutputs ( int  deviceID,
AndroidUSBAudioIOInfo **  info 
)
static
Returns
Get information about device outputs. Returns the number of outputs.
Parameters
deviceIDDevice identifier.
infoArray of AndroidUSBAudioIOInfo for each output.

◆ getPathInfo()

static void Superpowered::AndroidUSBAudio::getPathInfo ( int  deviceID,
int  pathIndex,
int *  numFeatures,
float **  minVolumes,
float **  maxVolumes,
float **  curVolumes,
char **  mutes 
)
static

Returns with information about an audio path.

Parameters
deviceIDDevice identifier.
pathIndexPath index.
numFeaturesReturns the number of features (the size of the minVolumes, maxVolumes, curVolumes and mutes arrays).
minVolumesMinimum volume values in db.
maxVolumesMaximum volume values in db.
curVolumesCurrent volume values in db.
mutesCurrent mute values (1 muted, 0 not muted).

◆ setConfiguration()

static void Superpowered::AndroidUSBAudio::setConfiguration ( int  deviceID,
int  configurationIndex 
)
static

Set the active configuration of USB audio device.

Parameters
deviceIDDevice identifier.
configurationIndexIndex of the configuration, starting from 0.

◆ setMute()

static bool Superpowered::AndroidUSBAudio::setMute ( int  deviceID,
int  pathIndex,
int  channel,
bool  mute 
)
static
Returns
Sets mute and returns with the current state.
Parameters
deviceIDDevice identifier.
pathIndexPath index.
channelChannel number (starting from 0).
muteMute.

◆ setVolume()

static float Superpowered::AndroidUSBAudio::setVolume ( int  deviceID,
int  pathIndex,
int  channel,
float  db 
)
static
Returns
Sets volume and returns with the current volume in db.
Parameters
deviceIDDevice identifier.
pathIndexPath index.
channelChannel number (starting from 0).
dbVolume in decibels.

◆ startIO()

static bool Superpowered::AndroidUSBAudio::startIO ( int  deviceID,
int  inputIOindex,
int  outputIOindex,
AndroidUSBAudioBufferSize  bufferSize,
void *  clientdata,
AndroidUSBAudioProcessingCallback  callback 
)
static
Returns
Starts audio input/output and returns with success (true) or failure (false).
Parameters
deviceIDDevice identifier.
inputIOindexInput index.
outputIOindexOutput index.
bufferSizeBuffer size.
clientdataCustom pointer for the callback.
callbackThe callback to be called periodically.

◆ stopIO()

static void Superpowered::AndroidUSBAudio::stopIO ( int  deviceID)
static

Stops audio input/output.

Parameters
deviceIDDevice identifier.

The documentation for this class was generated from the following file: