Add gradle build setup

Signed-off-by: Martmists <martmists@gmail.com>
This commit is contained in:
Martmists 2021-10-26 04:36:34 +02:00
parent b8f2a30dbe
commit 7701f9f87b
No known key found for this signature in database
GPG Key ID: 7D2B8D61D42E41E4
96 changed files with 1111 additions and 3234 deletions

6
.gitignore vendored
View File

@ -141,3 +141,9 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
_deps _deps
*.cbp *.cbp
### Gradle
local.properties
.gradle/
build/
.cxx/

View File

@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.18.1)
project("ViPER4Android Reworked") project("ViPER4Android Reworked")
set(CMAKE_CXX_COMPILER_VERSION 20) set(CMAKE_CXX_COMPILER_VERSION 20)
include_directories(include/) include_directories(src/include/)
add_compile_definitions(VERSION_MAJOR=1) add_compile_definitions(VERSION_MAJOR=1)
add_compile_definitions(VERSION_MINOR=0) add_compile_definitions(VERSION_MINOR=0)
@ -14,56 +14,57 @@ add_compile_definitions(VERSION_CODENAME="Reworked")
set(FILES set(FILES
# Main # Main
src/Effect.cpp src/cpp/Effect.cpp
src/ProcessUnit_FX.cpp src/cpp/ProcessUnit_FX.cpp
src/viper.cpp src/cpp/viper.cpp
# Effects # Effects
src/effects/AnalogX.cpp src/cpp/effects/AnalogX.cpp
src/effects/Cure.cpp src/cpp/effects/Cure.cpp
src/effects/DiffSurround.cpp src/cpp/effects/DiffSurround.cpp
src/effects/DynamicSystem.cpp src/cpp/effects/DynamicSystem.cpp
src/effects/Reverberation.cpp src/cpp/effects/Reverberation.cpp
src/effects/SpeakerCorrection.cpp src/cpp/effects/SpeakerCorrection.cpp
src/effects/SpectrumExtend.cpp src/cpp/effects/SpectrumExtend.cpp
src/effects/TubeSimulator.cpp src/cpp/effects/TubeSimulator.cpp
src/effects/VHE.cpp src/cpp/effects/VHE.cpp
src/effects/ViPERClarity.cpp src/cpp/effects/ViPERClarity.cpp
# Utils # Utils
src/utils/CAllpassFilter.cpp src/cpp/utils/CAllpassFilter.cpp
src/utils/CCombFilter.cpp src/cpp/utils/CCombFilter.cpp
src/utils/CRevModel.cpp src/cpp/utils/CRevModel.cpp
src/utils/Crossfeed.cpp src/cpp/utils/Crossfeed.cpp
src/utils/DepthSurround.cpp src/cpp/utils/DepthSurround.cpp
src/utils/DynamicBass.cpp src/cpp/utils/DynamicBass.cpp
src/utils/FixedBiquad.cpp src/cpp/utils/FixedBiquad.cpp
src/utils/Harmonic.cpp src/cpp/utils/Harmonic.cpp
src/utils/HiFi.cpp src/cpp/utils/HiFi.cpp
src/utils/HighShelf.cpp src/cpp/utils/HighShelf.cpp
src/utils/IIR_1st.cpp src/cpp/utils/IIR_1st.cpp
src/utils/IIR_NOrder_BW_BP.cpp src/cpp/utils/IIR_NOrder_BW_BP.cpp
src/utils/IIR_NOrder_BW_LH.cpp src/cpp/utils/IIR_NOrder_BW_LH.cpp
src/utils/MultiBiquad.cpp src/cpp/utils/MultiBiquad.cpp
src/utils/NoiseSharpening.cpp src/cpp/utils/NoiseSharpening.cpp
src/utils/PassFilter.cpp src/cpp/utils/PassFilter.cpp
src/utils/PConvSingle_F32.cpp src/cpp/utils/PConvSingle_F32.cpp
src/utils/PolesFilter.cpp src/cpp/utils/PolesFilter.cpp
src/utils/Subwoofer.cpp src/cpp/utils/Subwoofer.cpp
src/utils/TimeConstDelay.cpp src/cpp/utils/TimeConstDelay.cpp
src/utils/WaveBuffer_I32.cpp) src/cpp/utils/WaveBuffer_I32.cpp)
message(${CMAKE_BUILD_TYPE})
add_library( add_library(
# Sets the name of the library. # Sets the name of the library.
v4afx_r v4afx_r
# Sets the library as a shared library. # Sets the library as a shared library.
SHARED SHARED
# Provides a relative path to your source file(s). # Provides a relative path to your source file(s).
${FILES}) ${FILES})
target_link_libraries( find_library(log-lib log)
v4afx_r target_link_libraries(v4afx_r ${log-lib})
log
)

36
build.gradle.kts Normal file
View File

@ -0,0 +1,36 @@
plugins {
id("com.android.application") version "7.0.3"
}
repositories {
google()
mavenCentral()
}
android {
compileSdk = 23
ndkVersion = "23.1.7779620"
externalNativeBuild {
cmake {
version = "3.21.3"
path = file("CMakeLists.txt")
}
}
defaultConfig {
externalNativeBuild {
cmake {
arguments += listOf("-DANDROID_ARM_NEON=ON", "-DANDROID_TOOLCHAIN=clang")
cFlags += listOf("-D__STDC_FORMAT_MACROS")
cppFlags += listOf("-fexceptions", "-frtti")
}
}
ndk {
abiFilters += listOf("armeabi-v7a","arm64-v8a","x86","x86_64")
// abiFilters += listOf("x86", "armeabi-v7a")
// abiFilters += listOf("x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a")
}
}
}

4
gradle.properties Normal file
View File

@ -0,0 +1,4 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Executable file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,461 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_AUDIO_POLICY_INTERFACE_H
#define ANDROID_AUDIO_POLICY_INTERFACE_H
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <hardware/hardware.h>
#include "system/audio.h"
#include "system/audio_policy.h"
__BEGIN_DECLS
/**
* The id of this module
*/
#define AUDIO_POLICY_HARDWARE_MODULE_ID "audio_policy"
/**
* Name of the audio devices to open
*/
#define AUDIO_POLICY_INTERFACE "policy"
/* ---------------------------------------------------------------------------- */
/*
* The audio_policy and audio_policy_service_ops structs define the
* communication interfaces between the platform specific audio policy manager
* and Android generic audio policy manager.
* The platform specific audio policy manager must implement methods of the
* audio_policy struct.
* This implementation makes use of the audio_policy_service_ops to control
* the activity and configuration of audio input and output streams.
*
* The platform specific audio policy manager is in charge of the audio
* routing and volume control policies for a given platform.
* The main roles of this module are:
* - keep track of current system state (removable device connections, phone
* state, user requests...).
* System state changes and user actions are notified to audio policy
* manager with methods of the audio_policy.
*
* - process get_output() queries received when AudioTrack objects are
* created: Those queries return a handler on an output that has been
* selected, configured and opened by the audio policy manager and that
* must be used by the AudioTrack when registering to the AudioFlinger
* with the createTrack() method.
* When the AudioTrack object is released, a release_output() query
* is received and the audio policy manager can decide to close or
* reconfigure the output depending on other streams using this output and
* current system state.
*
* - similarly process get_input() and release_input() queries received from
* AudioRecord objects and configure audio inputs.
* - process volume control requests: the stream volume is converted from
* an index value (received from UI) to a float value applicable to each
* output as a function of platform specific settings and current output
* route (destination device). It also make sure that streams are not
* muted if not allowed (e.g. camera shutter sound in some countries).
*/
/* XXX: this should be defined OUTSIDE of frameworks/base */
struct effect_descriptor_s;
struct audio_policy
{
/*
* configuration functions
*/
/* indicate a change in device connection status */
int (*set_device_connection_state)(struct audio_policy *pol,
audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address);
/* retrieve a device connection status */
audio_policy_dev_state_t (*get_device_connection_state)(
const struct audio_policy *pol,
audio_devices_t device,
const char *device_address);
/* indicate a change in phone state. Valid phones states are defined
* by audio_mode_t */
void (*set_phone_state)(struct audio_policy *pol, audio_mode_t state);
/* deprecated, never called (was "indicate a change in ringer mode") */
void (*set_ringer_mode)(struct audio_policy *pol, uint32_t mode,
uint32_t mask);
/* force using a specific device category for the specified usage */
void (*set_force_use)(struct audio_policy *pol,
audio_policy_force_use_t usage,
audio_policy_forced_cfg_t config);
/* retrieve current device category forced for a given usage */
audio_policy_forced_cfg_t (*get_force_use)(const struct audio_policy *pol,
audio_policy_force_use_t usage);
/* if can_mute is true, then audio streams that are marked ENFORCED_AUDIBLE
* can still be muted. */
void (*set_can_mute_enforced_audible)(struct audio_policy *pol,
bool can_mute);
/* check proper initialization */
int (*init_check)(const struct audio_policy *pol);
/*
* Audio routing query functions
*/
/* request an output appropriate for playback of the supplied stream type and
* parameters */
audio_io_handle_t (*get_output)(struct audio_policy *pol,
audio_stream_type_t stream,
uint32_t samplingRate,
audio_format_t format,
audio_channel_mask_t channelMask,
audio_output_flags_t flags,
const audio_offload_info_t *offloadInfo);
/* indicates to the audio policy manager that the output starts being used
* by corresponding stream. */
int (*start_output)(struct audio_policy *pol,
audio_io_handle_t output,
audio_stream_type_t stream,
int session);
/* indicates to the audio policy manager that the output stops being used
* by corresponding stream. */
int (*stop_output)(struct audio_policy *pol,
audio_io_handle_t output,
audio_stream_type_t stream,
int session);
/* releases the output. */
void (*release_output)(struct audio_policy *pol, audio_io_handle_t output);
/* request an input appropriate for record from the supplied device with
* supplied parameters. */
audio_io_handle_t (*get_input)(struct audio_policy *pol, audio_source_t inputSource,
uint32_t samplingRate,
audio_format_t format,
audio_channel_mask_t channelMask,
audio_in_acoustics_t acoustics);
/* indicates to the audio policy manager that the input starts being used */
int (*start_input)(struct audio_policy *pol, audio_io_handle_t input);
/* indicates to the audio policy manager that the input stops being used. */
int (*stop_input)(struct audio_policy *pol, audio_io_handle_t input);
/* releases the input. */
void (*release_input)(struct audio_policy *pol, audio_io_handle_t input);
/*
* volume control functions
*/
/* initialises stream volume conversion parameters by specifying volume
* index range. The index range for each stream is defined by AudioService. */
void (*init_stream_volume)(struct audio_policy *pol,
audio_stream_type_t stream,
int index_min,
int index_max);
/* sets the new stream volume at a level corresponding to the supplied
* index. The index is within the range specified by init_stream_volume() */
int (*set_stream_volume_index)(struct audio_policy *pol,
audio_stream_type_t stream,
int index);
/* retrieve current volume index for the specified stream */
int (*get_stream_volume_index)(const struct audio_policy *pol,
audio_stream_type_t stream,
int *index);
/* sets the new stream volume at a level corresponding to the supplied
* index for the specified device.
* The index is within the range specified by init_stream_volume() */
int (*set_stream_volume_index_for_device)(struct audio_policy *pol,
audio_stream_type_t stream,
int index,
audio_devices_t device);
/* retrieve current volume index for the specified stream for the specified device */
int (*get_stream_volume_index_for_device)(const struct audio_policy *pol,
audio_stream_type_t stream,
int *index,
audio_devices_t device);
/* return the strategy corresponding to a given stream type */
uint32_t (*get_strategy_for_stream)(const struct audio_policy *pol,
audio_stream_type_t stream);
/* return the enabled output devices for the given stream type */
audio_devices_t (*get_devices_for_stream)(const struct audio_policy *pol,
audio_stream_type_t stream);
/* Audio effect management */
audio_io_handle_t (*get_output_for_effect)(struct audio_policy *pol,
const struct effect_descriptor_s *desc);
int (*register_effect)(struct audio_policy *pol,
const struct effect_descriptor_s *desc,
audio_io_handle_t output,
uint32_t strategy,
int session,
int id);
int (*unregister_effect)(struct audio_policy *pol, int id);
int (*set_effect_enabled)(struct audio_policy *pol, int id, bool enabled);
bool (*is_stream_active)(const struct audio_policy *pol,
audio_stream_type_t stream,
uint32_t in_past_ms);
bool (*is_stream_active_remotely)(const struct audio_policy *pol,
audio_stream_type_t stream,
uint32_t in_past_ms);
bool (*is_source_active)(const struct audio_policy *pol,
audio_source_t source);
/* dump state */
int (*dump)(const struct audio_policy *pol, int fd);
/* check if offload is possible for given sample rate, bitrate, duration, ... */
bool (*is_offload_supported)(const struct audio_policy *pol,
const audio_offload_info_t *info);
};
struct audio_policy_service_ops
{
/*
* Audio output Control functions
*/
/* Opens an audio output with the requested parameters.
*
* The parameter values can indicate to use the default values in case the
* audio policy manager has no specific requirements for the output being
* opened.
*
* When the function returns, the parameter values reflect the actual
* values used by the audio hardware output stream.
*
* The audio policy manager can check if the proposed parameters are
* suitable or not and act accordingly.
*/
audio_io_handle_t (*open_output)(void *service,
audio_devices_t *pDevices,
uint32_t *pSamplingRate,
audio_format_t *pFormat,
audio_channel_mask_t *pChannelMask,
uint32_t *pLatencyMs,
audio_output_flags_t flags);
/* creates a special output that is duplicated to the two outputs passed as
* arguments. The duplication is performed by
* a special mixer thread in the AudioFlinger.
*/
audio_io_handle_t (*open_duplicate_output)(void *service,
audio_io_handle_t output1,
audio_io_handle_t output2);
/* closes the output stream */
int (*close_output)(void *service, audio_io_handle_t output);
/* suspends the output.
*
* When an output is suspended, the corresponding audio hardware output
* stream is placed in standby and the AudioTracks attached to the mixer
* thread are still processed but the output mix is discarded.
*/
int (*suspend_output)(void *service, audio_io_handle_t output);
/* restores a suspended output. */
int (*restore_output)(void *service, audio_io_handle_t output);
/* */
/* Audio input Control functions */
/* */
/* opens an audio input
* deprecated - new implementations should use open_input_on_module,
* and the acoustics parameter is ignored
*/
audio_io_handle_t (*open_input)(void *service,
audio_devices_t *pDevices,
uint32_t *pSamplingRate,
audio_format_t *pFormat,
audio_channel_mask_t *pChannelMask,
audio_in_acoustics_t acoustics);
/* closes an audio input */
int (*close_input)(void *service, audio_io_handle_t input);
/* */
/* misc control functions */
/* */
/* set a stream volume for a particular output.
*
* For the same user setting, a given stream type can have different
* volumes for each output (destination device) it is attached to.
*/
int (*set_stream_volume)(void *service,
audio_stream_type_t stream,
float volume,
audio_io_handle_t output,
int delay_ms);
/* invalidate a stream type, causing a reroute to an unspecified new output */
int (*invalidate_stream)(void *service,
audio_stream_type_t stream);
/* function enabling to send proprietary informations directly from audio
* policy manager to audio hardware interface. */
void (*set_parameters)(void *service,
audio_io_handle_t io_handle,
const char *kv_pairs,
int delay_ms);
/* function enabling to receive proprietary informations directly from
* audio hardware interface to audio policy manager.
*
* Returns a pointer to a heap allocated string. The caller is responsible
* for freeing the memory for it using free().
*/
char * (*get_parameters)(void *service, audio_io_handle_t io_handle,
const char *keys);
/* request the playback of a tone on the specified stream.
* used for instance to replace notification sounds when playing over a
* telephony device during a phone call.
*/
int (*start_tone)(void *service,
audio_policy_tone_t tone,
audio_stream_type_t stream);
int (*stop_tone)(void *service);
/* set down link audio volume. */
int (*set_voice_volume)(void *service,
float volume,
int delay_ms);
/* move effect to the specified output */
int (*move_effects)(void *service,
int session,
audio_io_handle_t src_output,
audio_io_handle_t dst_output);
/* loads an audio hw module.
*
* The module name passed is the base name of the HW module library, e.g "primary" or "a2dp".
* The function returns a handle on the module that will be used to specify a particular
* module when calling open_output_on_module() or open_input_on_module()
*/
audio_module_handle_t (*load_hw_module)(void *service,
const char *name);
/* Opens an audio output on a particular HW module.
*
* Same as open_output() but specifying a specific HW module on which the output must be opened.
*/
audio_io_handle_t (*open_output_on_module)(void *service,
audio_module_handle_t module,
audio_devices_t *pDevices,
uint32_t *pSamplingRate,
audio_format_t *pFormat,
audio_channel_mask_t *pChannelMask,
uint32_t *pLatencyMs,
audio_output_flags_t flags,
const audio_offload_info_t *offloadInfo);
/* Opens an audio input on a particular HW module.
*
* Same as open_input() but specifying a specific HW module on which the input must be opened.
* Also removed deprecated acoustics parameter
*/
audio_io_handle_t (*open_input_on_module)(void *service,
audio_module_handle_t module,
audio_devices_t *pDevices,
uint32_t *pSamplingRate,
audio_format_t *pFormat,
audio_channel_mask_t *pChannelMask);
};
/**********************************************************************/
/**
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
* and the fields of this data structure must begin with hw_module_t
* followed by module specific information.
*/
typedef struct audio_policy_module
{
struct hw_module_t common;
} audio_policy_module_t;
struct audio_policy_device
{
/**
* Common methods of the audio policy device. This *must* be the first member of
* audio_policy_device as users of this structure will cast a hw_device_t to
* audio_policy_device pointer in contexts where it's known the hw_device_t references an
* audio_policy_device.
*/
struct hw_device_t common;
int (*create_audio_policy)(const struct audio_policy_device *device,
struct audio_policy_service_ops *aps_ops,
void *service,
struct audio_policy **ap);
int (*destroy_audio_policy)(const struct audio_policy_device *device,
struct audio_policy *ap);
};
/** convenience API for opening and closing a supported device */
static inline int audio_policy_dev_open(const hw_module_t* module,
struct audio_policy_device** device)
{
return module->methods->open(module, AUDIO_POLICY_INTERFACE,
(hw_device_t**)device);
}
static inline int audio_policy_dev_close(struct audio_policy_device* device)
{
return device->common.close(&device->common);
}
__END_DECLS
#endif // ANDROID_AUDIO_POLICY_INTERFACE_H

View File

@ -1,241 +0,0 @@
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
#include <stdint.h>
#include <sys/cdefs.h>
#include "system/cutils/native_handle.h"
//#include "system/graphics.h"
__BEGIN_DECLS
/*
* Value for the hw_module_t.tag field
*/
#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
#define HARDWARE_MAKE_API_VERSION(maj,min) \
((((maj) & 0xff) << 8) | ((min) & 0xff))
#define HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) \
((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000
#define HARDWARE_API_VERSION_2_HEADER_MASK 0x0000ffff
/*
* The current HAL API version.
*
* All module implementations must set the hw_module_t.hal_api_version field
* to this value when declaring the module with HAL_MODULE_INFO_SYM.
*
* Note that previous implementations have always set this field to 0.
* Therefore, libhardware HAL API will always consider versions 0.0 and 1.0
* to be 100% binary compatible.
*
*/
#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
/*
* Helper macros for module implementors.
*
* The derived modules should provide convenience macros for supported
* versions so that implementations can explicitly specify module/device
* versions at definition time.
*
* Use this macro to set the hw_module_t.module_api_version field.
*/
#define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
#define HARDWARE_MODULE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
/*
* Use this macro to set the hw_device_t.version field
*/
#define HARDWARE_DEVICE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
#define HARDWARE_DEVICE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
struct hw_module_t;
struct hw_module_methods_t;
struct hw_device_t;
/**
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
* and the fields of this data structure must begin with hw_module_t
* followed by module specific information.
*/
typedef struct hw_module_t
{
/** tag must be initialized to HARDWARE_MODULE_TAG */
uint32_t tag;
/**
* The API version of the implemented module. The module owner is
* responsible for updating the version when a module interface has
* changed.
*
* The derived modules such as gralloc and audio own and manage this field.
* The module user must interpret the version field to decide whether or
* not to inter-operate with the supplied module implementation.
* For example, SurfaceFlinger is responsible for making sure that
* it knows how to manage different versions of the gralloc-module API,
* and AudioFlinger must know how to do the same for audio-module API.
*
* The module API version should include a major and a minor component.
* For example, version 1.0 could be represented as 0x0100. This format
* implies that versions 0x0100-0x01ff are all API-compatible.
*
* In the future, libhardware will expose a hw_get_module_version()
* (or equivalent) function that will take minimum/maximum supported
* versions as arguments and would be able to reject modules with
* versions outside of the supplied range.
*/
uint16_t module_api_version;
#define version_major module_api_version
/**
* version_major/version_minor defines are supplied here for temporary
* source code compatibility. They will be removed in the next version.
* ALL clients must convert to the new version format.
*/
/**
* The API version of the HAL module interface. This is meant to
* version the hw_module_t, hw_module_methods_t, and hw_device_t
* structures and definitions.
*
* The HAL interface owns this field. Module users/implementations
* must NOT rely on this value for version information.
*
* Presently, 0 is the only valid value.
*/
uint16_t hal_api_version;
#define version_minor hal_api_version
/** Identifier of module */
const char *id;
/** Name of this module */
const char *name;
/** Author/owner/implementor of the module */
const char *author;
/** Modules methods */
struct hw_module_methods_t* methods;
/** module's dso */
void* dso;
#ifdef __LP64__
uint64_t reserved[32-7];
#else
/** padding to 128 bytes, reserved for future use */
uint32_t reserved[32-7];
#endif
} hw_module_t;
typedef struct hw_module_methods_t
{
/** Open a specific device */
int (*open)(const struct hw_module_t* module, const char* id,
struct hw_device_t** device);
} hw_module_methods_t;
/**
* Every device data structure must begin with hw_device_t
* followed by module specific public methods and attributes.
*/
typedef struct hw_device_t
{
/** tag must be initialized to HARDWARE_DEVICE_TAG */
uint32_t tag;
/**
* Version of the module-specific device API. This value is used by
* the derived-module user to manage different device implementations.
*
* The module user is responsible for checking the module_api_version
* and device version fields to ensure that the user is capable of
* communicating with the specific module implementation.
*
* One module can support multiple devices with different versions. This
* can be useful when a device interface changes in an incompatible way
* but it is still necessary to support older implementations at the same
* time. One such example is the Camera 2.0 API.
*
* This field is interpreted by the module user and is ignored by the
* HAL interface itself.
*/
uint32_t version;
/** reference to the module this device belongs to */
struct hw_module_t* module;
/** padding reserved for future use */
#ifdef __LP64__
uint64_t reserved[12];
#else
uint32_t reserved[12];
#endif
/** Close this device */
int (*close)(struct hw_device_t* device);
} hw_device_t;
/**
* Name of the hal_module_info
*/
#define HAL_MODULE_INFO_SYM HMI
/**
* Name of the hal_module_info as a string
*/
#define HAL_MODULE_INFO_SYM_AS_STR "HMI"
/**
* Get the module info associated with a module by id.
*
* @return: 0 == success, <0 == error and *module == NULL
*/
int hw_get_module(const char *id, const struct hw_module_t **module);
/**
* Get the module info associated with a module instance by class 'class_id'
* and instance 'inst'.
*
* Some modules types necessitate multiple instances. For example audio supports
* multiple concurrent interfaces and thus 'audio' is the module class
* and 'primary' or 'a2dp' are module interfaces. This implies that the files
* providing these modules would be named audio.primary.<variant>.so and
* audio.a2dp.<variant>.so
*
* @return: 0 == success, <0 == error and *module == NULL
*/
int hw_get_module_by_class(const char *class_id, const char *inst,
const struct hw_module_t **module);
__END_DECLS
#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */

View File

@ -1,177 +0,0 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_AUDIO_BASE_UTILS_H
#define ANDROID_AUDIO_BASE_UTILS_H
#include "audio-base.h"
/** Define helper values to iterate over enum, extend them or checking value validity.
* Those values are compatible with the O corresponding enum values.
* They are not macro like similar values in audio.h to avoid conflicting
* with the libhardware_legacy audio.h.
*/
enum {
/** Number of audio stream available to vendors. */
AUDIO_STREAM_PUBLIC_CNT = AUDIO_STREAM_ACCESSIBILITY + 1,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/** Total number of stream handled by the policy*/
AUDIO_STREAM_FOR_POLICY_CNT= AUDIO_STREAM_REROUTING + 1,
#endif
/** Total number of stream. */
AUDIO_STREAM_CNT = AUDIO_STREAM_PATCH + 1,
AUDIO_SOURCE_MAX = AUDIO_SOURCE_UNPROCESSED,
AUDIO_SOURCE_CNT = AUDIO_SOURCE_MAX + 1,
AUDIO_MODE_MAX = AUDIO_MODE_IN_COMMUNICATION,
AUDIO_MODE_CNT = AUDIO_MODE_MAX + 1,
/** For retrocompatibility AUDIO_MODE_* and AUDIO_STREAM_* must be signed. */
AUDIO_DETAIL_NEGATIVE_VALUE = -1,
};
enum {
AUDIO_CHANNEL_OUT_ALL = AUDIO_CHANNEL_OUT_FRONT_LEFT |
AUDIO_CHANNEL_OUT_FRONT_RIGHT |
AUDIO_CHANNEL_OUT_FRONT_CENTER |
AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
AUDIO_CHANNEL_OUT_BACK_LEFT |
AUDIO_CHANNEL_OUT_BACK_RIGHT |
AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
AUDIO_CHANNEL_OUT_BACK_CENTER |
AUDIO_CHANNEL_OUT_SIDE_LEFT |
AUDIO_CHANNEL_OUT_SIDE_RIGHT |
AUDIO_CHANNEL_OUT_TOP_CENTER |
AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT |
AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER |
AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT |
AUDIO_CHANNEL_OUT_TOP_BACK_LEFT |
AUDIO_CHANNEL_OUT_TOP_BACK_CENTER |
AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT |
AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT |
AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT,
AUDIO_CHANNEL_IN_ALL = AUDIO_CHANNEL_IN_LEFT |
AUDIO_CHANNEL_IN_RIGHT |
AUDIO_CHANNEL_IN_FRONT |
AUDIO_CHANNEL_IN_BACK|
AUDIO_CHANNEL_IN_LEFT_PROCESSED |
AUDIO_CHANNEL_IN_RIGHT_PROCESSED |
AUDIO_CHANNEL_IN_FRONT_PROCESSED |
AUDIO_CHANNEL_IN_BACK_PROCESSED|
AUDIO_CHANNEL_IN_PRESSURE |
AUDIO_CHANNEL_IN_X_AXIS |
AUDIO_CHANNEL_IN_Y_AXIS |
AUDIO_CHANNEL_IN_Z_AXIS |
AUDIO_CHANNEL_IN_VOICE_UPLINK |
AUDIO_CHANNEL_IN_VOICE_DNLINK |
AUDIO_CHANNEL_IN_BACK_LEFT |
AUDIO_CHANNEL_IN_BACK_RIGHT |
AUDIO_CHANNEL_IN_CENTER |
AUDIO_CHANNEL_IN_LOW_FREQUENCY |
AUDIO_CHANNEL_IN_TOP_LEFT |
AUDIO_CHANNEL_IN_TOP_RIGHT,
AUDIO_DEVICE_OUT_ALL = AUDIO_DEVICE_OUT_EARPIECE |
AUDIO_DEVICE_OUT_SPEAKER |
AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER |
AUDIO_DEVICE_OUT_HDMI |
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
AUDIO_DEVICE_OUT_USB_ACCESSORY |
AUDIO_DEVICE_OUT_USB_DEVICE |
AUDIO_DEVICE_OUT_REMOTE_SUBMIX |
AUDIO_DEVICE_OUT_TELEPHONY_TX |
AUDIO_DEVICE_OUT_LINE |
AUDIO_DEVICE_OUT_HDMI_ARC |
AUDIO_DEVICE_OUT_SPDIF |
AUDIO_DEVICE_OUT_FM |
AUDIO_DEVICE_OUT_AUX_LINE |
AUDIO_DEVICE_OUT_SPEAKER_SAFE |
AUDIO_DEVICE_OUT_IP |
AUDIO_DEVICE_OUT_BUS |
AUDIO_DEVICE_OUT_PROXY |
AUDIO_DEVICE_OUT_USB_HEADSET |
AUDIO_DEVICE_OUT_HEARING_AID |
AUDIO_DEVICE_OUT_ECHO_CANCELLER |
AUDIO_DEVICE_OUT_DEFAULT,
AUDIO_DEVICE_OUT_ALL_A2DP = AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER,
AUDIO_DEVICE_OUT_ALL_SCO = AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT,
AUDIO_DEVICE_OUT_ALL_USB = AUDIO_DEVICE_OUT_USB_ACCESSORY |
AUDIO_DEVICE_OUT_USB_DEVICE |
AUDIO_DEVICE_OUT_USB_HEADSET,
AUDIO_DEVICE_IN_ALL = AUDIO_DEVICE_IN_COMMUNICATION |
AUDIO_DEVICE_IN_AMBIENT |
AUDIO_DEVICE_IN_BUILTIN_MIC |
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_IN_WIRED_HEADSET |
AUDIO_DEVICE_IN_HDMI |
AUDIO_DEVICE_IN_TELEPHONY_RX |
AUDIO_DEVICE_IN_BACK_MIC |
AUDIO_DEVICE_IN_REMOTE_SUBMIX |
AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET |
AUDIO_DEVICE_IN_USB_ACCESSORY |
AUDIO_DEVICE_IN_USB_DEVICE |
AUDIO_DEVICE_IN_FM_TUNER |
AUDIO_DEVICE_IN_TV_TUNER |
AUDIO_DEVICE_IN_LINE |
AUDIO_DEVICE_IN_SPDIF |
AUDIO_DEVICE_IN_BLUETOOTH_A2DP |
AUDIO_DEVICE_IN_LOOPBACK |
AUDIO_DEVICE_IN_IP |
AUDIO_DEVICE_IN_BUS |
AUDIO_DEVICE_IN_PROXY |
AUDIO_DEVICE_IN_USB_HEADSET |
AUDIO_DEVICE_IN_BLUETOOTH_BLE |
AUDIO_DEVICE_IN_DEFAULT,
AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
AUDIO_DEVICE_IN_ALL_USB = AUDIO_DEVICE_IN_USB_ACCESSORY |
AUDIO_DEVICE_IN_USB_DEVICE |
AUDIO_DEVICE_IN_USB_HEADSET,
AUDIO_USAGE_MAX = AUDIO_USAGE_ASSISTANT,
AUDIO_USAGE_CNT = AUDIO_USAGE_ASSISTANT + 1,
AUDIO_PORT_CONFIG_ALL = AUDIO_PORT_CONFIG_SAMPLE_RATE |
AUDIO_PORT_CONFIG_CHANNEL_MASK |
AUDIO_PORT_CONFIG_FORMAT |
AUDIO_PORT_CONFIG_GAIN,
}; // enum
#endif // ANDROID_AUDIO_BASE_UTILS_H

View File

@ -1,450 +0,0 @@
// This file is autogenerated by hidl-gen
// then manualy edited for retrocompatiblity
// Source: android.hardware.audio.common@4.0
// Root: android.hardware:hardware/interfaces
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_COMMON_V4_0_EXPORTED_CONSTANTS_H_
#define HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_COMMON_V4_0_EXPORTED_CONSTANTS_H_
#ifdef __cplusplus
extern "C" {
#endif
enum {
AUDIO_IO_HANDLE_NONE = 0,
AUDIO_MODULE_HANDLE_NONE = 0,
AUDIO_PORT_HANDLE_NONE = 0,
AUDIO_PATCH_HANDLE_NONE = 0,
};
typedef enum {
AUDIO_STREAM_DEFAULT = -1, // (-1)
AUDIO_STREAM_MIN = 0,
AUDIO_STREAM_VOICE_CALL = 0,
AUDIO_STREAM_SYSTEM = 1,
AUDIO_STREAM_RING = 2,
AUDIO_STREAM_MUSIC = 3,
AUDIO_STREAM_ALARM = 4,
AUDIO_STREAM_NOTIFICATION = 5,
AUDIO_STREAM_BLUETOOTH_SCO = 6,
AUDIO_STREAM_ENFORCED_AUDIBLE = 7,
AUDIO_STREAM_DTMF = 8,
AUDIO_STREAM_TTS = 9,
AUDIO_STREAM_ACCESSIBILITY = 10,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/** For dynamic policy output mixes. Only used by the audio policy */
AUDIO_STREAM_REROUTING = 11,
/** For audio flinger tracks volume. Only used by the audioflinger */
AUDIO_STREAM_PATCH = 12,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
} audio_stream_type_t;
typedef enum {
AUDIO_SOURCE_DEFAULT = 0,
AUDIO_SOURCE_MIC = 1,
AUDIO_SOURCE_VOICE_UPLINK = 2,
AUDIO_SOURCE_VOICE_DOWNLINK = 3,
AUDIO_SOURCE_VOICE_CALL = 4,
AUDIO_SOURCE_CAMCORDER = 5,
AUDIO_SOURCE_VOICE_RECOGNITION = 6,
AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
AUDIO_SOURCE_REMOTE_SUBMIX = 8,
AUDIO_SOURCE_UNPROCESSED = 9,
AUDIO_SOURCE_FM_TUNER = 1998,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/**
* A low-priority, preemptible audio source for for background software
* hotword detection. Same tuning as VOICE_RECOGNITION.
* Used only internally by the framework.
*/
AUDIO_SOURCE_HOTWORD = 1999,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
} audio_source_t;
typedef enum {
AUDIO_SESSION_OUTPUT_STAGE = -1, // (-1)
AUDIO_SESSION_OUTPUT_MIX = 0,
AUDIO_SESSION_ALLOCATE = 0,
AUDIO_SESSION_NONE = 0,
} audio_session_t;
typedef enum {
AUDIO_FORMAT_INVALID = 0xFFFFFFFFu,
AUDIO_FORMAT_DEFAULT = 0,
AUDIO_FORMAT_PCM = 0x00000000u,
AUDIO_FORMAT_MP3 = 0x01000000u,
AUDIO_FORMAT_AMR_NB = 0x02000000u,
AUDIO_FORMAT_AMR_WB = 0x03000000u,
AUDIO_FORMAT_AAC = 0x04000000u,
AUDIO_FORMAT_HE_AAC_V1 = 0x05000000u,
AUDIO_FORMAT_HE_AAC_V2 = 0x06000000u,
AUDIO_FORMAT_VORBIS = 0x07000000u,
AUDIO_FORMAT_OPUS = 0x08000000u,
AUDIO_FORMAT_AC3 = 0x09000000u,
AUDIO_FORMAT_E_AC3 = 0x0A000000u,
AUDIO_FORMAT_DTS = 0x0B000000u,
AUDIO_FORMAT_DTS_HD = 0x0C000000u,
AUDIO_FORMAT_IEC61937 = 0x0D000000u,
AUDIO_FORMAT_DOLBY_TRUEHD = 0x0E000000u,
AUDIO_FORMAT_EVRC = 0x10000000u,
AUDIO_FORMAT_EVRCB = 0x11000000u,
AUDIO_FORMAT_EVRCWB = 0x12000000u,
AUDIO_FORMAT_EVRCNW = 0x13000000u,
AUDIO_FORMAT_AAC_ADIF = 0x14000000u,
AUDIO_FORMAT_WMA = 0x15000000u,
AUDIO_FORMAT_WMA_PRO = 0x16000000u,
AUDIO_FORMAT_AMR_WB_PLUS = 0x17000000u,
AUDIO_FORMAT_MP2 = 0x18000000u,
AUDIO_FORMAT_QCELP = 0x19000000u,
AUDIO_FORMAT_DSD = 0x1A000000u,
AUDIO_FORMAT_FLAC = 0x1B000000u,
AUDIO_FORMAT_ALAC = 0x1C000000u,
AUDIO_FORMAT_APE = 0x1D000000u,
AUDIO_FORMAT_AAC_ADTS = 0x1E000000u,
AUDIO_FORMAT_SBC = 0x1F000000u,
AUDIO_FORMAT_APTX = 0x20000000u,
AUDIO_FORMAT_APTX_HD = 0x21000000u,
AUDIO_FORMAT_AC4 = 0x22000000u,
AUDIO_FORMAT_LDAC = 0x23000000u,
AUDIO_FORMAT_MAT = 0x24000000u,
AUDIO_FORMAT_MAIN_MASK = 0xFF000000u,
AUDIO_FORMAT_SUB_MASK = 0x00FFFFFFu,
/* Subformats */
AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1u,
AUDIO_FORMAT_PCM_SUB_8_BIT = 0x2u,
AUDIO_FORMAT_PCM_SUB_32_BIT = 0x3u,
AUDIO_FORMAT_PCM_SUB_8_24_BIT = 0x4u,
AUDIO_FORMAT_PCM_SUB_FLOAT = 0x5u,
AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED = 0x6u,
AUDIO_FORMAT_MP3_SUB_NONE = 0x0u,
AUDIO_FORMAT_AMR_SUB_NONE = 0x0u,
AUDIO_FORMAT_AAC_SUB_MAIN = 0x1u,
AUDIO_FORMAT_AAC_SUB_LC = 0x2u,
AUDIO_FORMAT_AAC_SUB_SSR = 0x4u,
AUDIO_FORMAT_AAC_SUB_LTP = 0x8u,
AUDIO_FORMAT_AAC_SUB_HE_V1 = 0x10u,
AUDIO_FORMAT_AAC_SUB_SCALABLE = 0x20u,
AUDIO_FORMAT_AAC_SUB_ERLC = 0x40u,
AUDIO_FORMAT_AAC_SUB_LD = 0x80u,
AUDIO_FORMAT_AAC_SUB_HE_V2 = 0x100u,
AUDIO_FORMAT_AAC_SUB_ELD = 0x200u,
AUDIO_FORMAT_AAC_SUB_XHE = 0x300u,
AUDIO_FORMAT_VORBIS_SUB_NONE = 0x0u,
AUDIO_FORMAT_E_AC3_SUB_JOC = 0x1u,
AUDIO_FORMAT_MAT_SUB_1_0 = 0x1u,
AUDIO_FORMAT_MAT_SUB_2_0 = 0x2u,
AUDIO_FORMAT_MAT_SUB_2_1 = 0x3u,
/* Aliases */
AUDIO_FORMAT_PCM_16_BIT = 0x1u, // (PCM | PCM_SUB_16_BIT)
AUDIO_FORMAT_PCM_8_BIT = 0x2u, // (PCM | PCM_SUB_8_BIT)
AUDIO_FORMAT_PCM_32_BIT = 0x3u, // (PCM | PCM_SUB_32_BIT)
AUDIO_FORMAT_PCM_8_24_BIT = 0x4u, // (PCM | PCM_SUB_8_24_BIT)
AUDIO_FORMAT_PCM_FLOAT = 0x5u, // (PCM | PCM_SUB_FLOAT)
AUDIO_FORMAT_PCM_24_BIT_PACKED = 0x6u, // (PCM | PCM_SUB_24_BIT_PACKED)
AUDIO_FORMAT_AAC_MAIN = 0x4000001u, // (AAC | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_LC = 0x4000002u, // (AAC | AAC_SUB_LC)
AUDIO_FORMAT_AAC_SSR = 0x4000004u, // (AAC | AAC_SUB_SSR)
AUDIO_FORMAT_AAC_LTP = 0x4000008u, // (AAC | AAC_SUB_LTP)
AUDIO_FORMAT_AAC_HE_V1 = 0x4000010u, // (AAC | AAC_SUB_HE_V1)
AUDIO_FORMAT_AAC_SCALABLE = 0x4000020u, // (AAC | AAC_SUB_SCALABLE)
AUDIO_FORMAT_AAC_ERLC = 0x4000040u, // (AAC | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_LD = 0x4000080u, // (AAC | AAC_SUB_LD)
AUDIO_FORMAT_AAC_HE_V2 = 0x4000100u, // (AAC | AAC_SUB_HE_V2)
AUDIO_FORMAT_AAC_ELD = 0x4000200u, // (AAC | AAC_SUB_ELD)
AUDIO_FORMAT_AAC_XHE = 0x4000300u, // (AAC | AAC_SUB_XHE)
AUDIO_FORMAT_AAC_ADTS_MAIN = 0x1e000001u, // (AAC_ADTS | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_ADTS_LC = 0x1e000002u, // (AAC_ADTS | AAC_SUB_LC)
AUDIO_FORMAT_AAC_ADTS_SSR = 0x1e000004u, // (AAC_ADTS | AAC_SUB_SSR)
AUDIO_FORMAT_AAC_ADTS_LTP = 0x1e000008u, // (AAC_ADTS | AAC_SUB_LTP)
AUDIO_FORMAT_AAC_ADTS_HE_V1 = 0x1e000010u, // (AAC_ADTS | AAC_SUB_HE_V1)
AUDIO_FORMAT_AAC_ADTS_SCALABLE = 0x1e000020u, // (AAC_ADTS | AAC_SUB_SCALABLE)
AUDIO_FORMAT_AAC_ADTS_ERLC = 0x1e000040u, // (AAC_ADTS | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_ADTS_LD = 0x1e000080u, // (AAC_ADTS | AAC_SUB_LD)
AUDIO_FORMAT_AAC_ADTS_HE_V2 = 0x1e000100u, // (AAC_ADTS | AAC_SUB_HE_V2)
AUDIO_FORMAT_AAC_ADTS_ELD = 0x1e000200u, // (AAC_ADTS | AAC_SUB_ELD)
AUDIO_FORMAT_AAC_ADTS_XHE = 0x1e000300u, // (AAC_ADTS | AAC_SUB_XHE)
AUDIO_FORMAT_E_AC3_JOC = 0xA000001u, // (E_AC3 | E_AC3_SUB_JOC)
AUDIO_FORMAT_MAT_1_0 = 0x24000001u, // (MAT | MAT_SUB_1_0)
AUDIO_FORMAT_MAT_2_0 = 0x24000002u, // (MAT | MAT_SUB_2_0)
AUDIO_FORMAT_MAT_2_1 = 0x24000003u, // (MAT | MAT_SUB_2_1)
} audio_format_t;
enum {
FCC_2 = 2,
FCC_8 = 8,
};
enum {
AUDIO_CHANNEL_REPRESENTATION_POSITION = 0x0u,
AUDIO_CHANNEL_REPRESENTATION_INDEX = 0x2u,
AUDIO_CHANNEL_NONE = 0x0u,
AUDIO_CHANNEL_INVALID = 0xC0000000u,
AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1u,
AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2u,
AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4u,
AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8u,
AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10u,
AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20u,
AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40u,
AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80u,
AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100u,
AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200u,
AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400u,
AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800u,
AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000u,
AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000u,
AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000u,
AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000u,
AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000u,
AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000u,
AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT = 0x40000u,
AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT = 0x80000u,
AUDIO_CHANNEL_OUT_MONO = 0x1u, // OUT_FRONT_LEFT
AUDIO_CHANNEL_OUT_STEREO = 0x3u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT
AUDIO_CHANNEL_OUT_2POINT1 = 0xBu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_2POINT0POINT2 = 0xC0003u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_2POINT1POINT2 = 0xC000Bu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_3POINT0POINT2 = 0xC0007u, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_3POINT1POINT2 = 0xC000Fu, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_QUAD = 0x33u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT
AUDIO_CHANNEL_OUT_QUAD_BACK = 0x33u, // OUT_QUAD
AUDIO_CHANNEL_OUT_QUAD_SIDE = 0x603u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_SURROUND = 0x107u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER
AUDIO_CHANNEL_OUT_PENTA = 0x37u, // OUT_QUAD | OUT_FRONT_CENTER
AUDIO_CHANNEL_OUT_5POINT1 = 0x3Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT
AUDIO_CHANNEL_OUT_5POINT1_BACK = 0x3Fu, // OUT_5POINT1
AUDIO_CHANNEL_OUT_5POINT1_SIDE = 0x60Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_5POINT1POINT2 = 0xC003Fu, // OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_5POINT1POINT4 = 0x2D03Fu, // OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
AUDIO_CHANNEL_OUT_6POINT1 = 0x13Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER
AUDIO_CHANNEL_OUT_7POINT1 = 0x63Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_7POINT1POINT2 = 0xC063Fu, // OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_7POINT1POINT4 = 0x2D63Fu, // OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
AUDIO_CHANNEL_IN_LEFT = 0x4u,
AUDIO_CHANNEL_IN_RIGHT = 0x8u,
AUDIO_CHANNEL_IN_FRONT = 0x10u,
AUDIO_CHANNEL_IN_BACK = 0x20u,
AUDIO_CHANNEL_IN_LEFT_PROCESSED = 0x40u,
AUDIO_CHANNEL_IN_RIGHT_PROCESSED = 0x80u,
AUDIO_CHANNEL_IN_FRONT_PROCESSED = 0x100u,
AUDIO_CHANNEL_IN_BACK_PROCESSED = 0x200u,
AUDIO_CHANNEL_IN_PRESSURE = 0x400u,
AUDIO_CHANNEL_IN_X_AXIS = 0x800u,
AUDIO_CHANNEL_IN_Y_AXIS = 0x1000u,
AUDIO_CHANNEL_IN_Z_AXIS = 0x2000u,
AUDIO_CHANNEL_IN_BACK_LEFT = 0x10000u,
AUDIO_CHANNEL_IN_BACK_RIGHT = 0x20000u,
AUDIO_CHANNEL_IN_CENTER = 0x40000u,
AUDIO_CHANNEL_IN_LOW_FREQUENCY = 0x100000u,
AUDIO_CHANNEL_IN_TOP_LEFT = 0x200000u,
AUDIO_CHANNEL_IN_TOP_RIGHT = 0x400000u,
AUDIO_CHANNEL_IN_VOICE_UPLINK = 0x4000u,
AUDIO_CHANNEL_IN_VOICE_DNLINK = 0x8000u,
AUDIO_CHANNEL_IN_MONO = 0x10u, // IN_FRONT
AUDIO_CHANNEL_IN_STEREO = 0xCu, // IN_LEFT | IN_RIGHT
AUDIO_CHANNEL_IN_FRONT_BACK = 0x30u, // IN_FRONT | IN_BACK
AUDIO_CHANNEL_IN_6 = 0xFCu, // IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED
AUDIO_CHANNEL_IN_2POINT0POINT2 = 0x60000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
AUDIO_CHANNEL_IN_2POINT1POINT2 = 0x70000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_3POINT0POINT2 = 0x64000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
AUDIO_CHANNEL_IN_3POINT1POINT2 = 0x74000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_5POINT1 = 0x17000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO = 0x4010u, // IN_VOICE_UPLINK | IN_MONO
AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO = 0x8010u, // IN_VOICE_DNLINK | IN_MONO
AUDIO_CHANNEL_IN_VOICE_CALL_MONO = 0xC010u, // IN_VOICE_UPLINK_MONO | IN_VOICE_DNLINK_MONO
AUDIO_CHANNEL_COUNT_MAX = 30u,
AUDIO_CHANNEL_INDEX_HDR = 0x80000000u, // REPRESENTATION_INDEX << COUNT_MAX
AUDIO_CHANNEL_INDEX_MASK_1 = 0x80000001u, // INDEX_HDR | (1 << 1) - 1
AUDIO_CHANNEL_INDEX_MASK_2 = 0x80000003u, // INDEX_HDR | (1 << 2) - 1
AUDIO_CHANNEL_INDEX_MASK_3 = 0x80000007u, // INDEX_HDR | (1 << 3) - 1
AUDIO_CHANNEL_INDEX_MASK_4 = 0x8000000Fu, // INDEX_HDR | (1 << 4) - 1
AUDIO_CHANNEL_INDEX_MASK_5 = 0x8000001Fu, // INDEX_HDR | (1 << 5) - 1
AUDIO_CHANNEL_INDEX_MASK_6 = 0x8000003Fu, // INDEX_HDR | (1 << 6) - 1
AUDIO_CHANNEL_INDEX_MASK_7 = 0x8000007Fu, // INDEX_HDR | (1 << 7) - 1
AUDIO_CHANNEL_INDEX_MASK_8 = 0x800000FFu, // INDEX_HDR | (1 << 8) - 1
};
typedef enum {
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_MODE_INVALID = -2, // (-2)
AUDIO_MODE_CURRENT = -1, // (-1)
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_MODE_NORMAL = 0,
AUDIO_MODE_RINGTONE = 1,
AUDIO_MODE_IN_CALL = 2,
AUDIO_MODE_IN_COMMUNICATION = 3,
} audio_mode_t;
enum {
AUDIO_DEVICE_NONE = 0x0u,
AUDIO_DEVICE_BIT_IN = 0x80000000u,
AUDIO_DEVICE_BIT_DEFAULT = 0x40000000u,
AUDIO_DEVICE_OUT_EARPIECE = 0x1u,
AUDIO_DEVICE_OUT_SPEAKER = 0x2u,
AUDIO_DEVICE_OUT_WIRED_HEADSET = 0x4u,
AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 0x8u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 0x10u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 0x80u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200u,
AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400u,
AUDIO_DEVICE_OUT_HDMI = 0x400u, // OUT_AUX_DIGITAL
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800u,
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000u,
AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000u,
AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000u,
AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000u,
AUDIO_DEVICE_OUT_TELEPHONY_TX = 0x10000u,
AUDIO_DEVICE_OUT_LINE = 0x20000u,
AUDIO_DEVICE_OUT_HDMI_ARC = 0x40000u,
AUDIO_DEVICE_OUT_SPDIF = 0x80000u,
AUDIO_DEVICE_OUT_FM = 0x100000u,
AUDIO_DEVICE_OUT_AUX_LINE = 0x200000u,
AUDIO_DEVICE_OUT_SPEAKER_SAFE = 0x400000u,
AUDIO_DEVICE_OUT_IP = 0x800000u,
AUDIO_DEVICE_OUT_BUS = 0x1000000u,
AUDIO_DEVICE_OUT_PROXY = 0x2000000u,
AUDIO_DEVICE_OUT_USB_HEADSET = 0x4000000u,
AUDIO_DEVICE_OUT_HEARING_AID = 0x8000000u,
AUDIO_DEVICE_OUT_ECHO_CANCELLER = 0x10000000u,
AUDIO_DEVICE_OUT_DEFAULT = 0x40000000u, // BIT_DEFAULT
AUDIO_DEVICE_IN_COMMUNICATION = 0x80000001u, // BIT_IN | 0x1
AUDIO_DEVICE_IN_AMBIENT = 0x80000002u, // BIT_IN | 0x2
AUDIO_DEVICE_IN_BUILTIN_MIC = 0x80000004u, // BIT_IN | 0x4
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000008u, // BIT_IN | 0x8
AUDIO_DEVICE_IN_WIRED_HEADSET = 0x80000010u, // BIT_IN | 0x10
AUDIO_DEVICE_IN_AUX_DIGITAL = 0x80000020u, // BIT_IN | 0x20
AUDIO_DEVICE_IN_HDMI = 0x80000020u, // IN_AUX_DIGITAL
AUDIO_DEVICE_IN_VOICE_CALL = 0x80000040u, // BIT_IN | 0x40
AUDIO_DEVICE_IN_TELEPHONY_RX = 0x80000040u, // IN_VOICE_CALL
AUDIO_DEVICE_IN_BACK_MIC = 0x80000080u, // BIT_IN | 0x80
AUDIO_DEVICE_IN_REMOTE_SUBMIX = 0x80000100u, // BIT_IN | 0x100
AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = 0x80000200u, // BIT_IN | 0x200
AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = 0x80000400u, // BIT_IN | 0x400
AUDIO_DEVICE_IN_USB_ACCESSORY = 0x80000800u, // BIT_IN | 0x800
AUDIO_DEVICE_IN_USB_DEVICE = 0x80001000u, // BIT_IN | 0x1000
AUDIO_DEVICE_IN_FM_TUNER = 0x80002000u, // BIT_IN | 0x2000
AUDIO_DEVICE_IN_TV_TUNER = 0x80004000u, // BIT_IN | 0x4000
AUDIO_DEVICE_IN_LINE = 0x80008000u, // BIT_IN | 0x8000
AUDIO_DEVICE_IN_SPDIF = 0x80010000u, // BIT_IN | 0x10000
AUDIO_DEVICE_IN_BLUETOOTH_A2DP = 0x80020000u, // BIT_IN | 0x20000
AUDIO_DEVICE_IN_LOOPBACK = 0x80040000u, // BIT_IN | 0x40000
AUDIO_DEVICE_IN_IP = 0x80080000u, // BIT_IN | 0x80000
AUDIO_DEVICE_IN_BUS = 0x80100000u, // BIT_IN | 0x100000
AUDIO_DEVICE_IN_PROXY = 0x81000000u, // BIT_IN | 0x1000000
AUDIO_DEVICE_IN_USB_HEADSET = 0x82000000u, // BIT_IN | 0x2000000
AUDIO_DEVICE_IN_BLUETOOTH_BLE = 0x84000000u, // BIT_IN | 0x4000000
AUDIO_DEVICE_IN_DEFAULT = 0xC0000000u, // BIT_IN | BIT_DEFAULT
};
typedef enum {
AUDIO_OUTPUT_FLAG_NONE = 0x0,
AUDIO_OUTPUT_FLAG_DIRECT = 0x1,
AUDIO_OUTPUT_FLAG_PRIMARY = 0x2,
AUDIO_OUTPUT_FLAG_FAST = 0x4,
AUDIO_OUTPUT_FLAG_DEEP_BUFFER = 0x8,
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD = 0x10,
AUDIO_OUTPUT_FLAG_NON_BLOCKING = 0x20,
AUDIO_OUTPUT_FLAG_HW_AV_SYNC = 0x40,
AUDIO_OUTPUT_FLAG_TTS = 0x80,
AUDIO_OUTPUT_FLAG_RAW = 0x100,
AUDIO_OUTPUT_FLAG_SYNC = 0x200,
AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO = 0x400,
AUDIO_OUTPUT_FLAG_DIRECT_PCM = 0x2000,
AUDIO_OUTPUT_FLAG_MMAP_NOIRQ = 0x4000,
AUDIO_OUTPUT_FLAG_VOIP_RX = 0x8000,
AUDIO_OUTPUT_FLAG_INCALL_MUSIC = 0x10000,
} audio_output_flags_t;
typedef enum {
AUDIO_INPUT_FLAG_NONE = 0x0,
AUDIO_INPUT_FLAG_FAST = 0x1,
AUDIO_INPUT_FLAG_HW_HOTWORD = 0x2,
AUDIO_INPUT_FLAG_RAW = 0x4,
AUDIO_INPUT_FLAG_SYNC = 0x8,
AUDIO_INPUT_FLAG_MMAP_NOIRQ = 0x10,
AUDIO_INPUT_FLAG_VOIP_TX = 0x20,
AUDIO_INPUT_FLAG_HW_AV_SYNC = 0x40,
} audio_input_flags_t;
typedef enum {
AUDIO_USAGE_UNKNOWN = 0,
AUDIO_USAGE_MEDIA = 1,
AUDIO_USAGE_VOICE_COMMUNICATION = 2,
AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING = 3,
AUDIO_USAGE_ALARM = 4,
AUDIO_USAGE_NOTIFICATION = 5,
AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE = 6,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7,
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8,
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9,
AUDIO_USAGE_NOTIFICATION_EVENT = 10,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY = 11,
AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12,
AUDIO_USAGE_ASSISTANCE_SONIFICATION = 13,
AUDIO_USAGE_GAME = 14,
AUDIO_USAGE_VIRTUAL_SOURCE = 15,
AUDIO_USAGE_ASSISTANT = 16,
} audio_usage_t;
typedef enum {
AUDIO_CONTENT_TYPE_UNKNOWN = 0u,
AUDIO_CONTENT_TYPE_SPEECH = 1u,
AUDIO_CONTENT_TYPE_MUSIC = 2u,
AUDIO_CONTENT_TYPE_MOVIE = 3u,
AUDIO_CONTENT_TYPE_SONIFICATION = 4u,
} audio_content_type_t;
enum {
AUDIO_GAIN_MODE_JOINT = 0x1u,
AUDIO_GAIN_MODE_CHANNELS = 0x2u,
AUDIO_GAIN_MODE_RAMP = 0x4u,
};
typedef enum {
AUDIO_PORT_ROLE_NONE = 0,
AUDIO_PORT_ROLE_SOURCE = 1, // (::android::hardware::audio::common::V4_0::AudioPortRole.NONE implicitly + 1)
AUDIO_PORT_ROLE_SINK = 2, // (::android::hardware::audio::common::V4_0::AudioPortRole.SOURCE implicitly + 1)
} audio_port_role_t;
typedef enum {
AUDIO_PORT_TYPE_NONE = 0,
AUDIO_PORT_TYPE_DEVICE = 1, // (::android::hardware::audio::common::V4_0::AudioPortType.NONE implicitly + 1)
AUDIO_PORT_TYPE_MIX = 2, // (::android::hardware::audio::common::V4_0::AudioPortType.DEVICE implicitly + 1)
AUDIO_PORT_TYPE_SESSION = 3, // (::android::hardware::audio::common::V4_0::AudioPortType.MIX implicitly + 1)
} audio_port_type_t;
enum {
AUDIO_PORT_CONFIG_SAMPLE_RATE = 0x1u,
AUDIO_PORT_CONFIG_CHANNEL_MASK = 0x2u,
AUDIO_PORT_CONFIG_FORMAT = 0x4u,
AUDIO_PORT_CONFIG_GAIN = 0x8u,
};
typedef enum {
AUDIO_LATENCY_LOW = 0,
AUDIO_LATENCY_NORMAL = 1, // (::android::hardware::audio::common::V4_0::AudioMixLatencyClass.LOW implicitly + 1)
} audio_mix_latency_class_t;
#ifdef __cplusplus
}
#endif
#endif // HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_COMMON_V4_0_EXPORTED_CONSTANTS_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,108 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_AUDIO_POLICY_CORE_H
#define ANDROID_AUDIO_POLICY_CORE_H
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include "cutils/bitops.h"
__BEGIN_DECLS
/* The enums were moved here mostly from
* frameworks/base/include/media/AudioSystem.h
*/
/* device categories used for audio_policy->set_force_use() */
typedef enum
{
AUDIO_POLICY_FORCE_NONE,
AUDIO_POLICY_FORCE_SPEAKER,
AUDIO_POLICY_FORCE_HEADPHONES,
AUDIO_POLICY_FORCE_BT_SCO,
AUDIO_POLICY_FORCE_BT_A2DP,
AUDIO_POLICY_FORCE_WIRED_ACCESSORY,
AUDIO_POLICY_FORCE_BT_CAR_DOCK,
AUDIO_POLICY_FORCE_BT_DESK_DOCK,
AUDIO_POLICY_FORCE_ANALOG_DOCK,
AUDIO_POLICY_FORCE_DIGITAL_DOCK,
AUDIO_POLICY_FORCE_NO_BT_A2DP, /* A2DP sink is not preferred to speaker or wired HS */
AUDIO_POLICY_FORCE_SYSTEM_ENFORCED,
AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED,
AUDIO_POLICY_FORCE_CFG_CNT,
AUDIO_POLICY_FORCE_CFG_MAX = AUDIO_POLICY_FORCE_CFG_CNT - 1,
AUDIO_POLICY_FORCE_DEFAULT = AUDIO_POLICY_FORCE_NONE,
} audio_policy_forced_cfg_t;
/* usages used for audio_policy->set_force_use() */
typedef enum
{
AUDIO_POLICY_FORCE_FOR_COMMUNICATION,
AUDIO_POLICY_FORCE_FOR_MEDIA,
AUDIO_POLICY_FORCE_FOR_RECORD,
AUDIO_POLICY_FORCE_FOR_DOCK,
AUDIO_POLICY_FORCE_FOR_SYSTEM,
AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO,
AUDIO_POLICY_FORCE_USE_CNT,
AUDIO_POLICY_FORCE_USE_MAX = AUDIO_POLICY_FORCE_USE_CNT - 1,
} audio_policy_force_use_t;
/* device connection states used for audio_policy->set_device_connection_state()
*/
typedef enum
{
AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
AUDIO_POLICY_DEVICE_STATE_CNT,
AUDIO_POLICY_DEVICE_STATE_MAX = AUDIO_POLICY_DEVICE_STATE_CNT - 1,
} audio_policy_dev_state_t;
typedef enum
{
/* Used to generate a tone to notify the user of a
* notification/alarm/ringtone while they are in a call. */
AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION = 0,
AUDIO_POLICY_TONE_CNT,
AUDIO_POLICY_TONE_MAX = AUDIO_POLICY_TONE_CNT - 1,
} audio_policy_tone_t;
static inline bool audio_is_low_visibility(audio_stream_type_t stream)
{
switch (stream)
{
case AUDIO_STREAM_SYSTEM:
case AUDIO_STREAM_NOTIFICATION:
case AUDIO_STREAM_RING:
return true;
default:
return false;
}
}
__END_DECLS
#endif // ANDROID_AUDIO_POLICY_CORE_H

View File

@ -1,152 +0,0 @@
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_CUTILS_ATOMIC_H
#define ANDROID_CUTILS_ATOMIC_H
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* A handful of basic atomic operations.
* THESE ARE HERE FOR LEGACY REASONS ONLY. AVOID.
*
* PREFERRED ALTERNATIVES:
* - Use C++/C/pthread locks/mutexes whenever there is not a
* convincing reason to do otherwise. Note that very clever and
* complicated, but correct, lock-free code is often slower than
* using locks, especially where nontrivial data structures
* are involved.
* - C11 stdatomic.h.
* - Where supported, C++11 std::atomic<T> .
*
* PLEASE STOP READING HERE UNLESS YOU ARE TRYING TO UNDERSTAND
* OR UPDATE OLD CODE.
*
* The "acquire" and "release" terms can be defined intuitively in terms
* of the placement of memory barriers in a simple lock implementation:
* - wait until compare-and-swap(lock-is-free --> lock-is-held) succeeds
* - barrier
* - [do work]
* - barrier
* - store(lock-is-free)
* In very crude terms, the initial (acquire) barrier prevents any of the
* "work" from happening before the lock is held, and the later (release)
* barrier ensures that all of the work happens before the lock is released.
* (Think of cached writes, cache read-ahead, and instruction reordering
* around the CAS and store instructions.)
*
* The barriers must apply to both the compiler and the CPU. Note it is
* legal for instructions that occur before an "acquire" barrier to be
* moved down below it, and for instructions that occur after a "release"
* barrier to be moved up above it.
*
* The ARM-driven implementation we use here is short on subtlety,
* and actually requests a full barrier from the compiler and the CPU.
* The only difference between acquire and release is in whether they
* are issued before or after the atomic operation with which they
* are associated. To ease the transition to C/C++ atomic intrinsics,
* you should not rely on this, and instead assume that only the minimal
* acquire/release protection is provided.
*
* NOTE: all int32_t* values are expected to be aligned on 32-bit boundaries.
* If they are not, atomicity is not guaranteed.
*/
/*
* Basic arithmetic and bitwise operations. These all provide a
* barrier with "release" ordering, and return the previous value.
*
* These have the same characteristics (e.g. what happens on overflow)
* as the equivalent non-atomic C operations.
*/
int32_t android_atomic_inc(volatile int32_t* addr);
int32_t android_atomic_dec(volatile int32_t* addr);
int32_t android_atomic_add(int32_t value, volatile int32_t* addr);
int32_t android_atomic_and(int32_t value, volatile int32_t* addr);
int32_t android_atomic_or(int32_t value, volatile int32_t* addr);
/*
* Perform an atomic load with "acquire" or "release" ordering.
*
* Note that the notion of a "release" ordering for a load does not
* really fit into the C11 or C++11 memory model. The extra ordering
* is normally observable only by code using memory_order_relaxed
* atomics, or data races. In the rare cases in which such ordering
* is called for, use memory_order_relaxed atomics and a leading
* atomic_thread_fence (typically with memory_order_acquire,
* not memory_order_release!) instead. If you do not understand
* this comment, you are in the vast majority, and should not be
* using release loads or replacing them with anything other than
* locks or default sequentially consistent atomics.
*
* This is only necessary if you need the memory barrier. A 32-bit read
* from a 32-bit aligned address is atomic on all supported platforms.
*/
int32_t android_atomic_acquire_load(volatile const int32_t* addr);
int32_t android_atomic_release_load(volatile const int32_t* addr);
/*
* Perform an atomic store with "acquire" or "release" ordering.
*
* Note that the notion of a "acquire" ordering for a store does not
* really fit into the C11 or C++11 memory model. The extra ordering
* is normally observable only by code using memory_order_relaxed
* atomics, or data races. In the rare cases in which such ordering
* is called for, use memory_order_relaxed atomics and a trailing
* atomic_thread_fence (typically with memory_order_release,
* not memory_order_acquire!) instead.
*
* This is only necessary if you need the memory barrier. A 32-bit write
* to a 32-bit aligned address is atomic on all supported platforms.
*/
void android_atomic_acquire_store(int32_t value, volatile int32_t* addr);
void android_atomic_release_store(int32_t value, volatile int32_t* addr);
/*
* Compare-and-set operation with "acquire" or "release" ordering.
*
* This returns zero if the new value was successfully stored, which will
* only happen when *addr == oldvalue.
*
* (The return value is inverted from implementations on other platforms,
* but matches the ARM ldrex/strex result.)
*
* Implementations that use the release CAS in a loop may be less efficient
* than possible, because we re-issue the memory barrier on each iteration.
*/
int android_atomic_acquire_cas(int32_t oldvalue, int32_t newvalue,
volatile int32_t* addr);
int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue,
volatile int32_t* addr);
/*
* Aliases for code using an older version of this header. These are now
* deprecated and should not be used. The definitions will be removed
* in a future release.
*/
#define android_atomic_write android_atomic_release_store
#define android_atomic_cmpxchg android_atomic_release_cas
#ifdef __cplusplus
} // extern "C"
#endif
#endif // ANDROID_CUTILS_ATOMIC_H

View File

@ -1,120 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CUTILS_BITOPS_H
#define __CUTILS_BITOPS_H
#include <stdbool.h>
#include <string.h>
#include <strings.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
/*
* Bitmask Operations
*
* Note this doesn't provide any locking/exclusion, and isn't atomic.
* Additionally no bounds checking is done on the bitmask array.
*
* Example:
*
* int num_resources;
* unsigned int resource_bits[BITS_TO_WORDS(num_resources)];
* bitmask_init(resource_bits, num_resources);
* ...
* int bit = bitmask_ffz(resource_bits, num_resources);
* bitmask_set(resource_bits, bit);
* ...
* if (bitmask_test(resource_bits, bit)) { ... }
* ...
* bitmask_clear(resource_bits, bit);
*
*/
#define BITS_PER_WORD (sizeof(unsigned int) * 8)
#define BITS_TO_WORDS(x) (((x) + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define BIT_IN_WORD(x) ((x) % BITS_PER_WORD)
#define BIT_WORD(x) ((x) / BITS_PER_WORD)
#define BIT_MASK(x) (1 << BIT_IN_WORD(x))
static inline void bitmask_init(unsigned int *bitmask, int num_bits)
{
memset(bitmask, 0, BITS_TO_WORDS(num_bits)*sizeof(unsigned int));
}
static inline int bitmask_ffz(unsigned int *bitmask, int num_bits)
{
int bit, result;
size_t i;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
{
bit = ffs(~bitmask[i]);
if (bit)
{
// ffs is 1-indexed, return 0-indexed result
bit--;
result = BITS_PER_WORD * i + bit;
if (result >= num_bits)
return -1;
return result;
}
}
return -1;
}
static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
{
size_t i;
int weight = 0;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
weight += __builtin_popcount(bitmask[i]);
return weight;
}
static inline void bitmask_set(unsigned int *bitmask, int bit)
{
bitmask[BIT_WORD(bit)] |= BIT_MASK(bit);
}
static inline void bitmask_clear(unsigned int *bitmask, int bit)
{
bitmask[BIT_WORD(bit)] &= ~BIT_MASK(bit);
}
static inline bool bitmask_test(unsigned int *bitmask, int bit)
{
return bitmask[BIT_WORD(bit)] & BIT_MASK(bit);
}
static inline int popcount(unsigned int x)
{
return __builtin_popcount(x);
}
static inline int popcountl(unsigned long x)
{
return __builtin_popcountl(x);
}
static inline int popcountll(unsigned long long x)
{
return __builtin_popcountll(x);
}
__END_DECLS
#endif /* __CUTILS_BITOPS_H */

View File

@ -1,69 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NATIVE_HANDLE_H_
#define NATIVE_HANDLE_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct native_handle
{
int version; /* sizeof(native_handle_t) */
int numFds; /* number of file-descriptors at &data[0] */
int numInts; /* number of ints at &data[numFds] */
int data[0]; /* numFds + numInts ints */
} native_handle_t;
/*
* native_handle_close
*
* closes the file descriptors contained in this native_handle_t
*
* return 0 on success, or a negative error code on failure
*
*/
int native_handle_close(const native_handle_t* h);
/*
* native_handle_create
*
* creates a native_handle_t and initializes it. must be destroyed with
* native_handle_delete().
*
*/
native_handle_t* native_handle_create(int numFds, int numInts);
/*
* native_handle_delete
*
* frees a native_handle_t allocated with native_handle_create().
* This ONLY frees the memory allocated for the native_handle_t, but doesn't
* close the file descriptors; which can be achieved with native_handle_close().
*
* return 0 on success, or a negative error code on failure
*
*/
int native_handle_delete(native_handle_t* h);
#ifdef __cplusplus
}
#endif
#endif /* NATIVE_HANDLE_H_ */

8
settings.gradle Normal file
View File

@ -0,0 +1,8 @@
pluginManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "V4AFX_Reworked"

View File

@ -3,6 +3,7 @@
// //
#include <cstdlib> #include <cstdlib>
#include <cstring>
#include "Effect.h" #include "Effect.h"
#include "constants.h" #include "constants.h"

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <hardware/audio_effect.h> #include "essential.h"
class Effect { class Effect {
public: public:

View File

@ -4,7 +4,15 @@
#pragma once #pragma once
#ifdef ANDROID_TOOLCHAIN
#include <android/log.h> #include <android/log.h>
#include <android/errno.h>
#else
#define __android_log_write(...) do {} while (0)
#define __android_log_print(...) do {} while (0)
#define ANDROID_LOG_INFO 1
#include <errno.h>
#endif
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)

121
src/cpp/utils/Harmonic.cpp Normal file
View File

@ -0,0 +1,121 @@
//
// Created by mart on 7/30/21.
//
#include <cstring>
#include <cstdlib>
#include <cmath>
#include "Harmonic.h"
static float HARMONIC_DEFAULT[10] = {
1.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
};
Harmonic::Harmonic() {
UpdateCoeffs(HARMONIC_DEFAULT);
Reset();
}
Harmonic::~Harmonic() {
}
float Harmonic::Process(float sample) {
float prevLast = this->lastProcessed;
this->lastProcessed = (
sample * this->coeffs[0] +
sample * this->coeffs[1] +
sample * this->coeffs[2] +
sample * this->coeffs[3] +
sample * this->coeffs[4] +
sample * this->coeffs[5] +
sample * this->coeffs[6] +
sample * this->coeffs[7] +
sample * this->coeffs[8] +
sample * this->coeffs[9] +
sample * this->coeffs[10]
);
this->prevOut = this->lastProcessed + this->prevOut * 0.999f - prevLast;
if (this->sampleCounter < this->buildup) {
this->sampleCounter++;
return 0;
}
return this->prevOut;
}
void Harmonic::Reset() {
this->lastProcessed = 0.f;
this->prevOut = 0.f;
this->sampleCounter = 0.f;
}
void Harmonic::SetHarmonics(float *coefficients) {
UpdateCoeffs(coefficients);
Reset();
}
void Harmonic::UpdateCoeffs(float *coefficients) {
float fVar5;
float fVar6;
float _coeffs[20];
float afStack76[14];
memset(_coeffs, 0, 11 * sizeof(float));
this->buildup = (int)fabsf(coefficients[10]);
memcpy(&_coeffs[1], coefficients, 10 * sizeof(float));
fVar6 = 1.f / (
fabsf(_coeffs[1]) +
fabsf(_coeffs[2]) +
fabsf(_coeffs[3]) +
fabsf(_coeffs[4]) +
fabsf(_coeffs[5]) +
fabsf(_coeffs[6]) +
fabsf(_coeffs[7]) +
fabsf(_coeffs[8]) +
fabsf(_coeffs[9]) +
fabsf(_coeffs[10])
);
for (int i = 0; i < 11; i++) {
_coeffs[i] *= fVar6;
}
for (int i = 0; i < 11; i++) {
afStack76[2 + i] = 0;
_coeffs[10 + i] = 0;
}
_coeffs[11] = _coeffs[10];
fVar6 = _coeffs[11];
for (int i = 2; i < 11; i++) {
for(int idx = 0; idx < i; idx++) {
_coeffs[11] = fVar6;
fVar5 = _coeffs[10 - idx + i];
fVar6 = afStack76[2 - idx + i];
afStack76[2 - idx + i] = _coeffs[11 - idx + i];
_coeffs[11 - idx + i] = 2 * fVar5 - fVar6;
fVar6 = _coeffs[11];
}
fVar6 = _coeffs[11 - i] - afStack76[2];
afStack76[2] = _coeffs[11];
}
for (int i = 1; i < 11; i++) {
afStack76[2 + i] = afStack76[i - 1] - afStack76[13 - i];
}
_coeffs[11] = _coeffs[0] * 0.5f - _coeffs[11];
for (int i = 0; i < 11; i++) {
this->coeffs[i] = _coeffs[11+i];
}
}

View File

@ -27,5 +27,5 @@ void HighShelf::SetQuality(float q) {
} }
void HighShelf::SetSamplingRate(uint32_t samplerate) { void HighShelf::SetSamplingRate(uint32_t samplerate) {
// TODO this->samplerate = samplerate;
} }

View File

@ -56,7 +56,7 @@ int PConvSingle_F32::LoadKernel(float *buf, int param_2, int segmentSize) {
if (param_2 > 0 && segmentSize > 0 && segmentSize % 2 == 0) { if (param_2 > 0 && segmentSize > 0 && segmentSize % 2 == 0) {
this->enabled = false; this->enabled = false;
ReleaseResources(); ReleaseResources();
this->data = malloc(0x140); // TODO: Sizeof this->data = (PConvData *)malloc(0x140); // TODO: Sizeof
memset(this->data, 0, 0x140); // Ditto memset(this->data, 0, 0x140); // Ditto
this->segmentSize = segmentSize; this->segmentSize = segmentSize;
int n = ProcessKernel(buf, param_2, 1); int n = ProcessKernel(buf, param_2, 1);
@ -76,7 +76,7 @@ int PConvSingle_F32::LoadKernel(float *buf, float *param_2, int segmentSize, int
if (param_5 > 0 && segmentSize > 0 && segmentSize % 2 == 0) { if (param_5 > 0 && segmentSize > 0 && segmentSize % 2 == 0) {
this->enabled = false; this->enabled = false;
ReleaseResources(); ReleaseResources();
this->data = malloc(0x140); // TODO: Sizeof this->data = (PConvData *)malloc(0x140); // TODO: Sizeof
memset(this->data, 0, 0x140); // Ditto memset(this->data, 0, 0x140); // Ditto
this->segmentSize = segmentSize; this->segmentSize = segmentSize;
int n = ProcessKernel(1, param_2, param_4, param_5); int n = ProcessKernel(1, param_2, param_4, param_5);

View File

@ -1,5 +1,4 @@
#include <cstring> #include <cstring>
#include <hardware/audio_effect.h>
#include <cstdlib> #include <cstdlib>
#include "Effect.h" #include "Effect.h"

View File

@ -1,51 +1,3 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_AUDIO_EFFECT_H
#define ANDROID_AUDIO_EFFECT_H
#include <errno.h>
#include <stdint.h>
#include <strings.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include "system/cutils/bitops.h"
#include "system/audio.h"
__BEGIN_DECLS
/////////////////////////////////////////////////
// Common Definitions
/////////////////////////////////////////////////
//
//--- Effect descriptor structure effect_descriptor_t
//
// Unique effect ID (can be generated from the following site:
// http://www.itu.int/ITU-T/asn1/uuid.html)
// This format is used for both "type" and "uuid" fields of the effect descriptor structure.
// - When used for effect type and the engine is implementing and effect corresponding to a standard
// OpenSL ES interface, this ID must be the one defined in OpenSLES_IID.h for that interface.
// - When used as uuid, it should be a unique UUID for this particular implementation.
typedef struct effect_uuid_s typedef struct effect_uuid_s
{ {
uint32_t timeLow; uint32_t timeLow;
@ -279,11 +231,6 @@ typedef struct effect_interface_s **effect_handle_t;
// Forward definition of type audio_buffer_t // Forward definition of type audio_buffer_t
typedef struct audio_buffer_s audio_buffer_t; typedef struct audio_buffer_s audio_buffer_t;
// Effect control interface definition // Effect control interface definition
struct effect_interface_s struct effect_interface_s
{ {
@ -415,7 +362,6 @@ struct effect_interface_s
audio_buffer_t *outBuffer); audio_buffer_t *outBuffer);
}; };
// //
//--- Standardized command codes for command() function //--- Standardized command codes for command() function
// //
@ -753,7 +699,7 @@ enum effect_command_e
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// description: // description:
// 1.indicate if the playback thread the effect is attached to is offloaded or not // 1.indicate if the playback thread the effect is attached to is offloaded or not
// 2.UpdateCoeffs the io handle of the playback thread the effect is attached to // 2.update the io handle of the playback thread the effect is attached to
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// command format: // command format:
// size: sizeof(effect_offload_param_t) // size: sizeof(effect_offload_param_t)
@ -770,7 +716,6 @@ enum effect_command_e
// command and response fields is free in this case // command and response fields is free in this case
//================================================================================================== //==================================================================================================
// Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t // Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t
// structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with // structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with
// regard to the channel mask definition in audio.h, audio_channel_mask_t e.g : // regard to the channel mask definition in audio.h, audio_channel_mask_t e.g :
@ -790,20 +735,7 @@ typedef struct audio_buffer_s {
}; };
} audio_buffer_t; } audio_buffer_t;
// The buffer_provider_s structure contains functions that can be used
// by the effect engine process() function to query and release input
// or output audio buffer.
// The getBuffer() function is called to retrieve a buffer where data
// should read from or written to by process() function.
// The releaseBuffer() function MUST be called when the buffer retrieved
// with getBuffer() is not needed anymore.
// The process function should use the buffer provider mechanism to retrieve
// input or output buffer if the inBuffer or outBuffer passed as argument is NULL
// and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_SET_CONFIG
// command did not specify an audio buffer.
typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer); typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer);
typedef struct buffer_provider_s typedef struct buffer_provider_s
{ {
buffer_function_t getBuffer; // retrieve next buffer buffer_function_t getBuffer; // retrieve next buffer
@ -826,46 +758,14 @@ typedef struct buffer_config_s
uint8_t accessMode; // read/write or accumulate in buffer (effect_buffer_access_e) uint8_t accessMode; // read/write or accumulate in buffer (effect_buffer_access_e)
uint16_t mask; // indicates which of the above fields is valid uint16_t mask; // indicates which of the above fields is valid
} buffer_config_t; } buffer_config_t;
// Values for "accessMode" field of buffer_config_t: // Values for "accessMode" field of buffer_config_t:
// overwrite, read only, accumulate (read/modify/write) // overwrite, read only, accumulate (read/modify/write)
enum effect_buffer_access_e typedef enum
{ {
EFFECT_BUFFER_ACCESS_WRITE, EFFECT_BUFFER_ACCESS_WRITE,
EFFECT_BUFFER_ACCESS_READ, EFFECT_BUFFER_ACCESS_READ,
EFFECT_BUFFER_ACCESS_ACCUMULATE EFFECT_BUFFER_ACCESS_ACCUMULATE
} effect_buffer_access_e;
};
// feature identifiers for EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS command
enum effect_feature_e
{
EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels (e.g. dual mic noise suppressor)
EFFECT_FEATURE_CNT
};
// EFFECT_FEATURE_AUX_CHANNELS feature configuration descriptor. Describe a combination
// of main and auxiliary channels supported
typedef struct channel_config_s
{
audio_channel_mask_t main_channels; // channel mask for main channels
audio_channel_mask_t aux_channels; // channel mask for auxiliary channels
} channel_config_t;
// Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
// in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command
#define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account
#define EFFECT_CONFIG_SMP_RATE 0x0002 // samplingRate field must be taken into account
#define EFFECT_CONFIG_CHANNELS 0x0004 // channels field must be taken into account
#define EFFECT_CONFIG_FORMAT 0x0008 // format field must be taken into account
#define EFFECT_CONFIG_ACC_MODE 0x0010 // accessMode field must be taken into account
#define EFFECT_CONFIG_PROVIDER 0x0020 // bufferProvider field must be taken into account
#define EFFECT_CONFIG_ALL (EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE | \
EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT | \
EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER)
// effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_CONFIG // effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_CONFIG
// command to configure audio parameters and buffers for effect engine input and output. // command to configure audio parameters and buffers for effect engine input and output.
typedef struct effect_config_s typedef struct effect_config_s
@ -873,8 +773,6 @@ typedef struct effect_config_s
buffer_config_t inputCfg; buffer_config_t inputCfg;
buffer_config_t outputCfg; buffer_config_t outputCfg;
} effect_config_t; } effect_config_t;
// effect_param_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_PARAM // effect_param_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_PARAM
// command and pCmdData and pReplyData of EFFECT_CMD_GET_PARAM command. // command and pCmdData and pReplyData of EFFECT_CMD_GET_PARAM command.
// psize and vsize represent the actual size of parameter and value. // psize and vsize represent the actual size of parameter and value.
@ -907,14 +805,6 @@ typedef struct effect_param_s
char data[]; // Start of Parameter + Value data char data[]; // Start of Parameter + Value data
} effect_param_t; } effect_param_t;
// structure used by EFFECT_CMD_OFFLOAD command
typedef struct effect_offload_param_s
{
bool isOffload; // true if the playback thread the effect is attached to is offloaded
int ioHandle; // io handle of the playback thread the effect is attached to
} effect_offload_param_t;
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Effect library interface // Effect library interface
///////////////////////////////////////////////// /////////////////////////////////////////////////
@ -1021,6 +911,597 @@ typedef struct audio_effect_library_s
// Name of the hal_module_info as a string // Name of the hal_module_info as a string
#define AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR "AELI" #define AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR "AELI"
__END_DECLS // Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
// in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command
#define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account
#define EFFECT_CONFIG_SMP_RATE 0x0002 // samplingRate field must be taken into account
#define EFFECT_CONFIG_CHANNELS 0x0004 // channels field must be taken into account
#define EFFECT_CONFIG_FORMAT 0x0008 // format field must be taken into account
#define EFFECT_CONFIG_ACC_MODE 0x0010 // accessMode field must be taken into account
#define EFFECT_CONFIG_PROVIDER 0x0020 // bufferProvider field must be taken into account
#define EFFECT_CONFIG_ALL (EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE | \
EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT | \
EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER)
#endif // ANDROID_AUDIO_EFFECT_H enum {
AUDIO_IO_HANDLE_NONE = 0,
AUDIO_MODULE_HANDLE_NONE = 0,
AUDIO_PORT_HANDLE_NONE = 0,
AUDIO_PATCH_HANDLE_NONE = 0,
};
typedef enum {
AUDIO_STREAM_DEFAULT = -1, // (-1)
AUDIO_STREAM_MIN = 0,
AUDIO_STREAM_VOICE_CALL = 0,
AUDIO_STREAM_SYSTEM = 1,
AUDIO_STREAM_RING = 2,
AUDIO_STREAM_MUSIC = 3,
AUDIO_STREAM_ALARM = 4,
AUDIO_STREAM_NOTIFICATION = 5,
AUDIO_STREAM_BLUETOOTH_SCO = 6,
AUDIO_STREAM_ENFORCED_AUDIBLE = 7,
AUDIO_STREAM_DTMF = 8,
AUDIO_STREAM_TTS = 9,
AUDIO_STREAM_ACCESSIBILITY = 10,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/** For dynamic policy output mixes. Only used by the audio policy */
AUDIO_STREAM_REROUTING = 11,
/** For audio flinger tracks volume. Only used by the audioflinger */
AUDIO_STREAM_PATCH = 12,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
} audio_stream_type_t;
typedef enum {
AUDIO_SOURCE_DEFAULT = 0,
AUDIO_SOURCE_MIC = 1,
AUDIO_SOURCE_VOICE_UPLINK = 2,
AUDIO_SOURCE_VOICE_DOWNLINK = 3,
AUDIO_SOURCE_VOICE_CALL = 4,
AUDIO_SOURCE_CAMCORDER = 5,
AUDIO_SOURCE_VOICE_RECOGNITION = 6,
AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
AUDIO_SOURCE_REMOTE_SUBMIX = 8,
AUDIO_SOURCE_UNPROCESSED = 9,
AUDIO_SOURCE_FM_TUNER = 1998,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/**
* A low-priority, preemptible audio source for for background software
* hotword detection. Same tuning as VOICE_RECOGNITION.
* Used only internally by the framework.
*/
AUDIO_SOURCE_HOTWORD = 1999,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
} audio_source_t;
typedef enum {
AUDIO_SESSION_OUTPUT_STAGE = -1, // (-1)
AUDIO_SESSION_OUTPUT_MIX = 0,
AUDIO_SESSION_ALLOCATE = 0,
AUDIO_SESSION_NONE = 0,
} audio_session_t;
typedef enum {
AUDIO_FORMAT_INVALID = 0xFFFFFFFFu,
AUDIO_FORMAT_DEFAULT = 0,
AUDIO_FORMAT_PCM = 0x00000000u,
AUDIO_FORMAT_MP3 = 0x01000000u,
AUDIO_FORMAT_AMR_NB = 0x02000000u,
AUDIO_FORMAT_AMR_WB = 0x03000000u,
AUDIO_FORMAT_AAC = 0x04000000u,
AUDIO_FORMAT_HE_AAC_V1 = 0x05000000u,
AUDIO_FORMAT_HE_AAC_V2 = 0x06000000u,
AUDIO_FORMAT_VORBIS = 0x07000000u,
AUDIO_FORMAT_OPUS = 0x08000000u,
AUDIO_FORMAT_AC3 = 0x09000000u,
AUDIO_FORMAT_E_AC3 = 0x0A000000u,
AUDIO_FORMAT_DTS = 0x0B000000u,
AUDIO_FORMAT_DTS_HD = 0x0C000000u,
AUDIO_FORMAT_IEC61937 = 0x0D000000u,
AUDIO_FORMAT_DOLBY_TRUEHD = 0x0E000000u,
AUDIO_FORMAT_EVRC = 0x10000000u,
AUDIO_FORMAT_EVRCB = 0x11000000u,
AUDIO_FORMAT_EVRCWB = 0x12000000u,
AUDIO_FORMAT_EVRCNW = 0x13000000u,
AUDIO_FORMAT_AAC_ADIF = 0x14000000u,
AUDIO_FORMAT_WMA = 0x15000000u,
AUDIO_FORMAT_WMA_PRO = 0x16000000u,
AUDIO_FORMAT_AMR_WB_PLUS = 0x17000000u,
AUDIO_FORMAT_MP2 = 0x18000000u,
AUDIO_FORMAT_QCELP = 0x19000000u,
AUDIO_FORMAT_DSD = 0x1A000000u,
AUDIO_FORMAT_FLAC = 0x1B000000u,
AUDIO_FORMAT_ALAC = 0x1C000000u,
AUDIO_FORMAT_APE = 0x1D000000u,
AUDIO_FORMAT_AAC_ADTS = 0x1E000000u,
AUDIO_FORMAT_SBC = 0x1F000000u,
AUDIO_FORMAT_APTX = 0x20000000u,
AUDIO_FORMAT_APTX_HD = 0x21000000u,
AUDIO_FORMAT_AC4 = 0x22000000u,
AUDIO_FORMAT_LDAC = 0x23000000u,
AUDIO_FORMAT_MAT = 0x24000000u,
AUDIO_FORMAT_MAIN_MASK = 0xFF000000u,
AUDIO_FORMAT_SUB_MASK = 0x00FFFFFFu,
/* Subformats */
AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1u,
AUDIO_FORMAT_PCM_SUB_8_BIT = 0x2u,
AUDIO_FORMAT_PCM_SUB_32_BIT = 0x3u,
AUDIO_FORMAT_PCM_SUB_8_24_BIT = 0x4u,
AUDIO_FORMAT_PCM_SUB_FLOAT = 0x5u,
AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED = 0x6u,
AUDIO_FORMAT_MP3_SUB_NONE = 0x0u,
AUDIO_FORMAT_AMR_SUB_NONE = 0x0u,
AUDIO_FORMAT_AAC_SUB_MAIN = 0x1u,
AUDIO_FORMAT_AAC_SUB_LC = 0x2u,
AUDIO_FORMAT_AAC_SUB_SSR = 0x4u,
AUDIO_FORMAT_AAC_SUB_LTP = 0x8u,
AUDIO_FORMAT_AAC_SUB_HE_V1 = 0x10u,
AUDIO_FORMAT_AAC_SUB_SCALABLE = 0x20u,
AUDIO_FORMAT_AAC_SUB_ERLC = 0x40u,
AUDIO_FORMAT_AAC_SUB_LD = 0x80u,
AUDIO_FORMAT_AAC_SUB_HE_V2 = 0x100u,
AUDIO_FORMAT_AAC_SUB_ELD = 0x200u,
AUDIO_FORMAT_AAC_SUB_XHE = 0x300u,
AUDIO_FORMAT_VORBIS_SUB_NONE = 0x0u,
AUDIO_FORMAT_E_AC3_SUB_JOC = 0x1u,
AUDIO_FORMAT_MAT_SUB_1_0 = 0x1u,
AUDIO_FORMAT_MAT_SUB_2_0 = 0x2u,
AUDIO_FORMAT_MAT_SUB_2_1 = 0x3u,
/* Aliases */
AUDIO_FORMAT_PCM_16_BIT = 0x1u, // (PCM | PCM_SUB_16_BIT)
AUDIO_FORMAT_PCM_8_BIT = 0x2u, // (PCM | PCM_SUB_8_BIT)
AUDIO_FORMAT_PCM_32_BIT = 0x3u, // (PCM | PCM_SUB_32_BIT)
AUDIO_FORMAT_PCM_8_24_BIT = 0x4u, // (PCM | PCM_SUB_8_24_BIT)
AUDIO_FORMAT_PCM_FLOAT = 0x5u, // (PCM | PCM_SUB_FLOAT)
AUDIO_FORMAT_PCM_24_BIT_PACKED = 0x6u, // (PCM | PCM_SUB_24_BIT_PACKED)
AUDIO_FORMAT_AAC_MAIN = 0x4000001u, // (AAC | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_LC = 0x4000002u, // (AAC | AAC_SUB_LC)
AUDIO_FORMAT_AAC_SSR = 0x4000004u, // (AAC | AAC_SUB_SSR)
AUDIO_FORMAT_AAC_LTP = 0x4000008u, // (AAC | AAC_SUB_LTP)
AUDIO_FORMAT_AAC_HE_V1 = 0x4000010u, // (AAC | AAC_SUB_HE_V1)
AUDIO_FORMAT_AAC_SCALABLE = 0x4000020u, // (AAC | AAC_SUB_SCALABLE)
AUDIO_FORMAT_AAC_ERLC = 0x4000040u, // (AAC | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_LD = 0x4000080u, // (AAC | AAC_SUB_LD)
AUDIO_FORMAT_AAC_HE_V2 = 0x4000100u, // (AAC | AAC_SUB_HE_V2)
AUDIO_FORMAT_AAC_ELD = 0x4000200u, // (AAC | AAC_SUB_ELD)
AUDIO_FORMAT_AAC_XHE = 0x4000300u, // (AAC | AAC_SUB_XHE)
AUDIO_FORMAT_AAC_ADTS_MAIN = 0x1e000001u, // (AAC_ADTS | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_ADTS_LC = 0x1e000002u, // (AAC_ADTS | AAC_SUB_LC)
AUDIO_FORMAT_AAC_ADTS_SSR = 0x1e000004u, // (AAC_ADTS | AAC_SUB_SSR)
AUDIO_FORMAT_AAC_ADTS_LTP = 0x1e000008u, // (AAC_ADTS | AAC_SUB_LTP)
AUDIO_FORMAT_AAC_ADTS_HE_V1 = 0x1e000010u, // (AAC_ADTS | AAC_SUB_HE_V1)
AUDIO_FORMAT_AAC_ADTS_SCALABLE = 0x1e000020u, // (AAC_ADTS | AAC_SUB_SCALABLE)
AUDIO_FORMAT_AAC_ADTS_ERLC = 0x1e000040u, // (AAC_ADTS | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_ADTS_LD = 0x1e000080u, // (AAC_ADTS | AAC_SUB_LD)
AUDIO_FORMAT_AAC_ADTS_HE_V2 = 0x1e000100u, // (AAC_ADTS | AAC_SUB_HE_V2)
AUDIO_FORMAT_AAC_ADTS_ELD = 0x1e000200u, // (AAC_ADTS | AAC_SUB_ELD)
AUDIO_FORMAT_AAC_ADTS_XHE = 0x1e000300u, // (AAC_ADTS | AAC_SUB_XHE)
AUDIO_FORMAT_E_AC3_JOC = 0xA000001u, // (E_AC3 | E_AC3_SUB_JOC)
AUDIO_FORMAT_MAT_1_0 = 0x24000001u, // (MAT | MAT_SUB_1_0)
AUDIO_FORMAT_MAT_2_0 = 0x24000002u, // (MAT | MAT_SUB_2_0)
AUDIO_FORMAT_MAT_2_1 = 0x24000003u, // (MAT | MAT_SUB_2_1)
} audio_format_t;
typedef enum {
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_MODE_INVALID = -2, // (-2)
AUDIO_MODE_CURRENT = -1, // (-1)
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_MODE_NORMAL = 0,
AUDIO_MODE_RINGTONE = 1,
AUDIO_MODE_IN_CALL = 2,
AUDIO_MODE_IN_COMMUNICATION = 3,
} audio_mode_t;
enum {
AUDIO_DEVICE_NONE = 0x0u,
AUDIO_DEVICE_BIT_IN = 0x80000000u,
AUDIO_DEVICE_BIT_DEFAULT = 0x40000000u,
AUDIO_DEVICE_OUT_EARPIECE = 0x1u,
AUDIO_DEVICE_OUT_SPEAKER = 0x2u,
AUDIO_DEVICE_OUT_WIRED_HEADSET = 0x4u,
AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 0x8u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 0x10u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20u,
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 0x80u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100u,
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200u,
AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400u,
AUDIO_DEVICE_OUT_HDMI = 0x400u, // OUT_AUX_DIGITAL
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800u,
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000u,
AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000u,
AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000u,
AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000u,
AUDIO_DEVICE_OUT_TELEPHONY_TX = 0x10000u,
AUDIO_DEVICE_OUT_LINE = 0x20000u,
AUDIO_DEVICE_OUT_HDMI_ARC = 0x40000u,
AUDIO_DEVICE_OUT_SPDIF = 0x80000u,
AUDIO_DEVICE_OUT_FM = 0x100000u,
AUDIO_DEVICE_OUT_AUX_LINE = 0x200000u,
AUDIO_DEVICE_OUT_SPEAKER_SAFE = 0x400000u,
AUDIO_DEVICE_OUT_IP = 0x800000u,
AUDIO_DEVICE_OUT_BUS = 0x1000000u,
AUDIO_DEVICE_OUT_PROXY = 0x2000000u,
AUDIO_DEVICE_OUT_USB_HEADSET = 0x4000000u,
AUDIO_DEVICE_OUT_HEARING_AID = 0x8000000u,
AUDIO_DEVICE_OUT_ECHO_CANCELLER = 0x10000000u,
AUDIO_DEVICE_OUT_DEFAULT = 0x40000000u, // BIT_DEFAULT
AUDIO_DEVICE_IN_COMMUNICATION = 0x80000001u, // BIT_IN | 0x1
AUDIO_DEVICE_IN_AMBIENT = 0x80000002u, // BIT_IN | 0x2
AUDIO_DEVICE_IN_BUILTIN_MIC = 0x80000004u, // BIT_IN | 0x4
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000008u, // BIT_IN | 0x8
AUDIO_DEVICE_IN_WIRED_HEADSET = 0x80000010u, // BIT_IN | 0x10
AUDIO_DEVICE_IN_AUX_DIGITAL = 0x80000020u, // BIT_IN | 0x20
AUDIO_DEVICE_IN_HDMI = 0x80000020u, // IN_AUX_DIGITAL
AUDIO_DEVICE_IN_VOICE_CALL = 0x80000040u, // BIT_IN | 0x40
AUDIO_DEVICE_IN_TELEPHONY_RX = 0x80000040u, // IN_VOICE_CALL
AUDIO_DEVICE_IN_BACK_MIC = 0x80000080u, // BIT_IN | 0x80
AUDIO_DEVICE_IN_REMOTE_SUBMIX = 0x80000100u, // BIT_IN | 0x100
AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = 0x80000200u, // BIT_IN | 0x200
AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = 0x80000400u, // BIT_IN | 0x400
AUDIO_DEVICE_IN_USB_ACCESSORY = 0x80000800u, // BIT_IN | 0x800
AUDIO_DEVICE_IN_USB_DEVICE = 0x80001000u, // BIT_IN | 0x1000
AUDIO_DEVICE_IN_FM_TUNER = 0x80002000u, // BIT_IN | 0x2000
AUDIO_DEVICE_IN_TV_TUNER = 0x80004000u, // BIT_IN | 0x4000
AUDIO_DEVICE_IN_LINE = 0x80008000u, // BIT_IN | 0x8000
AUDIO_DEVICE_IN_SPDIF = 0x80010000u, // BIT_IN | 0x10000
AUDIO_DEVICE_IN_BLUETOOTH_A2DP = 0x80020000u, // BIT_IN | 0x20000
AUDIO_DEVICE_IN_LOOPBACK = 0x80040000u, // BIT_IN | 0x40000
AUDIO_DEVICE_IN_IP = 0x80080000u, // BIT_IN | 0x80000
AUDIO_DEVICE_IN_BUS = 0x80100000u, // BIT_IN | 0x100000
AUDIO_DEVICE_IN_PROXY = 0x81000000u, // BIT_IN | 0x1000000
AUDIO_DEVICE_IN_USB_HEADSET = 0x82000000u, // BIT_IN | 0x2000000
AUDIO_DEVICE_IN_BLUETOOTH_BLE = 0x84000000u, // BIT_IN | 0x4000000
AUDIO_DEVICE_IN_DEFAULT = 0xC0000000u, // BIT_IN | BIT_DEFAULT
};
typedef enum {
AUDIO_OUTPUT_FLAG_NONE = 0x0,
AUDIO_OUTPUT_FLAG_DIRECT = 0x1,
AUDIO_OUTPUT_FLAG_PRIMARY = 0x2,
AUDIO_OUTPUT_FLAG_FAST = 0x4,
AUDIO_OUTPUT_FLAG_DEEP_BUFFER = 0x8,
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD = 0x10,
AUDIO_OUTPUT_FLAG_NON_BLOCKING = 0x20,
AUDIO_OUTPUT_FLAG_HW_AV_SYNC = 0x40,
AUDIO_OUTPUT_FLAG_TTS = 0x80,
AUDIO_OUTPUT_FLAG_RAW = 0x100,
AUDIO_OUTPUT_FLAG_SYNC = 0x200,
AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO = 0x400,
AUDIO_OUTPUT_FLAG_DIRECT_PCM = 0x2000,
AUDIO_OUTPUT_FLAG_MMAP_NOIRQ = 0x4000,
AUDIO_OUTPUT_FLAG_VOIP_RX = 0x8000,
AUDIO_OUTPUT_FLAG_INCALL_MUSIC = 0x10000,
} audio_output_flags_t;
typedef enum {
AUDIO_INPUT_FLAG_NONE = 0x0,
AUDIO_INPUT_FLAG_FAST = 0x1,
AUDIO_INPUT_FLAG_HW_HOTWORD = 0x2,
AUDIO_INPUT_FLAG_RAW = 0x4,
AUDIO_INPUT_FLAG_SYNC = 0x8,
AUDIO_INPUT_FLAG_MMAP_NOIRQ = 0x10,
AUDIO_INPUT_FLAG_VOIP_TX = 0x20,
AUDIO_INPUT_FLAG_HW_AV_SYNC = 0x40,
} audio_input_flags_t;
typedef enum {
AUDIO_USAGE_UNKNOWN = 0,
AUDIO_USAGE_MEDIA = 1,
AUDIO_USAGE_VOICE_COMMUNICATION = 2,
AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING = 3,
AUDIO_USAGE_ALARM = 4,
AUDIO_USAGE_NOTIFICATION = 5,
AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE = 6,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7,
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8,
AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9,
AUDIO_USAGE_NOTIFICATION_EVENT = 10,
#endif // AUDIO_NO_SYSTEM_DECLARATIONS
AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY = 11,
AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12,
AUDIO_USAGE_ASSISTANCE_SONIFICATION = 13,
AUDIO_USAGE_GAME = 14,
AUDIO_USAGE_VIRTUAL_SOURCE = 15,
AUDIO_USAGE_ASSISTANT = 16,
} audio_usage_t;
typedef enum {
AUDIO_CONTENT_TYPE_UNKNOWN = 0u,
AUDIO_CONTENT_TYPE_SPEECH = 1u,
AUDIO_CONTENT_TYPE_MUSIC = 2u,
AUDIO_CONTENT_TYPE_MOVIE = 3u,
AUDIO_CONTENT_TYPE_SONIFICATION = 4u,
} audio_content_type_t;
enum {
AUDIO_GAIN_MODE_JOINT = 0x1u,
AUDIO_GAIN_MODE_CHANNELS = 0x2u,
AUDIO_GAIN_MODE_RAMP = 0x4u,
};
typedef enum {
AUDIO_PORT_ROLE_NONE = 0,
AUDIO_PORT_ROLE_SOURCE = 1, // (::android::hardware::audio::common::V4_0::AudioPortRole.NONE implicitly + 1)
AUDIO_PORT_ROLE_SINK = 2, // (::android::hardware::audio::common::V4_0::AudioPortRole.SOURCE implicitly + 1)
} audio_port_role_t;
typedef enum {
AUDIO_PORT_TYPE_NONE = 0,
AUDIO_PORT_TYPE_DEVICE = 1, // (::android::hardware::audio::common::V4_0::AudioPortType.NONE implicitly + 1)
AUDIO_PORT_TYPE_MIX = 2, // (::android::hardware::audio::common::V4_0::AudioPortType.DEVICE implicitly + 1)
AUDIO_PORT_TYPE_SESSION = 3, // (::android::hardware::audio::common::V4_0::AudioPortType.MIX implicitly + 1)
} audio_port_type_t;
enum {
AUDIO_PORT_CONFIG_SAMPLE_RATE = 0x1u,
AUDIO_PORT_CONFIG_CHANNEL_MASK = 0x2u,
AUDIO_PORT_CONFIG_FORMAT = 0x4u,
AUDIO_PORT_CONFIG_GAIN = 0x8u,
};
typedef enum {
AUDIO_LATENCY_LOW = 0,
AUDIO_LATENCY_NORMAL = 1, // (::android::hardware::audio::common::V4_0::AudioMixLatencyClass.LOW implicitly + 1)
} audio_mix_latency_class_t;
enum {
FCC_2 = 2,
FCC_8 = 8,
};
enum {
AUDIO_CHANNEL_REPRESENTATION_POSITION = 0x0u,
AUDIO_CHANNEL_REPRESENTATION_INDEX = 0x2u,
AUDIO_CHANNEL_NONE = 0x0u,
AUDIO_CHANNEL_INVALID = 0xC0000000u,
AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1u,
AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2u,
AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4u,
AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8u,
AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10u,
AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20u,
AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40u,
AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80u,
AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100u,
AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200u,
AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400u,
AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800u,
AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000u,
AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000u,
AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000u,
AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000u,
AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000u,
AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000u,
AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT = 0x40000u,
AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT = 0x80000u,
AUDIO_CHANNEL_OUT_MONO = 0x1u, // OUT_FRONT_LEFT
AUDIO_CHANNEL_OUT_STEREO = 0x3u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT
AUDIO_CHANNEL_OUT_2POINT1 = 0xBu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_2POINT0POINT2 = 0xC0003u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_2POINT1POINT2 = 0xC000Bu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_3POINT0POINT2 = 0xC0007u, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_3POINT1POINT2 = 0xC000Fu, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
AUDIO_CHANNEL_OUT_QUAD = 0x33u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT
AUDIO_CHANNEL_OUT_QUAD_BACK = 0x33u, // OUT_QUAD
AUDIO_CHANNEL_OUT_QUAD_SIDE = 0x603u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_SURROUND = 0x107u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER
AUDIO_CHANNEL_OUT_PENTA = 0x37u, // OUT_QUAD | OUT_FRONT_CENTER
AUDIO_CHANNEL_OUT_5POINT1 = 0x3Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT
AUDIO_CHANNEL_OUT_5POINT1_BACK = 0x3Fu, // OUT_5POINT1
AUDIO_CHANNEL_OUT_5POINT1_SIDE = 0x60Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_5POINT1POINT2 = 0xC003Fu, // OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_5POINT1POINT4 = 0x2D03Fu, // OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
AUDIO_CHANNEL_OUT_6POINT1 = 0x13Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER
AUDIO_CHANNEL_OUT_7POINT1 = 0x63Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
AUDIO_CHANNEL_OUT_7POINT1POINT2 = 0xC063Fu, // OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
AUDIO_CHANNEL_OUT_7POINT1POINT4 = 0x2D63Fu, // OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
AUDIO_CHANNEL_IN_LEFT = 0x4u,
AUDIO_CHANNEL_IN_RIGHT = 0x8u,
AUDIO_CHANNEL_IN_FRONT = 0x10u,
AUDIO_CHANNEL_IN_BACK = 0x20u,
AUDIO_CHANNEL_IN_LEFT_PROCESSED = 0x40u,
AUDIO_CHANNEL_IN_RIGHT_PROCESSED = 0x80u,
AUDIO_CHANNEL_IN_FRONT_PROCESSED = 0x100u,
AUDIO_CHANNEL_IN_BACK_PROCESSED = 0x200u,
AUDIO_CHANNEL_IN_PRESSURE = 0x400u,
AUDIO_CHANNEL_IN_X_AXIS = 0x800u,
AUDIO_CHANNEL_IN_Y_AXIS = 0x1000u,
AUDIO_CHANNEL_IN_Z_AXIS = 0x2000u,
AUDIO_CHANNEL_IN_BACK_LEFT = 0x10000u,
AUDIO_CHANNEL_IN_BACK_RIGHT = 0x20000u,
AUDIO_CHANNEL_IN_CENTER = 0x40000u,
AUDIO_CHANNEL_IN_LOW_FREQUENCY = 0x100000u,
AUDIO_CHANNEL_IN_TOP_LEFT = 0x200000u,
AUDIO_CHANNEL_IN_TOP_RIGHT = 0x400000u,
AUDIO_CHANNEL_IN_VOICE_UPLINK = 0x4000u,
AUDIO_CHANNEL_IN_VOICE_DNLINK = 0x8000u,
AUDIO_CHANNEL_IN_MONO = 0x10u, // IN_FRONT
AUDIO_CHANNEL_IN_STEREO = 0xCu, // IN_LEFT | IN_RIGHT
AUDIO_CHANNEL_IN_FRONT_BACK = 0x30u, // IN_FRONT | IN_BACK
AUDIO_CHANNEL_IN_6 = 0xFCu, // IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED
AUDIO_CHANNEL_IN_2POINT0POINT2 = 0x60000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
AUDIO_CHANNEL_IN_2POINT1POINT2 = 0x70000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_3POINT0POINT2 = 0x64000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
AUDIO_CHANNEL_IN_3POINT1POINT2 = 0x74000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_5POINT1 = 0x17000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY
AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO = 0x4010u, // IN_VOICE_UPLINK | IN_MONO
AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO = 0x8010u, // IN_VOICE_DNLINK | IN_MONO
AUDIO_CHANNEL_IN_VOICE_CALL_MONO = 0xC010u, // IN_VOICE_UPLINK_MONO | IN_VOICE_DNLINK_MONO
AUDIO_CHANNEL_COUNT_MAX = 30u,
AUDIO_CHANNEL_INDEX_HDR = 0x80000000u, // REPRESENTATION_INDEX << COUNT_MAX
AUDIO_CHANNEL_INDEX_MASK_1 = 0x80000001u, // INDEX_HDR | (1 << 1) - 1
AUDIO_CHANNEL_INDEX_MASK_2 = 0x80000003u, // INDEX_HDR | (1 << 2) - 1
AUDIO_CHANNEL_INDEX_MASK_3 = 0x80000007u, // INDEX_HDR | (1 << 3) - 1
AUDIO_CHANNEL_INDEX_MASK_4 = 0x8000000Fu, // INDEX_HDR | (1 << 4) - 1
AUDIO_CHANNEL_INDEX_MASK_5 = 0x8000001Fu, // INDEX_HDR | (1 << 5) - 1
AUDIO_CHANNEL_INDEX_MASK_6 = 0x8000003Fu, // INDEX_HDR | (1 << 6) - 1
AUDIO_CHANNEL_INDEX_MASK_7 = 0x8000007Fu, // INDEX_HDR | (1 << 7) - 1
AUDIO_CHANNEL_INDEX_MASK_8 = 0x800000FFu, // INDEX_HDR | (1 << 8) - 1
};
enum {
/** Number of audio stream available to vendors. */
AUDIO_STREAM_PUBLIC_CNT = AUDIO_STREAM_ACCESSIBILITY + 1,
#ifndef AUDIO_NO_SYSTEM_DECLARATIONS
/** Total number of stream handled by the policy*/
AUDIO_STREAM_FOR_POLICY_CNT= AUDIO_STREAM_REROUTING + 1,
#endif
/** Total number of stream. */
AUDIO_STREAM_CNT = AUDIO_STREAM_PATCH + 1,
AUDIO_SOURCE_MAX = AUDIO_SOURCE_UNPROCESSED,
AUDIO_SOURCE_CNT = AUDIO_SOURCE_MAX + 1,
AUDIO_MODE_MAX = AUDIO_MODE_IN_COMMUNICATION,
AUDIO_MODE_CNT = AUDIO_MODE_MAX + 1,
/** For retrocompatibility AUDIO_MODE_* and AUDIO_STREAM_* must be signed. */
AUDIO_DETAIL_NEGATIVE_VALUE = -1,
};
enum {
AUDIO_CHANNEL_OUT_ALL = AUDIO_CHANNEL_OUT_FRONT_LEFT |
AUDIO_CHANNEL_OUT_FRONT_RIGHT |
AUDIO_CHANNEL_OUT_FRONT_CENTER |
AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
AUDIO_CHANNEL_OUT_BACK_LEFT |
AUDIO_CHANNEL_OUT_BACK_RIGHT |
AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
AUDIO_CHANNEL_OUT_BACK_CENTER |
AUDIO_CHANNEL_OUT_SIDE_LEFT |
AUDIO_CHANNEL_OUT_SIDE_RIGHT |
AUDIO_CHANNEL_OUT_TOP_CENTER |
AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT |
AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER |
AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT |
AUDIO_CHANNEL_OUT_TOP_BACK_LEFT |
AUDIO_CHANNEL_OUT_TOP_BACK_CENTER |
AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT |
AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT |
AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT,
AUDIO_CHANNEL_IN_ALL = AUDIO_CHANNEL_IN_LEFT |
AUDIO_CHANNEL_IN_RIGHT |
AUDIO_CHANNEL_IN_FRONT |
AUDIO_CHANNEL_IN_BACK|
AUDIO_CHANNEL_IN_LEFT_PROCESSED |
AUDIO_CHANNEL_IN_RIGHT_PROCESSED |
AUDIO_CHANNEL_IN_FRONT_PROCESSED |
AUDIO_CHANNEL_IN_BACK_PROCESSED|
AUDIO_CHANNEL_IN_PRESSURE |
AUDIO_CHANNEL_IN_X_AXIS |
AUDIO_CHANNEL_IN_Y_AXIS |
AUDIO_CHANNEL_IN_Z_AXIS |
AUDIO_CHANNEL_IN_VOICE_UPLINK |
AUDIO_CHANNEL_IN_VOICE_DNLINK |
AUDIO_CHANNEL_IN_BACK_LEFT |
AUDIO_CHANNEL_IN_BACK_RIGHT |
AUDIO_CHANNEL_IN_CENTER |
AUDIO_CHANNEL_IN_LOW_FREQUENCY |
AUDIO_CHANNEL_IN_TOP_LEFT |
AUDIO_CHANNEL_IN_TOP_RIGHT,
AUDIO_DEVICE_OUT_ALL = AUDIO_DEVICE_OUT_EARPIECE |
AUDIO_DEVICE_OUT_SPEAKER |
AUDIO_DEVICE_OUT_WIRED_HEADSET |
AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER |
AUDIO_DEVICE_OUT_HDMI |
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
AUDIO_DEVICE_OUT_USB_ACCESSORY |
AUDIO_DEVICE_OUT_USB_DEVICE |
AUDIO_DEVICE_OUT_REMOTE_SUBMIX |
AUDIO_DEVICE_OUT_TELEPHONY_TX |
AUDIO_DEVICE_OUT_LINE |
AUDIO_DEVICE_OUT_HDMI_ARC |
AUDIO_DEVICE_OUT_SPDIF |
AUDIO_DEVICE_OUT_FM |
AUDIO_DEVICE_OUT_AUX_LINE |
AUDIO_DEVICE_OUT_SPEAKER_SAFE |
AUDIO_DEVICE_OUT_IP |
AUDIO_DEVICE_OUT_BUS |
AUDIO_DEVICE_OUT_PROXY |
AUDIO_DEVICE_OUT_USB_HEADSET |
AUDIO_DEVICE_OUT_HEARING_AID |
AUDIO_DEVICE_OUT_ECHO_CANCELLER |
AUDIO_DEVICE_OUT_DEFAULT,
AUDIO_DEVICE_OUT_ALL_A2DP = AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER,
AUDIO_DEVICE_OUT_ALL_SCO = AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT,
AUDIO_DEVICE_OUT_ALL_USB = AUDIO_DEVICE_OUT_USB_ACCESSORY |
AUDIO_DEVICE_OUT_USB_DEVICE |
AUDIO_DEVICE_OUT_USB_HEADSET,
AUDIO_DEVICE_IN_ALL = AUDIO_DEVICE_IN_COMMUNICATION |
AUDIO_DEVICE_IN_AMBIENT |
AUDIO_DEVICE_IN_BUILTIN_MIC |
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET |
AUDIO_DEVICE_IN_WIRED_HEADSET |
AUDIO_DEVICE_IN_HDMI |
AUDIO_DEVICE_IN_TELEPHONY_RX |
AUDIO_DEVICE_IN_BACK_MIC |
AUDIO_DEVICE_IN_REMOTE_SUBMIX |
AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET |
AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET |
AUDIO_DEVICE_IN_USB_ACCESSORY |
AUDIO_DEVICE_IN_USB_DEVICE |
AUDIO_DEVICE_IN_FM_TUNER |
AUDIO_DEVICE_IN_TV_TUNER |
AUDIO_DEVICE_IN_LINE |
AUDIO_DEVICE_IN_SPDIF |
AUDIO_DEVICE_IN_BLUETOOTH_A2DP |
AUDIO_DEVICE_IN_LOOPBACK |
AUDIO_DEVICE_IN_IP |
AUDIO_DEVICE_IN_BUS |
AUDIO_DEVICE_IN_PROXY |
AUDIO_DEVICE_IN_USB_HEADSET |
AUDIO_DEVICE_IN_BLUETOOTH_BLE |
AUDIO_DEVICE_IN_DEFAULT,
AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
AUDIO_DEVICE_IN_ALL_USB = AUDIO_DEVICE_IN_USB_ACCESSORY |
AUDIO_DEVICE_IN_USB_DEVICE |
AUDIO_DEVICE_IN_USB_HEADSET,
AUDIO_USAGE_MAX = AUDIO_USAGE_ASSISTANT,
AUDIO_USAGE_CNT = AUDIO_USAGE_ASSISTANT + 1,
AUDIO_PORT_CONFIG_ALL = AUDIO_PORT_CONFIG_SAMPLE_RATE |
AUDIO_PORT_CONFIG_CHANNEL_MASK |
AUDIO_PORT_CONFIG_FORMAT |
AUDIO_PORT_CONFIG_GAIN,
}; // enum

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aam.v4afx_r"
android:versionCode="1"
android:versionName="1.0">
</manifest>

View File

@ -1,65 +0,0 @@
//
// Created by mart on 7/30/21.
//
#include "Harmonic.h"
static float HARMONIC_DEFAULT[10] = {
1.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
};
Harmonic::Harmonic() {
UpdateCoeffs(HARMONIC_DEFAULT);
Reset();
}
Harmonic::~Harmonic() {
}
float Harmonic::Process(float sample) {
float prevLast = this->lastProcessed;
this->lastProcessed = (
sample * this->coeffs[0] +
sample * this->coeffs[1] +
sample * this->coeffs[2] +
sample * this->coeffs[3] +
sample * this->coeffs[4] +
sample * this->coeffs[5] +
sample * this->coeffs[6] +
sample * this->coeffs[7] +
sample * this->coeffs[8] +
sample * this->coeffs[9] +
sample * this->coeffs[10]
);
this->prevOut = this->lastProcessed + this->prevOut * 0.999f - prevLast;
if (this->sampleCounter < this->buildup) {
this->sampleCounter++;
return 0;
}
return this->prevOut;
}
void Harmonic::Reset() {
this->lastProcessed = 0.f;
this->prevOut = 0.f;
this->sampleCounter = 0.f;
}
void Harmonic::SetHarmonics(float *coeffs) {
UpdateCoeffs(coeffs);
Reset();
}
void Harmonic::UpdateCoeffs(float *coeffs) {
// TODO
}