OboeTester: add app for testing Oboe
Big interactive app for testing Oboe, AAudio and OpenSL ES.
Has lots of options for reproducing bugs.
Has tests for Output, Input,
TapToTone Latency measurement,
Record and Playback audio.
diff --git a/apps/OboeTester/.gitignore b/apps/OboeTester/.gitignore
new file mode 100644
index 0000000..e698dc3
--- /dev/null
+++ b/apps/OboeTester/.gitignore
@@ -0,0 +1,11 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build/
+.idea/
+/app/build/
+/app/app.iml
+*.iml
+/app/externalNativeBuild/
diff --git a/apps/OboeTester/.google/packaging.yaml b/apps/OboeTester/.google/packaging.yaml
new file mode 100644
index 0000000..815374a
--- /dev/null
+++ b/apps/OboeTester/.google/packaging.yaml
@@ -0,0 +1,7 @@
+status: PUBLISHED
+technologies: [Android, NDK]
+categories: [NDK, C++]
+languages: [C++, Java]
+solutions: [Mobile]
+github: googlesamples/android-ndk
+license: apache2
diff --git a/apps/OboeTester/Doxyfile b/apps/OboeTester/Doxyfile
new file mode 100644
index 0000000..6d821e7
--- /dev/null
+++ b/apps/OboeTester/Doxyfile
@@ -0,0 +1,2304 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "My Project"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH = app/src/main/cpp/oboe/include/oboe/
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = app/src/main/cpp/oboe/include/oboe/OboeDefinitions.h \
+ app/src/main/cpp/oboe/include/oboe/OboeAudio.h
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/apps/OboeTester/Doxyfile.orig b/apps/OboeTester/Doxyfile.orig
new file mode 100644
index 0000000..137facb
--- /dev/null
+++ b/apps/OboeTester/Doxyfile.orig
@@ -0,0 +1,2303 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "My Project"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/apps/OboeTester/README.md b/apps/OboeTester/README.md
new file mode 100644
index 0000000..56cecdc
--- /dev/null
+++ b/apps/OboeTester/README.md
@@ -0,0 +1,11 @@
+NativeOboe
+
+CONFIDENTIAL - contains proposed APIs for O release of Android
+
+This is a prototype for a new audio API that can be used in place of OpenSL ES.
+
+It contains:
+1. A measurement test app for touch to tone latency.
+2. A 'C' API for Oboe.
+3. A C++ stream for multiple interfaces including Oboe 'C' and OpenSL ES.
+
diff --git a/apps/OboeTester/app/CMakeLists.txt b/apps/OboeTester/app/CMakeLists.txt
new file mode 100644
index 0000000..2390007
--- /dev/null
+++ b/apps/OboeTester/app/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.4.1)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -std=c++14")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
+
+link_directories(${CMAKE_CURRENT_LIST_DIR}/..)
+
+file(GLOB_RECURSE app_native_sources src/main/cpp/*)
+
+### Name must match loadLibrary() call in MainActivity.java
+add_library(oboetester SHARED ${app_native_sources})
+
+### INCLUDE OBOE LIBRARY ###
+
+# Set the path to the Oboe library directory
+set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
+
+# Add the Oboe library as a subproject. Since Oboe is an out-of-tree source library we must also
+# specify a binary directory
+add_subdirectory(${OBOE_DIR} ./oboe-bin)
+
+# Specify the path to the Oboe header files and the source.
+include_directories(
+ ${OBOE_DIR}/include
+ ${OBOE_DIR}/src
+)
+
+### END OBOE INCLUDE SECTION ###
+
+# link to oboe
+target_link_libraries(oboetester log oboe atomic)
+
+
diff --git a/apps/OboeTester/app/build.gradle b/apps/OboeTester/app/build.gradle
new file mode 100644
index 0000000..ec63c94
--- /dev/null
+++ b/apps/OboeTester/app/build.gradle
@@ -0,0 +1,44 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 26
+ defaultConfig {
+ applicationId = "com.google.sample.oboe.manualtest"
+ minSdkVersion 26
+ targetSdkVersion 26
+ versionCode 3
+ versionName "1.2.01"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ externalNativeBuild {
+ cmake {
+ cppFlags "-std=c++14"
+ // abiFilters "x86", "armeabi-v7a", "arm64-v8a"
+ // abiFilters "arm64-v8a"
+ }
+ }
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ jniDebuggable true
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ path "CMakeLists.txt"
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
+
+ testImplementation 'junit:junit:4.12'
+ implementation 'com.android.support:appcompat-v7:26.0.0'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+}
diff --git a/apps/OboeTester/app/proguard-rules.pro b/apps/OboeTester/app/proguard-rules.pro
new file mode 100644
index 0000000..7dc6c7f
--- /dev/null
+++ b/apps/OboeTester/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/gfan/dev/android-sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/apps/OboeTester/app/src/main/AndroidManifest.xml b/apps/OboeTester/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3e0f75c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/AndroidManifest.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.google.sample.oboe.manualtest"
+ android:versionCode="3"
+ android:versionName="1.2.01">
+ <!-- versionCode and versionName also have to be updated in build.gradle -->
+
+ <uses-sdk
+ android:minSdkVersion="24"
+ android:targetSdkVersion="24" />
+
+ <uses-feature android:name="android.hardware.microphone" android:required="true" />
+ <uses-feature android:name="android.hardware.audio.output" android:required="true" />
+ <uses-feature android:name="android.software.midi" android:required="true" />
+
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <!-- debug-writing file need external storage writing -->
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+ <application
+ android:allowBackup="false"
+ android:fullBackupContent="false"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+
+ <activity
+ android:name="com.google.sample.oboe.manualtest.MainActivity"
+ android:label="@string/app_name"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
+ android:name="com.google.sample.oboe.manualtest.TestOutputActivity"
+ android:label="@string/title_activity_test_output"
+ android:screenOrientation="portrait">
+ </activity>
+
+ <activity
+ android:name="com.google.sample.oboe.manualtest.TestInputActivity"
+ android:label="@string/title_activity_test_input"
+ android:screenOrientation="portrait">
+ </activity>
+
+ <activity
+ android:name="com.google.sample.oboe.manualtest.TapToToneActivity"
+ android:label="@string/title_activity_latency"
+ android:screenOrientation="portrait">
+ </activity>
+
+ <activity
+ android:name="com.google.sample.oboe.manualtest.RecorderActivity"
+ android:label="@string/title_activity_recorder"
+ android:screenOrientation="portrait">
+ </activity>
+
+ <service
+ android:name="com.google.sample.oboe.manualtest.AudioMidiTester"
+ android:permission="android.permission.BIND_MIDI_DEVICE_SERVICE">
+ <intent-filter>
+ <action android:name="android.media.midi.MidiDeviceService" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.media.midi.MidiDeviceService"
+ android:resource="@xml/service_device_info" />
+ </service>
+
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.cpp b/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.cpp
new file mode 100644
index 0000000..641a9ab
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2015 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.
+ */
+/*
+ * AudioProcessor.h
+ *
+ * Processing node in an audio graph.
+ */
+#include <sys/types.h>
+#define MODULE_NAME "NatRingMole"
+#include "common/OboeDebug.h"
+#include "oboe/Oboe.h"
+#include "AudioProcessorBase.h"
+
+AudioPort::AudioPort(AudioProcessorBase &parent, int samplesPerFrame)
+ : mParent(parent)
+ , mSamplesPerFrame(samplesPerFrame) {
+}
+AudioPort::~AudioPort() { }
+
+AudioFloatPort::AudioFloatPort(AudioProcessorBase &parent, int samplesPerFrame)
+ : AudioPort(parent, samplesPerFrame), mFloatBuffer(NULL) {
+ int numFloats = MAX_BLOCK_SIZE * mSamplesPerFrame;
+ mFloatBuffer = new float[numFloats];
+}
+
+AudioFloatPort::~AudioFloatPort() {
+ delete[] mFloatBuffer;
+}
+
+float *AudioFloatPort::getFloatBuffer(int numFrames) {
+ assert(numFrames <= MAX_BLOCK_SIZE);
+ return mFloatBuffer;
+}
+
+AudioOutputPort::AudioOutputPort(AudioProcessorBase &parent, int samplesPerFrame)
+ : AudioFloatPort(parent, samplesPerFrame)
+{
+ LOGD("AudioOutputPort(%d)", samplesPerFrame);
+}
+
+AudioOutputPort::~AudioOutputPort()
+{
+}
+
+AudioResult AudioOutputPort::pullData(
+ uint64_t framePosition,
+ int numFrames) {
+ return mParent.pullData(framePosition, numFrames);
+}
+
+void AudioOutputPort::connect(AudioInputPort *port) {
+ port->connect(this);
+}
+void AudioOutputPort::disconnect(AudioInputPort *port) {
+ port->disconnect(this);
+}
+
+AudioInputPort::AudioInputPort(AudioProcessorBase &parent, int samplesPerFrame)
+ : AudioFloatPort(parent, samplesPerFrame)
+{
+}
+AudioInputPort::~AudioInputPort() {
+}
+
+AudioResult AudioInputPort::pullData(
+ uint64_t framePosition,
+ int numFrames) {
+ return (mConnected == nullptr)
+ ? AUDIO_RESULT_SUCCESS
+ : mConnected->pullData(framePosition, numFrames);
+}
+
+float *AudioInputPort::getFloatBuffer(int numFrames) {
+ if (mConnected == NULL) {
+ return AudioFloatPort::getFloatBuffer(numFrames);
+ } else {
+ return mConnected->getFloatBuffer(numFrames);
+ }
+}
+
+void AudioInputPort::setValue(float value) {
+ int numFloats = MAX_BLOCK_SIZE * mSamplesPerFrame;
+ for (int i = 0; i < numFloats; i++) {
+ mFloatBuffer[i] = value;
+ }
+}
+
+/*
+ * AudioProcessorBase
+ */
+AudioProcessorBase::AudioProcessorBase() {
+}
+
+AudioProcessorBase::~AudioProcessorBase() {
+}
+
+AudioResult AudioProcessorBase::pullData(
+ uint64_t framePosition,
+ int numFrames) {
+ if (framePosition > mLastFramePosition) {
+ mLastFramePosition = framePosition;
+ mPreviousResult = onProcess(framePosition, numFrames);
+ }
+ return mPreviousResult;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.h b/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.h
new file mode 100644
index 0000000..6b938ca
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/AudioProcessorBase.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2015 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.
+ */
+/*
+ * AudioProcessor.h
+ *
+ * Processing node in an audio graph.
+ */
+
+#ifndef AUDIOPROCESSOR_H_
+#define AUDIOPROCESSOR_H_
+
+#include <cassert>
+#include <cstring>
+#include <math.h>
+#include <jni.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <sys/types.h>
+
+#define MAX_BLOCK_SIZE 2048
+
+class AudioProcessorBase;
+
+class AudioInputPort;
+
+typedef int32_t AudioResult;
+#define AUDIO_RESULT_SUCCESS 0
+#define AUDIO_RESULT_FAIL -100
+
+
+class AudioPort {
+public:
+ AudioPort(AudioProcessorBase &mParent, int samplesPerFrame);
+
+ ~AudioPort();
+
+ int getSamplesPerFrame() const { return mSamplesPerFrame; }
+
+protected:
+ AudioProcessorBase &mParent;
+ int mSamplesPerFrame;
+};
+
+class AudioFloatPort : public AudioPort {
+public:
+ AudioFloatPort(AudioProcessorBase &mParent, int samplesPerFrame);
+
+ ~AudioFloatPort();
+
+ virtual float *getFloatBuffer(int numFrames);
+
+protected:
+ float *mFloatBuffer;
+};
+
+class AudioOutputPort : public AudioFloatPort {
+public:
+ AudioOutputPort(AudioProcessorBase &parent, int samplesPerFrame);
+
+ ~AudioOutputPort();
+
+ using AudioFloatPort::getFloatBuffer;
+
+ AudioResult pullData(
+ uint64_t framePosition,
+ int numFrames);
+
+ void connect(AudioInputPort *port);
+ void disconnect(AudioInputPort *port);
+};
+
+class AudioInputPort : public AudioFloatPort {
+public:
+ AudioInputPort(AudioProcessorBase &parent, int mSamplesPerFrame);
+
+ ~AudioInputPort();
+
+ float *getFloatBuffer(int numFrames);
+
+ AudioResult pullData(
+ uint64_t framePosition,
+ int numFrames);
+
+ void connect(AudioOutputPort *port) {
+ assert(getSamplesPerFrame() == port->getSamplesPerFrame());
+ mConnected = port;
+ }
+ void disconnect(AudioOutputPort *port) {
+ assert(mConnected == port);
+ mConnected = NULL;
+ }
+ void disconnect() {
+ mConnected = NULL;
+ }
+
+ void setValue(float value);
+
+private:
+ AudioOutputPort *mConnected = nullptr;
+};
+
+
+class IAudioProcessor {
+public:
+ virtual AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) = 0;
+};
+
+class AudioProcessorBase : public IAudioProcessor {
+public:
+ AudioProcessorBase();
+
+ ~AudioProcessorBase();
+
+ virtual AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) = 0;
+
+ AudioResult pullData(
+ uint64_t framePosition,
+ int numFrames);
+
+ virtual void start() {
+ mLastFramePosition = 0;
+ }
+
+ virtual void stop() {}
+
+private:
+ uint64_t mLastFramePosition = 0;
+ AudioResult mPreviousResult = AUDIO_RESULT_SUCCESS;
+};
+
+#endif /* AUDIOPROCESSOR_H_ */
diff --git a/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.cpp b/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.cpp
new file mode 100644
index 0000000..f67a5d7
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2016 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.
+ */
+
+#include <cstring>
+#include <sched.h>
+
+#include "common/OboeDebug.h"
+#include "oboe/Oboe.h"
+#include "AudioStreamGateway.h"
+
+AudioStreamGateway::AudioStreamGateway(int samplesPerFrame)
+ : input(*this, samplesPerFrame)
+ , mFramePosition(0)
+{
+}
+
+AudioStreamGateway::~AudioStreamGateway()
+{
+}
+
+oboe::DataCallbackResult AudioStreamGateway::onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) {
+ int framesLeft = numFrames;
+ int16_t *shortData = (int16_t *) audioData;
+ float *floatData = (float *) audioData;
+ AudioResult result = 0;
+
+#ifdef OBOE_TESTER_DEBUG_STOP
+ if (mFrameCountdown <= 0) {
+ LOGI("%s() : mCallCounter = %d\n", __func__, mCallCounter);
+ mFrameCountdown = 4800;
+ }
+ mFrameCountdown -= numFrames;
+ mCallCounter++;
+ if (mCallCounter > 500) {
+ LOGI("%s() : return STOP\n", __func__);
+ return oboe::DataCallbackResult::Stop;
+ }
+#endif /* OBOE_TESTER_DEBUG_STOP */
+
+ if (!mSchedulerChecked) {
+ mScheduler = sched_getscheduler(gettid());
+ mSchedulerChecked = true;
+ }
+
+ while (framesLeft > 0) {
+ // Do not process more than the MAX block size in one pass.
+ int framesToPlay = framesLeft;
+ if (framesToPlay > MAX_BLOCK_SIZE) {
+ framesToPlay = MAX_BLOCK_SIZE;
+ }
+ // Run the graph and pull data through the input port.
+ result = onProcess(mFramePosition, framesToPlay);
+ if (result < 0) {
+ break;
+ }
+ const float *signal = input.getFloatBuffer(framesToPlay);
+ int32_t numSamples = framesToPlay * input.getSamplesPerFrame();
+ if (audioStream->getFormat() == oboe::AudioFormat::I16) {
+ oboe::convertFloatToPcm16(signal, shortData, numSamples);
+ shortData += numSamples;
+ } else if (audioStream->getFormat() == oboe::AudioFormat::Float) {
+ memcpy(floatData, signal, numSamples * sizeof(float));
+ floatData += numSamples;
+ }
+ mFramePosition += framesToPlay;
+ framesLeft -= framesToPlay;
+ }
+ return (result < 0) ? oboe::DataCallbackResult::Stop : oboe::DataCallbackResult::Continue;
+}
+
+AudioResult AudioStreamGateway::onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+ AudioResult result = input.pullData(framePosition, numFrames);
+ return result;
+}
+
+int AudioStreamGateway::getScheduler() {
+ return mScheduler;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.h b/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.h
new file mode 100644
index 0000000..fe22b50
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/AudioStreamGateway.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016 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 NATIVEOBOE_AUDIOGRAPHRUNNER_H
+#define NATIVEOBOE_AUDIOGRAPHRUNNER_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "AudioProcessorBase.h"
+#include "oboe/Oboe.h"
+
+/**
+ * Bridge between an audio graph and an audio device.
+ * Connect the audio units to the "input" and then pass
+ * this object to the AudioStreamBuilder as a callback.
+ */
+class AudioStreamGateway : public AudioProcessorBase, public oboe::AudioStreamCallback {
+public:
+ AudioStreamGateway(int samplesPerFrame);
+ virtual ~AudioStreamGateway();
+
+ /**
+ * Process audio for the graph.
+ * @param framePosition
+ * @param numFrames
+ * @return
+ */
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) override;
+
+ /**
+ * Called by Oboe when the stream is ready to process audio.
+ */
+ oboe::DataCallbackResult onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) override;
+
+ AudioInputPort input;
+
+ int getScheduler();
+
+ void start() override {
+ AudioProcessorBase::start();
+ mCallCounter = 0;
+ mFrameCountdown = 0;
+ }
+
+private:
+ uint64_t mFramePosition;
+ bool mSchedulerChecked = false;
+ int mScheduler;
+
+ int32_t mCallCounter = 0;
+ int32_t mFrameCountdown = 0;
+};
+
+
+#endif //NATIVEOBOE_AUDIOGRAPHRUNNER_H
diff --git a/apps/OboeTester/app/src/main/cpp/FifoProcessor.cpp b/apps/OboeTester/app/src/main/cpp/FifoProcessor.cpp
new file mode 100644
index 0000000..f7478bf
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/FifoProcessor.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "FifoProcessor.h"
+
+
+FifoProcessor::FifoProcessor(int channelCount, int numFrames, int threshold)
+ : mFifoBuffer(channelCount, numFrames)
+ , output(*this, channelCount)
+{
+ mFifoBuffer.setThresholdFrames(threshold);
+}
+
+FifoProcessor::~FifoProcessor() {
+}
diff --git a/apps/OboeTester/app/src/main/cpp/FifoProcessor.h b/apps/OboeTester/app/src/main/cpp/FifoProcessor.h
new file mode 100644
index 0000000..37de256
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/FifoProcessor.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 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 NATIVEOBOE_FIFIPROCESSOR_H
+#define NATIVEOBOE_FIFIPROCESSOR_H
+
+#include "AudioProcessorBase.h"
+#include "fifo/FifoBuffer.h"
+
+class FifoProcessor : public AudioProcessorBase {
+public:
+ FifoProcessor(int samplesPerFrame, int numFrames, int threshold);
+
+ virtual ~FifoProcessor();
+
+ uint32_t read(float *destination, int framesToRead) {
+ return mFifoBuffer.read(destination, framesToRead);
+ }
+
+ uint32_t write(const float *source, int framesToWrite) {
+ return mFifoBuffer.write(source, framesToWrite);
+ }
+
+ uint32_t getThresholdFrames() {
+ return mFifoBuffer.getThresholdFrames();
+ }
+
+ void setThresholdFrames(uint32_t threshold) {
+ return mFifoBuffer.setThresholdFrames(threshold);
+ }
+
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+ float *buffer = output.getFloatBuffer(numFrames);
+ return mFifoBuffer.readNow(buffer, numFrames);
+ }
+
+ uint32_t getUnderrunCount() const { return mFifoBuffer.getUnderrunCount(); }
+
+private:
+ oboe::FifoBuffer mFifoBuffer;
+
+public:
+ AudioOutputPort output;
+
+};
+
+
+#endif //NATIVEOBOE_FIFIPROCESSOR_H
diff --git a/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.cpp b/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.cpp
new file mode 100644
index 0000000..d621a8c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright 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.
+ */
+
+#include <math.h>
+#include <unistd.h>
+#include "AudioProcessorBase.h"
+
+#include "ImpulseGenerator.h"
+
+ImpulseGenerator::ImpulseGenerator()
+ : OscillatorBase() {
+}
+
+AudioResult ImpulseGenerator::onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+
+ frequency.pullData(framePosition, numFrames);
+ amplitude.pullData(framePosition, numFrames);
+
+ const float *frequencies = frequency.getFloatBuffer(numFrames);
+ const float *amplitudes = amplitude.getFloatBuffer(numFrames);
+ float *buffer = output.getFloatBuffer(numFrames);
+
+ for (int i = 0; i < numFrames; i++) {
+ float value = 0.0f;
+ mPhase += mFrequencyToPhase * frequencies[i];
+ if (mPhase >= TWO_PI) {
+ value = amplitudes[i];
+ mPhase -= TWO_PI;
+ }
+ *buffer++ = value;
+ }
+
+ return AUDIO_RESULT_SUCCESS;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.h b/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.h
new file mode 100644
index 0000000..5db11b5
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/ImpulseGenerator.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 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 NATIVEOBOE_IMPULSE_GENERATOR_H
+#define NATIVEOBOE_IMPULSE_GENERATOR_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "AudioProcessorBase.h"
+#include "OscillatorBase.h"
+
+class ImpulseGenerator : public OscillatorBase {
+public:
+ ImpulseGenerator();
+
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames);
+
+
+
+};
+
+#endif //NATIVEOBOE_IMPULSE_GENERATOR_H
diff --git a/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.cpp b/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.cpp
new file mode 100644
index 0000000..3925959
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 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.
+ */
+
+#include "common/OboeDebug.h"
+#include "InputStreamCallbackAnalyzer.h"
+
+oboe::DataCallbackResult InputStreamCallbackAnalyzer::onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) {
+ int32_t channelCount = audioStream->getChannelCount();
+
+ if (audioStream->getFormat() == oboe::AudioFormat::I16) {
+ int16_t *shortData = (int16_t *) audioData;
+ if (mRecording != nullptr) {
+ mRecording->write(shortData, numFrames);
+ }
+ int16_t *frameData = shortData;
+ for (int iFrame = 0; iFrame < numFrames; iFrame++) {
+ for (int iChannel = 0; iChannel < channelCount; iChannel++) {
+ float sample = frameData[iChannel] / 32768.0f;
+ mPeakDetectors[iChannel].process(sample);
+ }
+ frameData += channelCount;
+ }
+ } else if (audioStream->getFormat() == oboe::AudioFormat::Float) {
+ float *floatData = (float *) audioData;
+ if (mRecording != nullptr) {
+ mRecording->write(floatData, numFrames);
+ }
+ float *frameData = floatData;
+ for (int iFrame = 0; iFrame < numFrames; iFrame++) {
+ for (int iChannel = 0; iChannel < channelCount; iChannel++) {
+ float sample = frameData[iChannel];
+ mPeakDetectors[iChannel].process(sample);
+ }
+ frameData += channelCount;
+ }
+ }
+
+ return oboe::DataCallbackResult::Continue;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.h b/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.h
new file mode 100644
index 0000000..ddcce09
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/InputStreamCallbackAnalyzer.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 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 NATIVEOBOE_INPUTSTREAMCALLBACKANALYZER_H
+#define NATIVEOBOE_INPUTSTREAMCALLBACKANALYZER_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "AudioProcessorBase.h"
+#include "oboe/Oboe.h"
+#include "MultiChannelRecording.h"
+#include "PeakDetector.h"
+
+constexpr int kMaxInputChannels = 8;
+
+class InputStreamCallbackAnalyzer : public oboe::AudioStreamCallback {
+public:
+
+ void reset() {
+ for (auto detector : mPeakDetectors) {
+ detector.reset();
+ }
+ }
+
+ /**
+ * Called by Oboe when the stream is ready to process audio.
+ */
+ oboe::DataCallbackResult onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) override;
+
+ void setRecording(MultiChannelRecording *recording) {
+ mRecording = recording;
+ }
+
+ double getPeakLevel(int index) {
+ return mPeakDetectors[index].getLevel();
+ }
+
+public:
+ PeakDetector mPeakDetectors[kMaxInputChannels];
+ MultiChannelRecording *mRecording = nullptr;
+};
+
+#endif //NATIVEOBOE_INPUTSTREAMCALLBACKANALYZER_H
diff --git a/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.cpp b/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.cpp
new file mode 100644
index 0000000..0f761dc
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2015 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.
+ */
+
+#include <unistd.h>
+#include "AudioProcessorBase.h"
+#include "MonoToMultiConverter.h"
+
+MonoToMultiConverter::MonoToMultiConverter(int32_t channelCount)
+ : input(*this, 1)
+ , output(*this, channelCount) {
+}
+
+MonoToMultiConverter::~MonoToMultiConverter() { }
+
+AudioResult MonoToMultiConverter::onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+ input.pullData(framePosition, numFrames);
+
+ const float *inputBuffer = input.getFloatBuffer(numFrames);
+ float *outputBuffer = output.getFloatBuffer(numFrames);
+ int32_t channelCount = output.getSamplesPerFrame();
+
+ for (int i = 0; i < numFrames; i++) {
+ // read one, write many
+ float sample = *inputBuffer++;
+ for (int ch = 0; ch < channelCount; ch++) {
+ *outputBuffer++ = sample;
+ }
+ }
+ return AUDIO_RESULT_SUCCESS;
+}
+
diff --git a/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.h b/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.h
new file mode 100644
index 0000000..6bae467
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/MonoToMultiConverter.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 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 NATIVEOBOE_MONO_TO_MULTI_CONVERTER_H
+#define NATIVEOBOE_MONO_TO_MULTI_CONVERTER_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "AudioProcessorBase.h"
+
+class MonoToMultiConverter : AudioProcessorBase {
+public:
+ explicit MonoToMultiConverter(int32_t channelCount);
+
+ virtual ~MonoToMultiConverter();
+
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames);
+
+ void setEnabled(bool enabled) {};
+
+ AudioInputPort input;
+ AudioOutputPort output;
+
+private:
+};
+
+
+#endif //NATIVEOBOE_MONO_TO_MULTI_CONVERTER_H
diff --git a/apps/OboeTester/app/src/main/cpp/MultiChannelRecording.h b/apps/OboeTester/app/src/main/cpp/MultiChannelRecording.h
new file mode 100644
index 0000000..671393d
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/MultiChannelRecording.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2015 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 NATIVEOBOE_MULTICHANNEL_RECORDING_H
+#define NATIVEOBOE_MULTICHANNEL_RECORDING_H
+
+#include <memory.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+class MultiChannelRecording {
+public:
+ MultiChannelRecording(int32_t channelCount, int32_t maxFrames)
+ : mChannelCount(channelCount)
+ , mMaxFrames(maxFrames) {
+ mData = new float[channelCount * maxFrames];
+ }
+
+ ~MultiChannelRecording() {
+ delete[] mData;
+ }
+
+ void rewind() {
+ mCursor = 0;
+ }
+
+ /**
+ * Write numFrames from the short buffer into the recording, if there is room.
+ * Convert shoirts to floats.
+ *
+ * @param buffer
+ * @param numFrames
+ * @return number of frames actually written.
+ */
+ int32_t write(int16_t *buffer, int32_t numFrames) {
+ int32_t framesEmpty = mMaxFrames - mValidFrames;
+ if (numFrames > framesEmpty) {
+ numFrames = framesEmpty;
+ }
+ if (numFrames > 0) {
+ int32_t numSamples = numFrames * mChannelCount;
+ int32_t index = mValidFrames * mChannelCount;
+ for (int i = 0; i < numSamples; i++) {
+ mData[index++] = buffer[i * mChannelCount] * (1.0f / 32768);
+ }
+ mValidFrames += numFrames;
+ }
+ return numFrames;
+ }
+
+ /**
+ * Write numFrames from the float buffer into the recording, if there is room.
+ * @param buffer
+ * @param numFrames
+ * @return number of frames actually written.
+ */
+ int32_t write(float *buffer, int32_t numFrames) {
+ int32_t framesEmpty = mMaxFrames - mValidFrames;
+ if (numFrames > framesEmpty) {
+ numFrames = framesEmpty;
+ }
+ if (numFrames > 0) {
+ int32_t numSamples = numFrames * mChannelCount;
+ memcpy(mData + (mValidFrames * mChannelCount),
+ buffer,
+ (numSamples * sizeof(float)));
+ mValidFrames += numFrames;
+ }
+ return numFrames;
+ }
+
+ /**
+ * Read numFrames from the recording into the buffer, if there is enough data.
+ * @param buffer
+ * @param numFrames
+ * @return number of frames actually read.
+ */
+ int32_t read(float *buffer, int32_t numFrames) {
+ int32_t framesLeft = mValidFrames - mCursor;
+ if (numFrames > framesLeft) {
+ numFrames = framesLeft;
+ }
+ if (numFrames > 0) {
+ int32_t numSamples = numFrames * mChannelCount;
+ memcpy(buffer,
+ &mData[mCursor * mChannelCount],
+ (numSamples * sizeof(float)));
+ mCursor += numFrames;
+ }
+ return numFrames;
+ }
+
+private:
+ float *mData = nullptr;
+ int32_t mValidFrames = 0;
+ int32_t mCursor = 0;
+ const int32_t mChannelCount;
+ const int32_t mMaxFrames;
+};
+
+#endif //NATIVEOBOE_MULTICHANNEL_RECORDING_H
diff --git a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
new file mode 100644
index 0000000..93d573e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2017 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.
+ */
+
+#include "NativeAudioContext.h"
+
+#define SECONDS_TO_RECORD 10
+
+void NativeAudioContext::close() {
+ stopBlockingIOThread();
+
+ if (oboeStream != nullptr) {
+ oboeStream->close();
+ }
+ delete oboeStream;
+ oboeStream = nullptr;
+ delete monoToMulti;
+ monoToMulti = nullptr;
+}
+
+bool NativeAudioContext::isMMapUsed() {
+ if (oboeStream != nullptr && oboeStream->usesAAudio()) {
+ if (mAAudioStream_isMMap == nullptr) {
+ mLibHandle = dlopen(LIB_AAUDIO_NAME, 0);
+ if (mLibHandle == nullptr) {
+ LOGI("%s() could not find " LIB_AAUDIO_NAME, __func__);
+ return false;
+ }
+
+ mAAudioStream_isMMap = (bool (*)(AAudioStream *stream))
+ dlsym(mLibHandle, FUNCTION_IS_MMAP);
+
+ if(mAAudioStream_isMMap == nullptr) {
+ LOGI("%s() could not find " FUNCTION_IS_MMAP, __func__);
+ return false;
+ }
+ }
+ AAudioStream *aaudioStream = (AAudioStream *) oboeStream->getUnderlyingStream();
+ return mAAudioStream_isMMap(aaudioStream);
+ }
+ return false;
+}
+
+void NativeAudioContext::connectTone() {
+ if (monoToMulti != nullptr) {
+ LOGI("%s() mToneType = %d", __func__, mToneType);
+ switch (mToneType) {
+ case ToneType::SawPing:
+ sawPingGenerator.output.connect(&monoToMulti->input);
+ break;
+ case ToneType::Sine:
+ sineGenerator.output.connect(&monoToMulti->input);
+ break;
+ case ToneType::Impulse:
+ impulseGenerator.output.connect(&monoToMulti->input);
+ break;
+ }
+ }
+}
+
+int NativeAudioContext::open(jint sampleRate,
+ jint channelCount,
+ jint format,
+ jint sharingMode,
+ jint performanceMode,
+ jint deviceId,
+ jint sessionId,
+ jint framesPerBurst, jboolean isInput) {
+ if (oboeStream != NULL) {
+ return (jint) oboe::Result::ErrorInvalidState;
+ }
+ if (channelCount < 0 || channelCount > 256) {
+ LOGE("NativeAudioContext::open() channels out of range");
+ return (jint) oboe::Result::ErrorOutOfRange;
+ }
+
+ // Create an audio output stream.
+ LOGD("NativeAudioContext::open() try to create the OboeStream");
+ oboe::AudioStreamBuilder builder;
+ builder.setChannelCount(channelCount)
+ ->setDirection(isInput ? oboe::Direction::Input : oboe::Direction::Output)
+ ->setSharingMode((oboe::SharingMode) sharingMode)
+ ->setPerformanceMode((oboe::PerformanceMode) performanceMode)
+ ->setDeviceId(deviceId)
+ ->setSessionId((oboe::SessionId) sessionId)
+ ->setSampleRate(sampleRate)
+ ->setFormat((oboe::AudioFormat) format);
+
+ // We needed the proxy because we did not know the channelCount when we setup the Builder.
+ if (useCallback) {
+ builder.setCallback(&oboeCallbackProxy);
+ builder.setFramesPerCallback(callbackSize);
+ }
+
+ if (mAudioApi == oboe::AudioApi::OpenSLES) {
+ builder.setFramesPerCallback(framesPerBurst);
+ }
+ builder.setAudioApi(mAudioApi);
+
+ // Open a stream based on the builder settings.
+ oboe::Result result = builder.openStream(&oboeStream);
+ LOGD("NativeAudioContext::open() open(b) returned %d", result);
+ if (result != oboe::Result::OK) {
+ delete oboeStream;
+ oboeStream = nullptr;
+ } else {
+ mChannelCount = oboeStream->getChannelCount();
+ mFramesPerBurst = oboeStream->getFramesPerBurst();
+ mSampleRate = oboeStream->getSampleRate();
+ if (isInput) {
+ mInputAnalyzer.reset();
+ if (useCallback) {
+ oboeCallbackProxy.setCallback(&mInputAnalyzer);
+ }
+ mRecording = std::make_unique<MultiChannelRecording>(mChannelCount,
+ SECONDS_TO_RECORD * mSampleRate);
+ mInputAnalyzer.setRecording(mRecording.get());
+ } else {
+
+ sineGenerator.setSampleRate(oboeStream->getSampleRate());
+ sineGenerator.frequency.setValue(440.0);
+ sineGenerator.amplitude.setValue(AMPLITUDE_SINE);
+
+ impulseGenerator.setSampleRate(oboeStream->getSampleRate());
+ impulseGenerator.frequency.setValue(440.0);
+ impulseGenerator.amplitude.setValue(AMPLITUDE_IMPULSE);
+
+ sawPingGenerator.setSampleRate(oboeStream->getSampleRate());
+ sawPingGenerator.frequency.setValue(FREQUENCY_SAW_PING);
+ sawPingGenerator.amplitude.setValue(AMPLITUDE_SAW_PING);
+
+ monoToMulti = new MonoToMultiConverter(mChannelCount);
+ connectTone();
+
+ // We needed the proxy because we did not know the channelCount
+ // when we setup the Builder.
+ audioStreamGateway = std::make_unique<AudioStreamGateway>(mChannelCount);
+
+ if (useCallback) {
+ oboeCallbackProxy.setCallback(audioStreamGateway.get());
+ }
+
+ // Input will get connected by setToneType()
+ monoToMulti->output.connect(&(audioStreamGateway.get()->input));
+
+ // Set starting size of buffer.
+ constexpr int kDefaultNumBursts = 2; // "double buffer"
+ int32_t numBursts = kDefaultNumBursts;
+ // callbackSize is used for both callbacks and blocking write
+ numBursts = (callbackSize <= mFramesPerBurst)
+ ? kDefaultNumBursts
+ : ((callbackSize * kDefaultNumBursts) + mFramesPerBurst - 1)
+ / mFramesPerBurst;
+ oboeStream->setBufferSizeInFrames(numBursts * mFramesPerBurst);
+ }
+
+ if (!useCallback) {
+ int numSamples = getFramesPerBlock() * mChannelCount;
+ dataBuffer = std::make_unique<float>(numSamples);
+ }
+
+ mIsMMapUsed = isMMapUsed();
+ }
+
+ return (int) result;
+}
+
+void NativeAudioContext::runBlockingIO() {
+ int32_t framesPerBlock = getFramesPerBlock();
+ oboe::DataCallbackResult callbackResult = oboe::DataCallbackResult::Continue;
+ while (threadEnabled.load()
+ && callbackResult == oboe::DataCallbackResult::Continue) {
+ if (oboeStream->getDirection() == oboe::Direction::Input) {
+ // read from input
+ auto result = oboeStream->read(dataBuffer.get(),
+ framesPerBlock,
+ NANOS_PER_SECOND);
+ if (!result) {
+ LOGE("%s() : read() returned %s\n", __func__, convertToText(result.error()));
+ break;
+ }
+ int32_t framesRead = result.value();
+ if (framesRead < framesPerBlock) { // timeout?
+ LOGE("%s() : read() read %d of %d\n", __func__, framesRead, framesPerBlock);
+ break;
+ }
+
+ // analyze input
+ callbackResult = mInputAnalyzer.onAudioReady(oboeStream,
+ dataBuffer.get(),
+ framesRead);
+ } else if (audioStreamGateway != nullptr) { // OUTPUT?
+ // generate output by calling the callback
+ callbackResult = audioStreamGateway->onAudioReady(oboeStream,
+ dataBuffer.get(),
+ framesPerBlock);
+
+ auto result = oboeStream->write(dataBuffer.get(),
+ framesPerBlock,
+ NANOS_PER_SECOND);
+
+ if (!result) {
+ LOGE("%s() returned %s\n", __func__, convertToText(result.error()));
+ break;
+ }
+ int32_t framesWritten = result.value();
+ if (framesWritten < framesPerBlock) {
+ LOGE("%s() : write() wrote %d of %d\n", __func__, framesWritten, framesPerBlock);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h
new file mode 100644
index 0000000..ccc9f46
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2015 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 NATIVEOBOE_NATIVEAUDIOCONTEXT_H
+#define NATIVEOBOE_NATIVEAUDIOCONTEXT_H
+
+#include <dlfcn.h>
+#include <thread>
+
+#include "common/OboeDebug.h"
+#include "oboe/Oboe.h"
+
+#include "AudioStreamGateway.h"
+#include "ImpulseGenerator.h"
+#include "InputStreamCallbackAnalyzer.h"
+#include "MonoToMultiConverter.h"
+#include "MultiChannelRecording.h"
+#include "OboeStreamCallbackProxy.h"
+#include "PlayRecordingCallback.h"
+#include "SawPingGenerator.h"
+#include "SineGenerator.h"
+
+#define AMPLITUDE_SINE 1.0
+#define FREQUENCY_SAW_PING 1200.0
+#define AMPLITUDE_SAW_PING 1.0
+#define AMPLITUDE_IMPULSE 0.7
+
+#define NANOS_PER_MICROSECOND ((int64_t) 1000)
+#define NANOS_PER_MILLISECOND (1000 * NANOS_PER_MICROSECOND)
+#define NANOS_PER_SECOND (1000 * NANOS_PER_MILLISECOND)
+
+#define LIB_AAUDIO_NAME "libaaudio.so"
+#define FUNCTION_IS_MMAP "AAudioStream_isMMapUsed"
+
+/**
+ * Implement the native API for the Oboe Tester.
+ * Manage a stream.
+ * Generate signals, etc.
+ */
+class NativeAudioContext {
+public:
+
+ void close();
+
+ bool isMMapUsed();
+
+ int open(jint sampleRate,
+ jint channelCount,
+ jint format,
+ jint sharingMode,
+ jint performanceMode,
+ jint deviceId,
+ jint sessionId,
+ jint framesPerBurst, jboolean isInput);
+
+ void setToneType(int toneType) {
+ LOGI("%s(%d)", __func__, toneType);
+ mToneType = (ToneType) toneType;
+ connectTone();
+ }
+
+ int32_t getFramesPerBlock() {
+ return (callbackSize == 0) ? mFramesPerBurst : callbackSize;
+ }
+
+ void printScheduler() {
+ if (audioStreamGateway != nullptr) {
+ int scheduler = audioStreamGateway->getScheduler();
+ LOGI("scheduler = 0x%08x, SCHED_FIFO = 0x%08X\n", scheduler, SCHED_FIFO);
+ }
+ }
+
+
+ oboe::Result pause() {
+ oboe::Result result = oboe::Result::OK;
+ stopBlockingIOThread();
+ if (oboeStream != nullptr) {
+ result = oboeStream->requestPause();
+ printScheduler();
+ }
+ return result;
+ }
+
+ oboe::Result stopAudio() {
+ oboe::Result result = oboe::Result::OK;
+ stopBlockingIOThread();
+
+ if (oboeStream != nullptr) {
+ result = oboeStream->requestStop();
+ printScheduler();
+ }
+ return result;
+ }
+
+ oboe::Result stopPlayback() {
+ oboe::Result result = oboe::Result::OK;
+ if (playbackStream != nullptr) {
+ result = playbackStream->requestStop();
+ playbackStream->close();
+ mPlayRecordingCallback.setRecording(nullptr);
+ delete playbackStream;
+ playbackStream = nullptr;
+ }
+ return result;
+ }
+
+ oboe::Result stop() {
+ oboe::Result result1 = stopPlayback();
+ oboe::Result result2 = stopAudio();
+
+ sineGenerator.stop();
+ impulseGenerator.stop();
+ sawPingGenerator.stop();
+ if (audioStreamGateway != nullptr) {
+ audioStreamGateway->stop();
+ }
+ return (result1 != oboe::Result::OK) ? result1 : result2;
+ }
+
+ oboe::Result startPlayback() {
+ stop();
+
+ oboe::AudioStreamBuilder builder;
+ builder.setChannelCount(mChannelCount)
+ ->setSampleRate(mSampleRate)
+ ->setFormat(oboe::AudioFormat::Float)
+ ->setCallback(&mPlayRecordingCallback);
+ // ->setAudioApi(oboe::AudioApi::OpenSLES);
+ oboe::Result result = builder.openStream(&playbackStream);
+ LOGD("NativeAudioContext::startPlayback() openStream() returned %d", result);
+ if (result != oboe::Result::OK) {
+ delete playbackStream;
+ playbackStream = nullptr;
+ } else if (playbackStream != nullptr) {
+ if (mRecording != nullptr) {
+ mRecording->rewind();
+ mPlayRecordingCallback.setRecording(mRecording.get());
+ result = playbackStream->requestStart();
+ }
+ }
+ return result;
+ }
+
+ static void threadCallback(NativeAudioContext *context) {
+ LOGD("%s: called", __func__);
+ context->runBlockingIO();
+ LOGD("%s: exiting", __func__);
+ }
+
+ oboe::Result start() {
+ stop();
+
+ sineGenerator.start();
+ impulseGenerator.start();
+ sawPingGenerator.start();
+ if (audioStreamGateway != nullptr) {
+ audioStreamGateway->start();
+ }
+
+ LOGD("OboeAudioStream_start: start called");
+ oboe::Result result = oboe::Result::OK;
+ if (oboeStream != nullptr) {
+ result = oboeStream->requestStart();
+ }
+
+ if (!useCallback && result == oboe::Result::OK) {
+ LOGD("OboeAudioStream_start: start thread for blocking I/O");
+ // Instead of using the callback, start a thread that reads or writes the stream.
+ threadEnabled.store(true);
+ dataThread = new std::thread(threadCallback, this);
+ }
+ LOGD("OboeAudioStream_start: start returning %d", result);
+ return result;
+ }
+
+ void setAudioApi(oboe::AudioApi audioApi) {
+ mAudioApi = audioApi;
+ }
+
+ void setToneEnabled(bool enabled) {
+ LOGD("%s(%d)", __func__, enabled ? 1 : 0);
+ // sineGenerator.setEnabled(enabled); // not needed
+ sawPingGenerator.setEnabled(enabled);
+ // impulseGenerator.setEnabled(enabled); // not needed
+ }
+
+ void setAmplitude(double amplitude) {
+ LOGD("%s(%f)", __func__, amplitude);
+ sineGenerator.amplitude.setValue(amplitude);
+ sawPingGenerator.amplitude.setValue(amplitude);
+ impulseGenerator.amplitude.setValue(amplitude);
+ }
+
+ oboe::AudioStream *oboeStream = nullptr;
+ InputStreamCallbackAnalyzer mInputAnalyzer;
+ bool useCallback = true;
+ int callbackSize = 0;
+ bool mIsMMapUsed = false;
+
+private:
+
+ // WARNING - must match order in strings.xml and OboeAudioOutputStream.java
+ enum ToneType {
+ SawPing = 0,
+ Sine = 1,
+ Impulse = 2
+ };
+
+ void connectTone();
+
+ void runBlockingIO();
+
+ void stopBlockingIOThread() {
+ if (!useCallback) {
+ // stop a thread that runs in place of the callback
+ threadEnabled.store(false); // ask thread to exit its loop
+ if (dataThread != nullptr) {
+ dataThread->join();
+ dataThread = nullptr;
+ }
+ }
+
+ }
+
+ oboe::AudioApi mAudioApi = oboe::AudioApi::Unspecified;
+ int32_t mFramesPerBurst = 0;
+ int32_t mChannelCount = 0;
+ int32_t mSampleRate = 0;
+ ToneType mToneType = ToneType::Sine;
+
+ std::atomic<bool> threadEnabled{false};
+ std::thread *dataThread = nullptr;
+
+ OboeStreamCallbackProxy oboeCallbackProxy;
+ SineGenerator sineGenerator;
+ ImpulseGenerator impulseGenerator;
+ SawPingGenerator sawPingGenerator;
+ MonoToMultiConverter *monoToMulti = nullptr;
+ oboe::AudioStream *playbackStream = nullptr;
+ std::unique_ptr<float> dataBuffer{};
+
+ std::unique_ptr<AudioStreamGateway> audioStreamGateway{};
+ std::unique_ptr<MultiChannelRecording> mRecording{};
+
+ PlayRecordingCallback mPlayRecordingCallback;
+
+ bool (*mAAudioStream_isMMap)(AAudioStream *stream) = nullptr;
+ void *mLibHandle = nullptr;
+
+};
+
+#endif //NATIVEOBOE_NATIVEAUDIOCONTEXT_H
diff --git a/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.cpp b/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.cpp
new file mode 100644
index 0000000..6f85943
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 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.
+ */
+
+#include "OboeStreamCallbackProxy.h"
+
+OboeStreamCallbackProxy::~OboeStreamCallbackProxy() {
+}
+
+oboe::DataCallbackResult OboeStreamCallbackProxy::onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) {
+ if (mCallback != nullptr) {
+ return mCallback->onAudioReady(audioStream, audioData, numFrames);
+ }
+ return oboe::DataCallbackResult::Stop;
+}
+
+void OboeStreamCallbackProxy::onErrorBeforeClose(oboe::AudioStream *audioStream, oboe::Result error) {
+ if (mCallback != nullptr) {
+ return mCallback->onErrorBeforeClose(audioStream, error);
+ }
+}
+
+void OboeStreamCallbackProxy::onErrorAfterClose(oboe::AudioStream *audioStream, oboe::Result error) {
+ if (mCallback != nullptr) {
+ return mCallback->onErrorAfterClose(audioStream, error);
+ }
+}
diff --git a/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.h b/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.h
new file mode 100644
index 0000000..89fded6
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/OboeStreamCallbackProxy.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017 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 NATIVEOBOE_OBOESTREAMCALLBACKPROXY_H
+#define NATIVEOBOE_OBOESTREAMCALLBACKPROXY_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "oboe/Oboe.h"
+
+class OboeStreamCallbackProxy : public oboe::AudioStreamCallback {
+public:
+ OboeStreamCallbackProxy() {}
+ ~OboeStreamCallbackProxy();
+
+ void setCallback(oboe::AudioStreamCallback *callback) {
+ mCallback = callback;
+ }
+
+ /**
+ * Called when the stream is ready to process audio.
+ */
+ oboe::DataCallbackResult onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) override;
+
+ void onErrorBeforeClose(oboe::AudioStream *audioStream, oboe::Result error) override;
+
+ void onErrorAfterClose(oboe::AudioStream *audioStream, oboe::Result error) override;
+
+private:
+ oboe::AudioStreamCallback *mCallback = nullptr;
+};
+
+
+#endif //NATIVEOBOE_OBOESTREAMCALLBACKPROXY_H
diff --git a/apps/OboeTester/app/src/main/cpp/OscillatorBase.cpp b/apps/OboeTester/app/src/main/cpp/OscillatorBase.cpp
new file mode 100644
index 0000000..f839f78
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/OscillatorBase.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright 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.
+ */
+
+#include "OscillatorBase.h"
+
+OscillatorBase::OscillatorBase()
+ : frequency(*this, 1)
+ , amplitude(*this, 1)
+ , output(*this, 1) {
+ setSampleRate(48000);
+}
diff --git a/apps/OboeTester/app/src/main/cpp/OscillatorBase.h b/apps/OboeTester/app/src/main/cpp/OscillatorBase.h
new file mode 100644
index 0000000..cf2a605
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/OscillatorBase.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 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 NATIVEOBOE_OSCILLATORBASE_H
+#define NATIVEOBOE_OSCILLATORBASE_H
+
+#include "AudioProcessorBase.h"
+
+constexpr float TWO_PI = (float)(2.0 * M_PI);
+
+class OscillatorBase : public AudioProcessorBase {
+public:
+ OscillatorBase();
+
+ virtual ~OscillatorBase() = default;
+
+ void setSampleRate(float sampleRate) {
+ mSampleRate = sampleRate;
+ mFrequencyToPhase = TWO_PI / sampleRate; // scaler
+ }
+
+ float setSampleRate() {
+ return mSampleRate;
+ }
+
+ AudioInputPort frequency;
+ AudioInputPort amplitude;
+ AudioOutputPort output;
+
+protected:
+ float incrementPhase(float frequency) {
+ mPhase += frequency * mFrequencyToPhase;
+ if (mPhase >= TWO_PI) {
+ mPhase -= TWO_PI;
+ } else if (mPhase < 0) {
+ mPhase += TWO_PI;
+ }
+ return mPhase;
+ }
+
+ float mPhase = 0.0;
+ float mSampleRate;
+ float mFrequencyToPhase;
+};
+
+
+#endif //NATIVEOBOE_OSCILLATORBASE_H
diff --git a/apps/OboeTester/app/src/main/cpp/PeakDetector.h b/apps/OboeTester/app/src/main/cpp/PeakDetector.h
new file mode 100644
index 0000000..5e4b92c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/PeakDetector.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 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 OBOE_TESTER_PEAK_DETECTOR_H
+#define OBOE_TESTER_PEAK_DETECTOR_H
+
+#include <math.h>
+
+constexpr double kDefaultDecay = 0.9999; //
+
+class PeakDetector {
+public:
+
+ void reset() {
+ mLevel = 0.0;
+ }
+
+ double process(double input) {
+ mLevel *= mDecay;
+ input = fabs(input);
+ if (input > mLevel) {
+ mLevel = input;
+ }
+ return mLevel;
+ }
+
+ double getLevel() {
+ return mLevel;
+ }
+
+private:
+ double mLevel = 0.0;
+ double mDecay = kDefaultDecay;
+};
+#endif //OBOE_TESTER_PEAK_DETECTOR_H
diff --git a/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.cpp b/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.cpp
new file mode 100644
index 0000000..1d6a497
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.
+ */
+
+#include "PlayRecordingCallback.h"
+
+/**
+ * Called when the stream is ready to process audio.
+ */
+oboe::DataCallbackResult PlayRecordingCallback::onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames) {
+ float *floatData = (float *)audioData;
+ int32_t framesRead = mRecording->read(floatData, numFrames);
+ // LOGI("%s() framesRead = %d, numFrames = %d", __func__, framesRead, numFrames);
+ return framesRead > 0
+ ? oboe::DataCallbackResult::Continue
+ : oboe::DataCallbackResult::Stop;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.h b/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.h
new file mode 100644
index 0000000..8ea49ea
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/PlayRecordingCallback.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 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 NATIVEOBOE_PLAY_RECORDING_CALLBACK_H
+#define NATIVEOBOE_PLAY_RECORDING_CALLBACK_H
+
+#include "oboe/Oboe.h"
+
+#include "MultiChannelRecording.h"
+
+class PlayRecordingCallback : public oboe::AudioStreamCallback {
+public:
+ PlayRecordingCallback() {}
+ ~PlayRecordingCallback() = default;
+
+ void setRecording(MultiChannelRecording *recording) {
+ mRecording = recording;
+ }
+
+ /**
+ * Called when the stream is ready to process audio.
+ */
+ oboe::DataCallbackResult onAudioReady(
+ oboe::AudioStream *audioStream,
+ void *audioData,
+ int numFrames);
+
+private:
+ MultiChannelRecording *mRecording = nullptr;
+};
+
+
+#endif //NATIVEOBOE_PLAYRECORDINGCALLBACK_H
diff --git a/apps/OboeTester/app/src/main/cpp/SawPingGenerator.cpp b/apps/OboeTester/app/src/main/cpp/SawPingGenerator.cpp
new file mode 100644
index 0000000..01f4dcf
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/SawPingGenerator.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2015 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.
+ */
+
+#include <unistd.h>
+#include "AudioProcessorBase.h"
+#include "SawPingGenerator.h"
+#include "oboe/Definitions.h"
+
+SawPingGenerator::SawPingGenerator()
+ : OscillatorBase()
+ , mRequestCount(0)
+ , mAcknowledgeCount(0)
+ , mLevel(0.0f) {
+}
+
+SawPingGenerator::~SawPingGenerator() { }
+
+
+AudioResult SawPingGenerator::onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+
+ frequency.pullData(framePosition, numFrames);
+ amplitude.pullData(framePosition, numFrames);
+
+ const float *frequencies = frequency.getFloatBuffer(numFrames);
+ const float *amplitudes = amplitude.getFloatBuffer(numFrames);
+ float *buffer = output.getFloatBuffer(numFrames);
+
+
+ if (mRequestCount.load() > mAcknowledgeCount.load()) {
+ mPhase = -1.0f;
+ mLevel = 1.0;
+ mAcknowledgeCount++;
+ }
+
+ // Check level to prevent numeric underflow.
+ if (mLevel > 0.000001) {
+ for (int i = 0; i < numFrames; i++) {
+ float sawtooth = incrementPhase(frequencies[i]);
+ *buffer++ = (float) (sawtooth * mLevel * amplitudes[i]);
+ mLevel *= 0.999;
+ }
+ } else {
+ for (int i = 0; i < numFrames; i++) {
+ *buffer++ = 0.0f;
+ }
+ }
+
+ return AUDIO_RESULT_SUCCESS;
+}
+
+void SawPingGenerator::setEnabled(bool enabled) {
+ if (enabled) {
+ mRequestCount++;
+ }
+}
+
diff --git a/apps/OboeTester/app/src/main/cpp/SawPingGenerator.h b/apps/OboeTester/app/src/main/cpp/SawPingGenerator.h
new file mode 100644
index 0000000..c51387e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/SawPingGenerator.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 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 NATIVEOBOE_SAWPINGGENERATOR_H
+#define NATIVEOBOE_SAWPINGGENERATOR_H
+
+#include <atomic>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "AudioProcessorBase.h"
+#include "OscillatorBase.h"
+
+class SawPingGenerator : public OscillatorBase {
+public:
+ SawPingGenerator();
+
+ virtual ~SawPingGenerator();
+
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) override;
+
+ void setEnabled(bool enabled);
+
+ void start() override {
+ OscillatorBase::start();
+ mAcknowledgeCount.store(mRequestCount.load());
+ }
+
+private:
+ std::atomic<int> mRequestCount; // external thread increments this to request a beep
+ std::atomic<int> mAcknowledgeCount; // audio thread sets this to acknowledge
+ double mLevel;
+};
+
+
+#endif //NATIVEOBOE_SAWPINGGENERATOR_H
diff --git a/apps/OboeTester/app/src/main/cpp/SineGenerator.cpp b/apps/OboeTester/app/src/main/cpp/SineGenerator.cpp
new file mode 100644
index 0000000..58c55c5
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/SineGenerator.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 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.
+ */
+
+#include <math.h>
+#include <unistd.h>
+
+#include "SineGenerator.h"
+
+SineGenerator::SineGenerator()
+ : OscillatorBase() {
+}
+
+AudioResult SineGenerator::onProcess(
+ uint64_t framePosition,
+ int numFrames) {
+
+ frequency.pullData(framePosition, numFrames);
+ amplitude.pullData(framePosition, numFrames);
+
+ const float *frequencies = frequency.getFloatBuffer(numFrames);
+ const float *amplitudes = amplitude.getFloatBuffer(numFrames);
+ float *buffer = output.getFloatBuffer(numFrames);
+
+ // Generate sine wave.
+ for (int i = 0; i < numFrames; i++) {
+ float phase = incrementPhase(frequencies[i]);
+ *buffer++ = sinf(phase) * amplitudes[i];
+ }
+
+ return AUDIO_RESULT_SUCCESS;
+}
diff --git a/apps/OboeTester/app/src/main/cpp/SineGenerator.h b/apps/OboeTester/app/src/main/cpp/SineGenerator.h
new file mode 100644
index 0000000..ca0f988
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/SineGenerator.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 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 NATIVEOBOE_SINEGENERATOR_H
+#define NATIVEOBOE_SINEGENERATOR_H
+
+#include <unistd.h>
+
+#include "OscillatorBase.h"
+
+class SineGenerator : public OscillatorBase {
+public:
+ SineGenerator();
+
+ AudioResult onProcess(
+ uint64_t framePosition,
+ int numFrames) override;
+};
+
+
+#endif //NATIVEOBOE_SINEGENERATOR_H
diff --git a/apps/OboeTester/app/src/main/cpp/android_debug.h b/apps/OboeTester/app/src/main/cpp/android_debug.h
new file mode 100644
index 0000000..ff8687a
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/android_debug.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 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_AUDIO_ANDROID_DEBUG_H_H
+#define NATIVE_AUDIO_ANDROID_DEBUG_H_H
+#include <android/log.h>
+
+#if 1
+
+#define MODULE_NAME "OboeAudio"
+#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, MODULE_NAME, __VA_ARGS__)
+#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, MODULE_NAME, __VA_ARGS__)
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, MODULE_NAME, __VA_ARGS__)
+#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, MODULE_NAME, __VA_ARGS__)
+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, MODULE_NAME, __VA_ARGS__)
+#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, MODULE_NAME, __VA_ARGS__)
+
+#else
+
+#define LOGV(...)
+#define LOGD(...)
+#define LOGI(...)
+#define LOGW(...)
+#define LOGE(...)
+#define LOGF(...)
+#endif
+
+#endif //NATIVE_AUDIO_ANDROID_DEBUG_H_H
diff --git a/apps/OboeTester/app/src/main/cpp/jni-bridge.cpp b/apps/OboeTester/app/src/main/cpp/jni-bridge.cpp
new file mode 100644
index 0000000..a47f31c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/cpp/jni-bridge.cpp
@@ -0,0 +1,395 @@
+/*
+ * Copyright 2015 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.
+ */
+
+#define MODULE_NAME "OboeTester"
+
+#include <cassert>
+#include <cstring>
+#include <jni.h>
+#include <stdint.h>
+#include <thread>
+
+#include "common/OboeDebug.h"
+#include "oboe/Oboe.h"
+
+#include "NativeAudioContext.h"
+
+static NativeAudioContext engine;
+
+/*********************************************************************************/
+/********************** JNI Prototypes *****************************************/
+/*********************************************************************************/
+extern "C" {
+
+// These must match order in strings.xml and in StreamConfiguration.java
+#define NATIVE_MODE_UNSPECIFIED 0
+#define NATIVE_MODE_OPENSLES 1
+#define NATIVE_MODE_AAUDIO 2
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_openNative(JNIEnv *env, jobject,
+ jint sampleRate,
+ jint channelCount,
+ jint format,
+ jint sharingMode,
+ jint performanceMode,
+ jint deviceId,
+ jint sessionId,
+ jint framesPerBurst,
+ jboolean isInput);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_close(JNIEnv *env, jobject);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_start(JNIEnv *env, jobject);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_pause(JNIEnv *env, jobject);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_stop(JNIEnv *env, jobject);
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setThresholdInFrames(JNIEnv *env, jobject, jint);
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getThresholdInFrames(JNIEnv *env, jobject);
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getBufferCapacityInFrames(JNIEnv *env, jobject);
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setNativeApi(JNIEnv *env, jobject, jint);
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setUseCallback(JNIEnv *env, jclass type,
+ jboolean useCallback);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setCallbackSize(JNIEnv *env, jclass type,
+ jint callbackSize);
+
+// ================= OboeAudioOutputStream ================================
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setToneEnabled(JNIEnv *env, jobject, jboolean);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setToneType(JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setAmplitude(JNIEnv *env, jobject, jdouble);
+
+/*********************************************************************************/
+/********************** JNI Implementations *************************************/
+/*********************************************************************************/
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_openNative(
+ JNIEnv *env, jobject synth,
+ jint sampleRate,
+ jint channelCount,
+ jint format,
+ jint sharingMode,
+ jint performanceMode,
+ jint deviceId,
+ jint sessionId,
+ jint framesPerBurst,
+ jboolean isInput) {
+ LOGD("OboeAudioStream_openNative: sampleRate = %d, framesPerBurst = %d", sampleRate, framesPerBurst);
+
+ return (jint) engine.open(sampleRate,
+ channelCount,
+ format,
+ sharingMode,
+ performanceMode,
+ deviceId,
+ sessionId,
+ framesPerBurst,
+ isInput);
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_startNative(JNIEnv *env, jobject) {
+ return (jint) engine.start();
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_pauseNative(JNIEnv *env, jobject) {
+ return (jint) engine.pause();
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_stopNative(JNIEnv *env, jobject) {
+ return (jint) engine.stop();
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_startPlaybackNative(JNIEnv *env, jobject) {
+ return (jint) engine.startPlayback();
+}
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_close(JNIEnv *env, jobject) {
+ engine.close();
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setBufferSizeInFrames(
+ JNIEnv *env, jobject, jint threshold) {
+ if (engine.oboeStream != nullptr) {
+ auto result = engine.oboeStream->setBufferSizeInFrames(threshold);
+ return (!result)
+ ? (jint) result.error()
+ : (jint) result.value();
+ }
+ return (jint) oboe::Result::ErrorNull;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getBufferSizeInFrames(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getBufferSizeInFrames();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getBufferCapacityInFrames(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getBufferCapacityInFrames();
+ }
+ return result;
+}
+
+static oboe::AudioApi convertNativeApiToAudioApi(int audioApi) {
+ switch (audioApi) {
+ default:
+ case NATIVE_MODE_UNSPECIFIED:
+ return oboe::AudioApi::Unspecified;
+ case NATIVE_MODE_AAUDIO:
+ return oboe::AudioApi::AAudio;
+ case NATIVE_MODE_OPENSLES:
+ return oboe::AudioApi::OpenSLES;
+ }
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setNativeApi(
+ JNIEnv *env, jobject, jint nativeApi) {
+ jint result = (jint) oboe::Result::OK;
+ LOGD("OboeAudioStream_setNativeApi(%d)", nativeApi);
+ switch (nativeApi) {
+ case NATIVE_MODE_UNSPECIFIED:
+ case NATIVE_MODE_AAUDIO:
+ case NATIVE_MODE_OPENSLES:
+ engine.setAudioApi(convertNativeApiToAudioApi(nativeApi));
+ break;
+ default:
+ result = (jint) oboe::Result::ErrorOutOfRange;
+ break;
+ }
+ return result;
+}
+
+static int convertAudioApiToNativeApi(oboe::AudioApi audioApi) {
+ switch(audioApi) {
+ case oboe::AudioApi::Unspecified:
+ return NATIVE_MODE_UNSPECIFIED;
+ case oboe::AudioApi::OpenSLES:
+ return NATIVE_MODE_OPENSLES;
+ case oboe::AudioApi::AAudio:
+ return NATIVE_MODE_AAUDIO;
+ default:
+ return -1;
+ }
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getNativeApi(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ oboe::AudioApi audioApi = engine.oboeStream->getAudioApi();
+ result = convertAudioApiToNativeApi(audioApi);
+ LOGD("OboeAudioStream_getNativeApi got %d", result);
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getSampleRate(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getSampleRate();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getSharingMode(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = (jint) engine.oboeStream->getSharingMode();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getPerformanceMode(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = (jint) engine.oboeStream->getPerformanceMode();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getFramesPerBurst(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getFramesPerBurst();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getChannelCount(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getChannelCount();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getFormat(JNIEnv *env, jobject instance) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = (jint) engine.oboeStream->getFormat();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getDeviceId(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getDeviceId();
+ }
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getSessionId(
+ JNIEnv *env, jobject) {
+ jint result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getSessionId();
+ }
+ return result;
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getFramesWritten(
+ JNIEnv *env, jobject) {
+ jlong result = (jint) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getFramesWritten();
+ }
+ return result;
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getFramesRead(
+ JNIEnv *env, jobject) {
+ jlong result = (jlong) oboe::Result::ErrorNull;
+ if (engine.oboeStream != nullptr) {
+ result = engine.oboeStream->getFramesRead();
+ }
+ return result;
+}
+
+JNIEXPORT jdouble JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getLatency(JNIEnv *env, jobject instance) {
+ if (engine.oboeStream != nullptr) {
+ auto result = engine.oboeStream->calculateLatencyMillis();
+ return (!result) ? -1.0 : result.value();
+ }
+ return -1.0;
+}
+
+JNIEXPORT jint JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_getState(JNIEnv *env, jobject instance) {
+ if (engine.oboeStream != nullptr) {
+ auto state = engine.oboeStream->getState();
+ if (state != oboe::StreamState::Starting && state != oboe::StreamState::Started) {
+ oboe::Result result = engine.oboeStream->waitForStateChange(
+ oboe::StreamState::Uninitialized,
+ &state, 0);
+ if (result != oboe::Result::OK) state = oboe::StreamState::Unknown;
+ }
+ return (jint) state;
+ }
+ return -1;
+}
+
+JNIEXPORT jdouble JNICALL
+Java_com_google_sample_oboe_manualtest_AudioInputTester_getPeakLevel(JNIEnv *env,
+ jobject instance,
+ jint index) {
+ return engine.mInputAnalyzer.getPeakLevel(index);
+}
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setUseCallback(JNIEnv *env, jclass type,
+ jboolean useCallback) {
+ engine.useCallback = useCallback;
+
+}
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_setCallbackSize(JNIEnv *env, jclass type,
+ jint callbackSize) {
+ engine.callbackSize = callbackSize;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioStream_isMMap(JNIEnv *env, jobject instance) {
+ return engine.mIsMMapUsed;
+}
+
+// ================= OboeAudioOutputStream ================================
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setToneEnabled(
+ JNIEnv *env, jobject, jboolean enabled) {
+ engine.setToneEnabled(enabled);
+}
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setToneType(
+ JNIEnv *env, jobject, jint toneType) {
+ engine.setToneType(toneType);
+}
+
+JNIEXPORT void JNICALL
+Java_com_google_sample_oboe_manualtest_OboeAudioOutputStream_setAmplitude(
+ JNIEnv *env, jobject, jdouble amplitude) {
+ engine.setAmplitude(amplitude);
+
+}
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceAdapter.java b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceAdapter.java
new file mode 100644
index 0000000..9fa0093
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceAdapter.java
@@ -0,0 +1,58 @@
+package com.google.sample.audio_device;
+/*
+ * Copyright 2017 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.
+ */
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * Provides views for a list of audio devices. Usually used as an Adapter for a Spinner or ListView.
+ */
+public class AudioDeviceAdapter extends ArrayAdapter<AudioDeviceListEntry> {
+
+ public AudioDeviceAdapter(Context context) {
+ super(context, R.layout.audio_devices);
+ }
+
+ @NonNull
+ @Override
+ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
+ return getDropDownView(position, convertView, parent);
+ }
+
+ @Override
+ public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
+ View rowView = convertView;
+ if (rowView == null) {
+ LayoutInflater inflater = LayoutInflater.from(parent.getContext());
+ rowView = inflater.inflate(R.layout.audio_devices, parent, false);
+ }
+
+ TextView deviceName = (TextView) rowView.findViewById(R.id.device_name);
+ AudioDeviceListEntry deviceInfo = getItem(position);
+ deviceName.setText(deviceInfo.getName());
+
+ return rowView;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceInfoConverter.java b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceInfoConverter.java
new file mode 100644
index 0000000..5d05395
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceInfoConverter.java
@@ -0,0 +1,140 @@
+package com.google.sample.audio_device;
+/*
+ * Copyright 2017 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.
+ */
+
+import android.media.AudioDeviceInfo;
+
+class AudioDeviceInfoConverter {
+
+ /**
+ * Converts an {@link AudioDeviceInfo} object into a human readable representation
+ *
+ * @param adi The AudioDeviceInfo object to be converted to a String
+ * @return String containing all the information from the AudioDeviceInfo object
+ */
+ static String toString(AudioDeviceInfo adi){
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("Id: ");
+ sb.append(adi.getId());
+
+ sb.append("\nProduct name: ");
+ sb.append(adi.getProductName());
+
+ sb.append("\nType: ");
+ sb.append(typeToString(adi.getType()));
+
+ sb.append("\nIs source: ");
+ sb.append((adi.isSource() ? "Yes" : "No"));
+
+ sb.append("\nIs sink: ");
+ sb.append((adi.isSink() ? "Yes" : "No"));
+
+ sb.append("\nChannel counts: ");
+ int[] channelCounts = adi.getChannelCounts();
+ sb.append(intArrayToString(channelCounts));
+
+ sb.append("\nChannel masks: ");
+ int[] channelMasks = adi.getChannelMasks();
+ sb.append(intArrayToString(channelMasks));
+
+ sb.append("\nChannel index masks: ");
+ int[] channelIndexMasks = adi.getChannelIndexMasks();
+ sb.append(intArrayToString(channelIndexMasks));
+
+ sb.append("\nEncodings: ");
+ int[] encodings = adi.getEncodings();
+ sb.append(intArrayToString(encodings));
+
+ sb.append("\nSample Rates: ");
+ int[] sampleRates = adi.getSampleRates();
+ sb.append(intArrayToString(sampleRates));
+
+ return sb.toString();
+ }
+
+ /**
+ * Converts an integer array into a string where each int is separated by a space
+ *
+ * @param integerArray the integer array to convert to a string
+ * @return string containing all the integer values separated by spaces
+ */
+ private static String intArrayToString(int[] integerArray){
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < integerArray.length; i++){
+ sb.append(integerArray[i]);
+ if (i != integerArray.length -1) sb.append(" ");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Converts the value from {@link AudioDeviceInfo#getType()} into a human
+ * readable string
+ * @param type One of the {@link AudioDeviceInfo}.TYPE_* values
+ * e.g. AudioDeviceInfo.TYPE_BUILT_IN_SPEAKER
+ * @return string which describes the type of audio device
+ */
+ static String typeToString(int type){
+ switch (type) {
+ case AudioDeviceInfo.TYPE_AUX_LINE:
+ return "auxiliary line-level connectors";
+ case AudioDeviceInfo.TYPE_BLUETOOTH_A2DP:
+ return "Bluetooth device supporting the A2DP profile";
+ case AudioDeviceInfo.TYPE_BLUETOOTH_SCO:
+ return "Bluetooth device typically used for telephony";
+ case AudioDeviceInfo.TYPE_BUILTIN_EARPIECE:
+ return "built-in earphone speaker";
+ case AudioDeviceInfo.TYPE_BUILTIN_MIC:
+ return "built-in microphone";
+ case AudioDeviceInfo.TYPE_BUILTIN_SPEAKER:
+ return "built-in speaker";
+ case AudioDeviceInfo.TYPE_BUS:
+ return "BUS";
+ case AudioDeviceInfo.TYPE_DOCK:
+ return "DOCK";
+ case AudioDeviceInfo.TYPE_FM:
+ return "FM";
+ case AudioDeviceInfo.TYPE_FM_TUNER:
+ return "FM tuner";
+ case AudioDeviceInfo.TYPE_HDMI:
+ return "HDMI";
+ case AudioDeviceInfo.TYPE_HDMI_ARC:
+ return "HDMI audio return channel";
+ case AudioDeviceInfo.TYPE_IP:
+ return "IP";
+ case AudioDeviceInfo.TYPE_LINE_ANALOG:
+ return "line analog";
+ case AudioDeviceInfo.TYPE_LINE_DIGITAL:
+ return "line digital";
+ case AudioDeviceInfo.TYPE_TELEPHONY:
+ return "telephony";
+ case AudioDeviceInfo.TYPE_TV_TUNER:
+ return "TV tuner";
+ case AudioDeviceInfo.TYPE_USB_ACCESSORY:
+ return "USB accessory";
+ case AudioDeviceInfo.TYPE_USB_DEVICE:
+ return "USB device";
+ case AudioDeviceInfo.TYPE_WIRED_HEADPHONES:
+ return "wired headphones";
+ case AudioDeviceInfo.TYPE_WIRED_HEADSET:
+ return "wired headset";
+ default:
+ case AudioDeviceInfo.TYPE_UNKNOWN:
+ return "unknown";
+ }
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceListEntry.java b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceListEntry.java
new file mode 100644
index 0000000..15f3e23
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceListEntry.java
@@ -0,0 +1,93 @@
+package com.google.sample.audio_device;
+/*
+ * Copyright 2017 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.
+ */
+
+import android.annotation.TargetApi;
+import android.media.AudioDeviceInfo;
+import android.media.AudioManager;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * POJO which represents basic information for an audio device.
+ *
+ * Example: id: 8, deviceName: "built-in speaker"
+ */
+public class AudioDeviceListEntry {
+
+ private int mId;
+ private String mName;
+
+ public AudioDeviceListEntry(int deviceId, String deviceName){
+ mId = deviceId;
+ mName = deviceName;
+ }
+
+ public int getId() {
+ return mId;
+ }
+
+ public String getName(){
+ return mName;
+ }
+
+ public String toString(){
+ return getName();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ AudioDeviceListEntry that = (AudioDeviceListEntry) o;
+
+ if (mId != that.mId) return false;
+ return mName != null ? mName.equals(that.mName) : that.mName == null;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = mId;
+ result = 31 * result + (mName != null ? mName.hashCode() : 0);
+ return result;
+ }
+
+ /**
+ * Create a list of AudioDeviceListEntry objects from a list of AudioDeviceInfo objects.
+ *
+ * @param devices A list of {@Link AudioDeviceInfo} objects
+ * @param directionType Only audio devices with this direction will be included in the list.
+ * Valid values are GET_DEVICES_ALL, GET_DEVICES_OUTPUTS and
+ * GET_DEVICES_INPUTS.
+ * @return A list of AudioDeviceListEntry objects
+ */
+ @TargetApi(23)
+ static List<AudioDeviceListEntry> createListFrom(AudioDeviceInfo[] devices, int directionType){
+
+ List<AudioDeviceListEntry> listEntries = new Vector<>();
+ for (AudioDeviceInfo info : devices) {
+ if (directionType == AudioManager.GET_DEVICES_ALL ||
+ (directionType == AudioManager.GET_DEVICES_OUTPUTS && info.isSink()) ||
+ (directionType == AudioManager.GET_DEVICES_INPUTS && info.isSource())) {
+ listEntries.add(new AudioDeviceListEntry(info.getId(), info.getProductName() + " " +
+ AudioDeviceInfoConverter.typeToString(info.getType())));
+ }
+ }
+ return listEntries;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceSpinner.java b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceSpinner.java
new file mode 100644
index 0000000..3dcdc08
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/audio_device/AudioDeviceSpinner.java
@@ -0,0 +1,127 @@
+package com.google.sample.audio_device;
+/*
+ * Copyright 2017 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.
+ */
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.res.Resources.Theme;
+import android.media.AudioDeviceCallback;
+import android.media.AudioDeviceInfo;
+import android.media.AudioManager;
+import android.util.AttributeSet;
+import android.widget.Spinner;
+
+import com.google.sample.oboe.manualtest.R;
+
+import java.util.List;
+
+public class AudioDeviceSpinner extends Spinner {
+
+ private static final int AUTO_SELECT_DEVICE_ID = 0;
+ private static final String TAG = AudioDeviceSpinner.class.getName();
+ private int mDirectionType;
+ private AudioDeviceAdapter mDeviceAdapter;
+ private AudioManager mAudioManager;
+ private Context mContext;
+
+ public AudioDeviceSpinner(Context context){
+ super(context);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, int mode){
+ super(context, mode);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, AttributeSet attrs){
+ super(context, attrs);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, AttributeSet attrs, int defStyleAttr){
+ super(context, attrs, defStyleAttr);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, AttributeSet attrs, int defStyleAttr, int mode){
+ super(context, attrs, defStyleAttr, mode);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes, int mode){
+ super(context, attrs, defStyleAttr, defStyleRes, mode);
+ setup(context);
+ }
+
+ public AudioDeviceSpinner(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes, int mode, Theme popupTheme){
+ super(context, attrs, defStyleAttr, defStyleRes, mode, popupTheme);
+ setup(context);
+ }
+
+ private void setup(Context context){
+ mContext = context;
+
+ mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+
+ mDeviceAdapter = new AudioDeviceAdapter(context);
+ setAdapter(mDeviceAdapter);
+
+ // Add a default entry to the list and select it
+ mDeviceAdapter.add(new AudioDeviceListEntry(AUTO_SELECT_DEVICE_ID,
+ mContext.getString(R.string.auto_select)));
+ setSelection(0);
+
+ }
+
+ @TargetApi(23)
+ public void setDirectionType(int directionType){
+ this.mDirectionType = directionType;
+ setupAudioDeviceCallback();
+ }
+
+ @TargetApi(23)
+ private void setupAudioDeviceCallback(){
+
+ // Note that we will immediately receive a call to onDevicesAdded with the list of
+ // devices which are currently connected.
+ mAudioManager.registerAudioDeviceCallback(new AudioDeviceCallback() {
+ @Override
+ public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
+ List<AudioDeviceListEntry> deviceList =
+ AudioDeviceListEntry.createListFrom(addedDevices, mDirectionType);
+ if (deviceList.size() > 0){
+ // Prevent duplicate entries caused by b/80138804
+ for (AudioDeviceListEntry entry : deviceList){
+ mDeviceAdapter.remove(entry);
+ }
+ mDeviceAdapter.addAll(deviceList);
+ }
+ }
+
+ public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
+ List<AudioDeviceListEntry> deviceList =
+ AudioDeviceListEntry.createListFrom(removedDevices, mDirectionType);
+ for (AudioDeviceListEntry entry : deviceList){
+ mDeviceAdapter.remove(entry);
+ }
+ setSelection(0);
+ }
+ }, null);
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioInputTester.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioInputTester.java
new file mode 100644
index 0000000..6343b97
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioInputTester.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.util.Log;
+
+class AudioInputTester extends AudioStreamTester{
+ private static AudioInputTester mInstance;
+
+ private AudioInputTester() {
+ super();
+ Log.i(TapToToneActivity.TAG, "create OboeAudioStream ---------");
+
+ mCurrentAudioStream = new OboeAudioInputStream();
+ }
+
+ public static synchronized AudioInputTester getInstance() {
+ if (mInstance == null) {
+ mInstance = new AudioInputTester();
+ }
+ return mInstance;
+ }
+
+ public native double getPeakLevel(int i);
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioMidiTester.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioMidiTester.java
new file mode 100644
index 0000000..b13142b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioMidiTester.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2015 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.
+ */
+package com.google.sample.oboe.manualtest;
+
+
+import android.media.midi.MidiDeviceService;
+import android.media.midi.MidiReceiver;
+import android.util.Log;
+
+import com.mobileer.miditools.MidiConstants;
+import com.mobileer.miditools.MidiFramer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * Measure the latency of various output paths by playing a blip.
+ * Report the results back to the TestListeners.
+ */
+public class AudioMidiTester extends MidiDeviceService {
+
+ private static final float MAX_TOUCH_LATENCY = 0.200f;
+ private static final float MAX_OUTPUT_LATENCY = 0.600f;
+ private static final float ANALYSIS_TIME_MARGIN = 0.250f;
+
+ private static final float ANALYSIS_TIME_DELAY = MAX_OUTPUT_LATENCY;
+ private static final float ANALYSIS_TIME_TOTAL = MAX_TOUCH_LATENCY + MAX_OUTPUT_LATENCY;
+ private static final float ANALYSIS_TIME_MAX = ANALYSIS_TIME_TOTAL + ANALYSIS_TIME_MARGIN;
+ private static final int ANALYSIS_SAMPLE_RATE = 48000; // need not match output rate
+
+ private ArrayList<TestListener> mListeners = new ArrayList<TestListener>();
+ private MyMidiReceiver mReceiver = new MyMidiReceiver();
+ private MidiFramer mMidiFramer = new MidiFramer(mReceiver);
+ private boolean mRecordEnabled = true;
+
+ private static AudioMidiTester mInstance;
+ private AudioRecordThread mRecorder;
+ private TapLatencyAnalyser mTapLatencyAnalyser;
+
+ private AudioOutputTester mAudioOutputTester;
+
+ public static class TestResult {
+ public float[] samples;
+ public float[] filtered;
+ public int frameRate;
+ public TapLatencyAnalyser.TapLatencyEvent[] events;
+ }
+
+ public static interface TestListener {
+ public void onTestFinished(TestResult result);
+
+ public void onNoteOn(int pitch);
+ }
+
+ /**
+ * This is a Service so it is only created when a client requests the service.
+ */
+ public AudioMidiTester() {
+ mInstance = this;
+ }
+
+ public void addTestListener(TestListener listener) {
+ mListeners.add(listener);
+ }
+
+ public void removeTestListener(TestListener listener) {
+ mListeners.remove(listener);
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ if (mRecordEnabled) {
+ mRecorder = new AudioRecordThread(ANALYSIS_SAMPLE_RATE,
+ 1,
+ (int) (ANALYSIS_TIME_MAX * ANALYSIS_SAMPLE_RATE));
+ }
+
+ mAudioOutputTester = AudioOutputTester.getInstance();
+
+ mTapLatencyAnalyser = new TapLatencyAnalyser();
+ }
+
+ @Override
+ public void onDestroy() {
+ // do stuff here
+ super.onDestroy();
+ }
+
+ public static AudioMidiTester getInstance() {
+ return mInstance;
+ }
+
+ class MyMidiReceiver extends MidiReceiver {
+ public void onSend(byte[] data, int offset,
+ int count, long timestamp) throws IOException {
+ // parse MIDI
+ byte command = (byte) (data[0] & 0x0F0);
+ if (command == MidiConstants.STATUS_NOTE_ON) {
+ if (data[2] == 0) {
+ noteOff(data[1]);
+ } else {
+ noteOn(data[1]);
+ }
+ } else if (command == MidiConstants.STATUS_NOTE_OFF) {
+ noteOff(data[1]);
+ }
+ Log.i(TapToToneActivity.TAG, "MIDI command = " + command);
+ }
+ }
+
+ private void noteOn(byte b) {
+ setEnabled(true);
+ fireNoteOn(b);
+ }
+
+ private void fireNoteOn(byte pitch) {
+ for (TestListener listener : mListeners) {
+ listener.onNoteOn(pitch);
+ }
+ }
+
+ private void noteOff(byte b) {
+ setEnabled(false);
+ }
+
+ @Override
+ public MidiReceiver[] onGetInputPortReceivers() {
+ return new MidiReceiver[]{mMidiFramer};
+ }
+
+
+ public void start() throws IOException {
+ if (mRecordEnabled) {
+ mRecorder.startAudio();
+ }
+ }
+
+ public void setEnabled(boolean checked) {
+ mAudioOutputTester.setEnabled(checked);
+ if (checked && mRecordEnabled) {
+ // schedule an analysis to start in the near future
+ int numSamples = (int) (mRecorder.getSampleRate() * ANALYSIS_TIME_DELAY);
+ Runnable task = new Runnable() {
+ public void run() {
+ new Thread() {
+ public void run() {
+ analyzeCapturedAudio();
+ }
+ }.start();
+ }
+ };
+
+ mRecorder.scheduleTask(numSamples, task);
+ }
+ }
+
+ private void analyzeCapturedAudio() {
+ if (!mRecordEnabled) return;
+ int numSamples = (int) (mRecorder.getSampleRate() * ANALYSIS_TIME_TOTAL);
+ float[] buffer = new float[numSamples];
+ mRecorder.setCaptureEnabled(false); // TODO wait for it to settle
+ int numRead = mRecorder.readMostRecent(buffer);
+
+ TestResult result = new TestResult();
+ result.samples = buffer;
+ result.frameRate = mRecorder.getSampleRate();
+ result.events = mTapLatencyAnalyser.analyze(buffer, 0, numRead);
+ result.filtered = mTapLatencyAnalyser.getFilteredBuffer();
+ mRecorder.setCaptureEnabled(true);
+ // notify listeners
+ for (TestListener listener : mListeners) {
+ listener.onTestFinished(result);
+ }
+ }
+
+
+ public void stop() {
+ if (mRecordEnabled) {
+ mRecorder.stopAudio();
+ }
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioOutputTester.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioOutputTester.java
new file mode 100644
index 0000000..4ac3cde
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioOutputTester.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.util.Log;
+
+public class AudioOutputTester extends AudioStreamTester {
+
+ protected OboeAudioOutputStream mOboeAudioOutputStream;
+
+ private static AudioOutputTester mInstance;
+
+ public static synchronized AudioOutputTester getInstance() {
+ if (mInstance == null) {
+ mInstance = new AudioOutputTester();
+ }
+ return mInstance;
+ }
+
+ private AudioOutputTester() {
+ super();
+ Log.i(TapToToneActivity.TAG, "create OboeAudioOutputStream ---------");
+ mOboeAudioOutputStream = new OboeAudioOutputStream();
+ mCurrentAudioStream = mOboeAudioOutputStream;
+ setToneType(OboeAudioOutputStream.TONE_TYPE_SINE_STEADY);
+ setEnabled(false);
+ }
+
+ public void setToneType(int index) {
+ mOboeAudioOutputStream.setToneType(index);
+ }
+
+ public void setEnabled(boolean flag) {
+ mOboeAudioOutputStream.setToneEnabled(flag);
+ }
+
+ public void setNormalizedThreshold(double threshold) {
+ if (mCurrentAudioStream.isThresholdSupported()) {
+ int frames = (int) (threshold * mCurrentAudioStream.getBufferCapacityInFrames());
+ Log.i(TapToToneActivity.TAG, mCurrentAudioStream.getClass().getSimpleName()
+ + ".setBufferSizeInFrames(" + frames + ")");
+ mCurrentAudioStream.setBufferSizeInFrames(frames);
+ }
+ }
+
+ public void setAmplitude(double amplitude) {
+ mCurrentAudioStream.setAmplitude(amplitude);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioRecordThread.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioRecordThread.java
new file mode 100644
index 0000000..5c7bff0
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioRecordThread.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+
+import android.media.AudioFormat;
+import android.media.AudioRecord;
+import android.media.MediaRecorder;
+
+/**
+ * Abstract class for recording.
+ * Call processBuffer(buffer) when data is read.
+ */
+class AudioRecordThread implements Runnable {
+ private static final String TAG = "AudioRecordThread";
+
+ private final int mSampleRate;
+ private final int mChannelCount;
+ private Thread mThread;
+ protected boolean mGo;
+ private AudioRecord mRecorder;
+ private CircularCaptureBuffer mCaptureBuffer;
+ protected float[] mBuffer = new float[256];
+ private static int AUDIO_FORMAT = AudioFormat.ENCODING_PCM_FLOAT;
+ private Runnable mTask;
+ private int mTaskCountdown;
+ private boolean mCaptureEnabled = true;
+
+ public AudioRecordThread(int frameRate, int channelCount, int maxFrames) {
+ mSampleRate = frameRate;
+ mChannelCount = channelCount;
+ mCaptureBuffer = new CircularCaptureBuffer(maxFrames);
+ }
+
+ private void createRecorder() {
+ int channelConfig = (mChannelCount == 1)
+ ? AudioFormat.CHANNEL_IN_MONO : AudioFormat.CHANNEL_IN_STEREO;
+ int audioFormat = AudioFormat.ENCODING_PCM_FLOAT;
+ int minRecordBuffSizeInBytes = AudioRecord.getMinBufferSize(mSampleRate,
+ channelConfig,
+ audioFormat);
+ mRecorder = new AudioRecord(
+ MediaRecorder.AudioSource.VOICE_RECOGNITION,
+ mSampleRate,
+ channelConfig,
+ audioFormat,
+ 2 * minRecordBuffSizeInBytes);
+ if (mRecorder.getState() == AudioRecord.STATE_UNINITIALIZED) {
+ throw new RuntimeException("Could not make the AudioRecord - UNINITIALIZED");
+ }
+ }
+
+ @Override
+ public void run() {
+ startAudioRecording();
+
+ while (mGo) {
+ int result = handleAudioPeriod();
+ if (result < 0) {
+ mGo = false;
+ }
+ }
+
+ stopAudioRecording();
+ }
+
+ public void startAudio() {
+ if (mThread == null) {
+ mGo = true;
+ mThread = new Thread(this);
+ mThread.start();
+ }
+ }
+
+ public void stopAudio() {
+ mGo = false;
+ if (mThread != null) {
+ try {
+ mThread.join(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ mThread = null;
+ }
+ }
+
+ public int getSampleRate() {
+ return mSampleRate;
+ }
+
+ /**
+ * @return number of samples read or negative error
+ */
+ private int handleAudioPeriod() {
+ int numSamplesRead = mRecorder.read(mBuffer, 0, mBuffer.length,
+ AudioRecord.READ_BLOCKING);
+ if (numSamplesRead <= 0) {
+ return numSamplesRead;
+ } else {
+ if (mTaskCountdown > 0) {
+ mTaskCountdown -= numSamplesRead;
+ if (mTaskCountdown <= 0) {
+ mTaskCountdown = 0;
+ new Thread(mTask).start(); // run asynchronously with audio thread
+ }
+ }
+ if (mCaptureEnabled) {
+ return mCaptureBuffer.write(mBuffer, 0, numSamplesRead);
+ } else {
+ return numSamplesRead;
+ }
+ }
+ }
+
+ private void startAudioRecording() {
+ stopAudioRecording();
+ createRecorder();
+ mRecorder.startRecording();
+ }
+
+ private void stopAudioRecording() {
+ if (mRecorder != null) {
+ mRecorder.stop();
+ mRecorder.release();
+ mRecorder = null;
+ }
+ }
+
+ public void scheduleTask(int numSamples, Runnable task) {
+ mTask = task;
+ mTaskCountdown = numSamples;
+ }
+
+ public void setCaptureEnabled(boolean captureEnabled) {
+ mCaptureEnabled = captureEnabled;
+ }
+
+ public int readMostRecent(float[] buffer) {
+ return mCaptureBuffer.readMostRecent(buffer);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamBase.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamBase.java
new file mode 100644
index 0000000..8bcfd6e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamBase.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2015 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import java.io.IOException;
+
+/**
+ * Base class for any audio input or output.
+ */
+public abstract class AudioStreamBase {
+
+ private StreamConfiguration mRequestedStreamConfiguration;
+ private StreamConfiguration mActualStreamConfiguration;
+
+ private int mBufferSizeInFrames;
+
+ public StreamStatus getStreamStatus() {
+ StreamStatus status = new StreamStatus();
+ status.bufferSize = getBufferSizeInFrames();
+ status.xRunCount = getUnderrunCount();
+ status.framesRead = getFramesRead();
+ status.framesWritten = getFramesWritten();
+ status.latency = getLatency();
+ status.state = getState();
+ return status;
+ }
+
+ /**
+ * Changes dynamic at run-time.
+ */
+ public static class StreamStatus {
+ public int bufferSize;
+ public int xRunCount;
+ public long framesWritten;
+ public long framesRead;
+ public double latency; // msec
+ public int state;
+ }
+
+ public void open(StreamConfiguration requestedConfiguration,
+ StreamConfiguration actualConfiguration,
+ int bufferSizeInFrames) throws IOException {
+ mRequestedStreamConfiguration = requestedConfiguration;
+ mActualStreamConfiguration = actualConfiguration;
+ mBufferSizeInFrames = bufferSizeInFrames;
+ }
+
+ public abstract boolean isInput();
+
+ public abstract void start() throws IOException;
+
+ public abstract void pause() throws IOException;
+
+ public abstract void stop() throws IOException;
+
+ public void startPlayback() throws IOException {}
+
+ public void stopPlayback() throws IOException {}
+
+ public abstract int write(float[] buffer, int offset, int length);
+
+ public abstract void close();
+
+ public int getChannelCount() {
+ return mActualStreamConfiguration.getChannelCount();
+ }
+
+ public int getFramesPerBurst() {
+ return mActualStreamConfiguration.getFramesPerBurst();
+ }
+
+ public int getBufferCapacityInFrames() {
+ return mBufferSizeInFrames;
+ }
+
+ public int getBufferSizeInFrames() {
+ return mBufferSizeInFrames;
+ }
+
+ public int setBufferSizeInFrames(int bufferSize) {
+ throw new UnsupportedOperationException("bufferSize cannot be changed");
+ }
+
+ public long getFramesWritten() { return -1; }
+
+ public long getFramesRead() { return -1; }
+
+ public double getLatency() { return -1.0; }
+
+ public int getState() { return -1; }
+
+ public boolean isThresholdSupported() {
+ return false;
+ }
+
+// public boolean isLowLatencySupported() {
+// return false;
+// }
+
+ public void setAmplitude(double amplitude) {}
+
+ public int getUnderrunCount() {
+ return 0;
+ }
+
+// public boolean isUnderrunCountSupported() {
+// return false;
+// }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamTester.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamTester.java
new file mode 100644
index 0000000..d4edc97
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/AudioStreamTester.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import java.io.IOException;
+
+class AudioStreamTester {
+ protected AudioStreamBase mCurrentAudioStream;
+
+ AudioStreamBase getCurrentAudioStream() {
+ return mCurrentAudioStream;
+ }
+
+ public void open(StreamConfiguration requestedConfiguration,
+ StreamConfiguration actualConfiguration) throws IOException {
+ mCurrentAudioStream.open(requestedConfiguration, actualConfiguration,
+ -1);
+ }
+
+ public void start() throws IOException {
+ mCurrentAudioStream.start();
+ }
+
+ public void stop() throws IOException {
+ mCurrentAudioStream.stop();
+ }
+
+ public void pause() throws IOException {
+ mCurrentAudioStream.pause();
+ }
+
+ public void close() {
+ mCurrentAudioStream.close();
+ }
+
+ public void startPlayback() throws IOException {
+ mCurrentAudioStream.startPlayback();
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/CircularCaptureBuffer.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/CircularCaptureBuffer.java
new file mode 100644
index 0000000..bcc2d47
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/CircularCaptureBuffer.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+
+/**
+ * Circular buffer for continuously capturing audio then reading the previous N samples.
+ * Can hold from zero to max frames.
+ */
+public class CircularCaptureBuffer {
+
+ private float[] mData;
+ private int mCursor;
+ private int mNumValidSamples;
+
+ public CircularCaptureBuffer(int maxSamples) {
+ mData = new float[maxSamples];
+ }
+
+ public int write(float[] buffer) {
+ return write(buffer, 0, buffer.length);
+ }
+
+ public int write(float[] buffer, int offset, int numSamples) {
+ if (numSamples > mData.length) {
+ throw new IllegalArgumentException("Tried to write more than maxSamples.");
+ }
+ if ((mCursor + numSamples) > mData.length) {
+ // Wraps so write in two parts.
+ int numWrite1 = mData.length - mCursor;
+ System.arraycopy(buffer, offset, mData, mCursor, numWrite1);
+ offset += numWrite1;
+ int numWrite2 = numSamples - numWrite1;
+ System.arraycopy(buffer, offset, mData, 0, numWrite2);
+ mCursor = numWrite2;
+ } else {
+ System.arraycopy(buffer, offset, mData, mCursor, numSamples);
+ mCursor += numSamples;
+ if (mCursor == mData.length) {
+ mCursor = 0;
+ }
+ }
+ mNumValidSamples += numSamples;
+ if (mNumValidSamples > mData.length) {
+ mNumValidSamples = mData.length;
+ }
+ return numSamples;
+ }
+
+ public int readMostRecent(float[] buffer) {
+ return readMostRecent(buffer, 0, buffer.length);
+ }
+
+ /**
+ * Read the most recently written samples.
+ * @param buffer
+ * @param offset
+ * @param numSamples
+ * @return number of samples read
+ */
+ public int readMostRecent(float[] buffer, int offset, int numSamples) {
+
+ if (numSamples > mNumValidSamples) {
+ numSamples = mNumValidSamples;
+ }
+ int cursor = mCursor; // read once in case it gets updated by another thread
+ // Read in two parts.
+ if ((cursor - numSamples) < 0) {
+ int numRead1 = numSamples - cursor;
+ System.arraycopy(mData, mData.length - numRead1, buffer, offset, numRead1);
+ offset += numRead1;
+ int numRead2 = cursor;
+ System.arraycopy(mData, 0, buffer, offset, numRead2);
+ } else {
+ System.arraycopy(mData, cursor - numSamples, buffer, offset, numSamples);
+ }
+
+ return numSamples;
+ }
+
+ public void erase() {
+ mNumValidSamples = 0;
+ mCursor = 0;
+ }
+
+ public int getSize() {
+ return mData.length;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ExponentialTaper.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ExponentialTaper.java
new file mode 100644
index 0000000..ef36d21
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/ExponentialTaper.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+/**
+ * Maps integer range info to a double value along an exponential scale.
+ *
+ * <pre>
+ *
+ * x = ival / mResolution
+ * f(x) = a*(root**bx)
+ * f(0.0) = dmin
+ * f(1.0) = dmax
+ *
+ * f(0.0) = a * 1.0 => a = dmin
+ * f(1.0) = dmin * root**b = dmax
+ * b = log(dmax / dmin) / log(root)
+ *
+ * </pre>
+ */
+
+public class ExponentialTaper {
+ private int mResolution;
+ private double a = 1.0;
+ private double b = 2.0;
+ private double dmin = 1.0;
+ private double dmax = 100.0;
+ private double ROOT = 10.0;
+
+ public ExponentialTaper(int res, double dmin, double dmax) {
+ this.mResolution = res;
+ this.dmin = dmin;
+ this.dmax = dmax;
+ updateCoefficients();
+ }
+
+ private void updateCoefficients() {
+ a = dmin;
+ b = Math.log10(dmax / dmin);
+ }
+
+ public double linearToExponential(int ival) {
+ double x = (double) ival / mResolution;
+ double y = a * Math.pow(ROOT, b * x);
+ return y;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/FastButton.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/FastButton.java
new file mode 100644
index 0000000..7abda73
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/FastButton.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2015 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+import android.text.TextPaint;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * Button-like View that responds quickly to touch events.
+ */
+public class FastButton extends TextView {
+
+ public FastButton(Context context) {
+ super(context);
+ }
+
+ public FastButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public FastButton(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ private ArrayList<FastButtonListener> mListeners = new ArrayList<FastButtonListener>();
+
+ /**
+ * Implement this to receive keyboard events.
+ */
+ public interface FastButtonListener {
+ /**
+ * This will be called when a key is pressed.
+ */
+ public void onKeyDown(int id);
+
+ /**
+ * This will be called when a key is pressed.
+ */
+ public void onKeyUp(int id);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ super.onTouchEvent(event);
+ int action = event.getActionMasked();
+ // Track individual fingers.
+ int pointerIndex = event.getActionIndex();
+ int id = event.getPointerId(pointerIndex);
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ fireKeyDown(id);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_POINTER_UP:
+ fireKeyUp(id);
+ break;
+ }
+ // Must return true or we do not get the ACTION_MOVE and
+ // ACTION_UP events.
+ return true;
+ }
+
+ private void fireKeyDown(int id) {
+ for (FastButtonListener listener : mListeners) {
+ listener.onKeyDown(id);
+ }
+ invalidate();
+ }
+
+ private void fireKeyUp(int id) {
+ for (FastButtonListener listener : mListeners) {
+ listener.onKeyUp(id);
+ }
+ invalidate();
+ }
+
+ public void addFastButtonListener(FastButtonListener listener) {
+ mListeners.add(listener);
+ }
+
+ public void removeFastButtonListener(FastButtonListener listener) {
+ mListeners.remove(listener);
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java
new file mode 100644
index 0000000..8cf7b3b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.media.AudioManager;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.CheckBox;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * Select various Audio tests.
+ */
+
+public class MainActivity extends Activity {
+
+ static {
+ // Must match name in CMakeLists.txt
+ System.loadLibrary("oboetester");
+ }
+
+ private Spinner mModeSpinner;
+ private TextView mCallbackSizeTextView;
+ protected TextView mDeviceView;
+ private TextView mVersionTextView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ mVersionTextView = (TextView) findViewById(R.id.versionText);
+ mCallbackSizeTextView = (TextView) findViewById(R.id.callbackSize);
+
+ mDeviceView = (TextView) findViewById(R.id.deviceView);
+ updateNativeAudioUI();
+
+ // Set mode, eg. MODE_IN_COMMUNICATION
+ mModeSpinner = (Spinner) findViewById(R.id.spinnerAudioMode);
+ mModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
+ long mode = mModeSpinner.getSelectedItemId();
+ AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ myAudioMgr.setMode((int)mode);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> adapterView) {
+ }
+ });
+
+ try {
+ PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
+ int versionCode = pinfo.versionCode;
+ String versionName = pinfo.versionName;
+ mVersionTextView.setText("V# = " + versionCode + ", name = " + versionName);
+ } catch (PackageManager.NameNotFoundException e) {
+ mVersionTextView.setText(e.getMessage());
+ }
+ }
+
+ private void updateNativeAudioUI() {
+ AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ String audioManagerSampleRate = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
+ String audioManagerFramesPerBurst = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
+ mDeviceView.setText("Java AudioManager: rate = " + audioManagerSampleRate +
+ ", burst = " + audioManagerFramesPerBurst);
+ }
+
+ public void onLaunchTestOutput(View view) {
+ updateCallbackSize();
+ Intent intent = new Intent(this, TestOutputActivity.class);
+ startActivity(intent);
+ }
+
+ public void onLaunchTestInput(View view) {
+ updateCallbackSize();
+ Intent intent = new Intent(this, TestInputActivity.class);
+ startActivity(intent);
+ }
+
+ public void onLaunchTapToTone(View view) {
+ updateCallbackSize();
+ Intent intent = new Intent(this, TapToToneActivity.class);
+ startActivity(intent);
+ }
+
+ public void onLaunchRecorder(View view) {
+ updateCallbackSize();
+ Intent intent = new Intent(this, RecorderActivity.class);
+ startActivity(intent);
+ }
+
+ public void onUseCallbackClicked(View view) {
+ CheckBox checkBox = (CheckBox) view;
+ OboeAudioStream.setUseCallback(checkBox.isChecked());
+ }
+
+ private void updateCallbackSize() {
+ CharSequence chars = mCallbackSizeTextView.getText();
+ String text = chars.toString();
+ int callbackSize = Integer.parseInt(text);
+ OboeAudioStream.setCallbackSize(callbackSize);
+ }
+
+ public void onSetSpeakerphoneOn(View view) {
+ CheckBox checkBox = (CheckBox) view;
+ boolean enabled = checkBox.isChecked();
+ AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ myAudioMgr.setSpeakerphoneOn(enabled);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioInputStream.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioInputStream.java
new file mode 100644
index 0000000..f89cfea
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioInputStream.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+class OboeAudioInputStream extends OboeAudioStream {
+
+ @Override
+ public boolean isInput() {
+ return true;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioOutputStream.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioOutputStream.java
new file mode 100644
index 0000000..e63fff6
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioOutputStream.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+/**
+ * Native synthesizer and audio output.
+ */
+public class OboeAudioOutputStream extends OboeAudioStream {
+
+ // WARNING - must match order in strings.xml
+ public static final int TONE_TYPE_SAW_PING = 0;
+ public static final int TONE_TYPE_SINE_STEADY = 1;
+ public static final int TONE_TYPE_IMPULSE = 2;
+
+ @Override
+ public boolean isInput() {
+ return false;
+ }
+
+ public native void setToneEnabled(boolean b);
+
+ public native void setToneType(int index);
+
+ @Override
+ public native void setAmplitude(double amplitude);
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioStream.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioStream.java
new file mode 100644
index 0000000..805180b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/OboeAudioStream.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import java.io.IOException;
+
+/**
+ * Created by philburk on 12/10/17.
+ */
+
+abstract class OboeAudioStream extends AudioStreamBase {
+ @Override
+ public void start() throws IOException {
+ int result = startNative();
+ if (result < 0) {
+ throw new IOException("Start failed! result = " + result);
+ }
+ }
+
+ public native int startNative();
+
+ @Override
+ public void pause() throws IOException {
+ int result = pauseNative();
+ if (result < 0) {
+ throw new IOException("Pause failed! result = " + result);
+ }
+ }
+
+ public native int pauseNative();
+
+ @Override
+ public void stop() throws IOException {
+ int result = stopNative();
+ if (result < 0) {
+ throw new IOException("Stop failed! result = " + result);
+ }
+ }
+
+ public native int stopNative();
+
+
+ @Override
+ public void stopPlayback() throws IOException {
+ int result = stopPlaybackNative();
+ if (result < 0) {
+ throw new IOException("Stop Playback failed! result = " + result);
+ }
+ }
+
+ public native int stopPlaybackNative();
+
+ @Override
+ public void startPlayback() throws IOException {
+ int result = startPlaybackNative();
+ if (result < 0) {
+ throw new IOException("Start Playback failed! result = " + result);
+ }
+ }
+
+ public native int startPlaybackNative();
+
+ // Write disabled because the synth is in native code.
+ @Override
+ public int write(float[] buffer, int offset, int length) {
+ return 0;
+ }
+
+ @Override
+ public void open(StreamConfiguration requestedConfiguration,
+ StreamConfiguration actualConfiguration, int bufferSizeInFrames) throws IOException {
+ super.open(requestedConfiguration, actualConfiguration, bufferSizeInFrames);
+ setNativeApi(requestedConfiguration.getNativeApi());
+ int result = openNative(requestedConfiguration.getSampleRate(),
+ requestedConfiguration.getChannelCount(),
+ requestedConfiguration.getFormat(),
+ requestedConfiguration.getSharingMode(),
+ requestedConfiguration.getPerformanceMode(),
+ requestedConfiguration.getDeviceId(),
+ requestedConfiguration.getSessionId(),
+ requestedConfiguration.getFramesPerBurst(),
+ isInput());
+ if (result < 0) {
+ throw new IOException("Open failed! result = " + result);
+ }
+ actualConfiguration.setNativeApi(getNativeApi());
+ actualConfiguration.setSampleRate(getSampleRate());
+ actualConfiguration.setSharingMode(getSharingMode());
+ actualConfiguration.setPerformanceMode(getPerformanceMode());
+ actualConfiguration.setFramesPerBurst(getFramesPerBurst());
+ actualConfiguration.setBufferCapacityInFrames(getBufferCapacityInFrames());
+ actualConfiguration.setChannelCount(getChannelCount());
+ actualConfiguration.setDeviceId(getDeviceId());
+ actualConfiguration.setSessionId(getSessionId());
+ actualConfiguration.setFormat(getFormat());
+ actualConfiguration.setMMap(isMMap());
+ }
+
+ private native int openNative(
+ int sampleRate,
+ int channelCount,
+ int sharingMode,
+ int performanceMode,
+ int deviceId,
+ int sessionId,
+ int framesPerRead,
+ int perRead, boolean isInput);
+
+ public native void close();
+
+ @Override
+ public native int getBufferCapacityInFrames();
+
+ @Override
+ public native int getBufferSizeInFrames();
+
+ @Override
+ public boolean isThresholdSupported() {
+ return true;
+ }
+
+ @Override
+ public native int setBufferSizeInFrames(int thresholdFrames);
+
+ public native int setNativeApi(int index);
+
+ public native int getNativeApi();
+
+ @Override
+ public native int getFramesPerBurst();
+
+ public native int getSharingMode();
+
+ public native int getPerformanceMode();
+
+ public native int getSampleRate();
+
+ public native int getFormat();
+
+ public native int getChannelCount();
+
+ public native int getDeviceId();
+
+ public native int getSessionId();
+
+ public native boolean isMMap();
+
+ @Override
+ public native long getFramesWritten();
+
+ @Override
+ public native long getFramesRead();
+
+ @Override
+ public native double getLatency();
+
+ @Override
+ public native int getState();
+
+ public static native void setUseCallback(boolean checked);
+
+ public static native void setCallbackSize(int callbackSize);
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/RecorderActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/RecorderActivity.java
new file mode 100644
index 0000000..b770840
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/RecorderActivity.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.media.audiofx.AcousticEchoCanceler;
+import android.media.audiofx.AutomaticGainControl;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.ActivityCompat;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Activity to record and play back audio.
+ */
+public class RecorderActivity extends TestInputActivity {
+
+
+ private static final int STATE_RECORDING = 5;
+ private static final int STATE_PLAYING = 6;
+ private int mRecorderState = STATE_STOPPED;
+
+ @Override
+ protected void inflateActivity() {
+ setContentView(R.layout.activity_recorder);
+ }
+
+ public void onStartRecording(View view) {
+ openAudio();
+ startAudio();
+ mRecorderState = STATE_RECORDING;
+ }
+
+ public void onStopRecordPlay(View view) {
+ stopAudio();
+ closeAudio();
+ mRecorderState = STATE_STOPPED;
+ }
+
+ public void onStartPlayback(View view) {
+ startPlayback();
+ mRecorderState = STATE_PLAYING;
+ }
+
+ public void startPlayback() {
+ try {
+ mAudioStreamTester.startPlayback();
+ mStreamConfigurationView.updateDisplay();
+ updateEnabledWidgets();
+ } catch (Exception e) {
+ e.printStackTrace();
+ mStatusView.setText(e.getMessage());
+ showToast(e.getMessage());
+ }
+
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfiguration.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfiguration.java
new file mode 100644
index 0000000..bcd103f
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfiguration.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+/**
+ * Container for the properties of a Stream.
+ *
+ * This can be used to build a stream, or as a base class for a Stream,
+ * or as a way to report the properties of a Stream.
+ */
+
+public class StreamConfiguration {
+ public static final int UNSPECIFIED = 0;
+
+ // These must match order in Spinner and in native code.
+ public static final int NATIVE_API_UNSPECIFIED = 0;
+ public static final int NATIVE_API_OPENSLES = 1;
+ public static final int NATIVE_API_AAUDIO = 2;
+
+ public static final int SHARING_MODE_EXCLUSIVE = 0; // must match AAUDIO
+ public static final int SHARING_MODE_SHARED = 1; // must match AAUDIO
+
+ public static final int AUDIO_FORMAT_PCM_16 = 1; // must match AAUDIO
+ public static final int AUDIO_FORMAT_PCM_FLOAT = 2; // must match AAUDIO
+
+ public static final int DIRECTION_OUTPUT = 0; // must match AAUDIO
+ public static final int DIRECTION_INPUT = 1; // must match AAUDIO
+
+ public static final int SESSION_ID_NONE = -1; // must match AAUDIO
+ public static final int SESSION_ID_ALLOCATE = 0; // must match AAUDIO
+
+ public static final int PERFORMANCE_MODE_NONE = 10; // must match AAUDIO
+ public static final int PERFORMANCE_MODE_POWER_SAVING = 11; // must match AAUDIO
+ public static final int PERFORMANCE_MODE_LOW_LATENCY = 12; // must match AAUDIO
+
+
+ private int mNativeApi;
+ private int mBufferCapacityInFrames = UNSPECIFIED;
+ private int mChannelCount = UNSPECIFIED;
+ private int mDeviceId = UNSPECIFIED;
+ private int mSessionId = -1;
+ private int mDirection = DIRECTION_OUTPUT;
+ private int mFormat = AUDIO_FORMAT_PCM_FLOAT;
+ private int mSampleRate = UNSPECIFIED;
+ private int mSharingMode = SHARING_MODE_SHARED;
+ private int mPerformanceMode = PERFORMANCE_MODE_LOW_LATENCY;
+ private int mFramesPerBurst = 29; // TODO review
+ private boolean mMMap = false;
+
+ public void setReasonableDefaults() {
+ mChannelCount = 2;
+ mSampleRate = 48000;
+ }
+
+ public int getFramesPerBurst() {
+ return mFramesPerBurst;
+ }
+
+ public void setFramesPerBurst(int framesPerBurst) {
+ this.mFramesPerBurst = framesPerBurst;
+ }
+
+ public int getBufferCapacityInFrames() {
+ return mBufferCapacityInFrames;
+ }
+
+ public void setBufferCapacityInFrames(int bufferCapacityInFrames) {
+ this.mBufferCapacityInFrames = bufferCapacityInFrames;
+ }
+
+ public int getFormat() {
+ return mFormat;
+ }
+
+ public void setFormat(int format) {
+ this.mFormat = format;
+ }
+
+ public int getDirection() {
+ return mDirection;
+ }
+
+ public void setDirection(int direction) {
+ this.mDirection = direction;
+ }
+
+ public int getPerformanceMode() {
+ return mPerformanceMode;
+ }
+
+ public void setPerformanceMode(int performanceMode) {
+ this.mPerformanceMode = performanceMode;
+ }
+
+ static String convertPerformanceModeToText(int performanceMode) {
+ switch(performanceMode) {
+ case PERFORMANCE_MODE_NONE:
+ return "NONE";
+ case PERFORMANCE_MODE_POWER_SAVING:
+ return "POWER_SAVING";
+ case PERFORMANCE_MODE_LOW_LATENCY:
+ return "LOW_LATENCY";
+ default:
+ return "INVALID";
+ }
+ }
+
+ public int getSharingMode() {
+ return mSharingMode;
+ }
+
+ public void setSharingMode(int sharingMode) {
+ this.mSharingMode = sharingMode;
+ }
+
+ static String convertSharingModeToText(int sharingMode) {
+ switch(sharingMode) {
+ case SHARING_MODE_SHARED:
+ return "SHARED";
+ case SHARING_MODE_EXCLUSIVE:
+ return "EXCLUSIVE";
+ default:
+ return "INVALID";
+ }
+ }
+
+ public static String convertFormatToText(int format) {
+ switch(format) {
+ case UNSPECIFIED:
+ return "Unspecified";
+ case AUDIO_FORMAT_PCM_16:
+ return "I16";
+ case AUDIO_FORMAT_PCM_FLOAT:
+ return "Float";
+ default:
+ return "Invalid";
+ }
+ }
+
+ public static String convertNativeApiToText(int api) {
+ switch(api) {
+ case NATIVE_API_UNSPECIFIED:
+ return "Unspec";
+ case NATIVE_API_AAUDIO:
+ return "AAudio";
+ case NATIVE_API_OPENSLES:
+ return "OpenSL";
+ default:
+ return "Invalid";
+ }
+ }
+
+ public int getChannelCount() {
+ return mChannelCount;
+ }
+
+ public void setChannelCount(int channelCount) {
+ this.mChannelCount = channelCount;
+ }
+
+ public int getSampleRate() {
+ return mSampleRate;
+ }
+
+ public void setSampleRate(int sampleRate) {
+ this.mSampleRate = sampleRate;
+ }
+
+ public int getDeviceId() {
+ return mDeviceId;
+ }
+
+ public void setDeviceId(int deviceId) {
+ this.mDeviceId = deviceId;
+ }
+
+ public int getSessionId() {
+ return mSessionId;
+ }
+
+ public void setSessionId(int sessionId) {
+ mSessionId = sessionId;
+ }
+
+ public boolean isMMap() {
+ return mMMap;
+ }
+ public void setMMap(boolean b) {
+ mMMap = b;
+ }
+
+ public int getNativeApi() {
+ return mNativeApi;
+ }
+
+ public void setNativeApi(int nativeApi) {
+ mNativeApi = nativeApi;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfigurationView.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfigurationView.java
new file mode 100644
index 0000000..9290f4e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/StreamConfigurationView.java
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.CheckBox;
+import android.widget.Spinner;
+import android.widget.TableLayout;
+import android.widget.TextView;
+import android.widget.LinearLayout;
+
+import com.google.sample.audio_device.AudioDeviceListEntry;
+import com.google.sample.audio_device.AudioDeviceSpinner;
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * View for Editing a requested StreamConfiguration
+ * and displaying the actual StreamConfiguration.
+ */
+
+public class StreamConfigurationView extends LinearLayout {
+
+ private StreamConfiguration mRequestedConfiguration = new StreamConfiguration();
+ private StreamConfiguration mActualConfiguration = new StreamConfiguration();
+
+ protected Spinner mNativeApiSpinner;
+ private TextView mActualNativeApiView;
+
+ private TextView mActualExclusiveView;
+ private TextView mActualPerformanceView;
+ private Spinner mPerformanceSpinner;
+ private CheckBox mRequestedExclusiveView;
+ private TextView mStreamInfoView;
+ private Spinner mChannelCountSpinner;
+ private TextView mActualChannelCountView;
+ private TextView mActualFormatView;
+ private Spinner mFormatSpinner;
+ private Spinner mSampleRateSpinner;
+ private TextView mActualSampleRateView;
+ private TableLayout mOptionTable;
+
+ private AudioDeviceSpinner mDeviceSpinner;
+ private TextView mActualSessionIdView;
+ private CheckBox mRequestAudioEffect;
+
+
+ public StreamConfigurationView(Context context) {
+ super(context);
+ initializeViews(context);
+ }
+
+ public StreamConfigurationView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ initializeViews(context);
+ }
+
+ public StreamConfigurationView(Context context,
+ AttributeSet attrs,
+ int defStyle) {
+ super(context, attrs, defStyle);
+ initializeViews(context);
+ }
+
+ /**
+ * Inflates the views in the layout.
+ *
+ * @param context
+ * the current context for the view.
+ */
+ private void initializeViews(Context context) {
+ LayoutInflater inflater = (LayoutInflater) context
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ inflater.inflate(R.layout.stream_config, this);
+
+ mOptionTable = (TableLayout) findViewById(R.id.optionTable);
+
+ mNativeApiSpinner = (Spinner) findViewById(R.id.spinnerNativeApi);
+ mNativeApiSpinner.setOnItemSelectedListener(new NativeApiSpinnerListener());
+ mNativeApiSpinner.setSelection(StreamConfiguration.NATIVE_API_UNSPECIFIED);
+
+ mActualNativeApiView = (TextView) findViewById(R.id.actualNativeApi);
+
+ mActualExclusiveView = (TextView) findViewById(R.id.actualExclusiveMode);
+ mRequestedExclusiveView = (CheckBox) findViewById(R.id.requestedExclusiveMode);
+ mRequestedExclusiveView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mRequestedConfiguration.setSharingMode(mRequestedExclusiveView.isChecked()
+ ? StreamConfiguration.SHARING_MODE_EXCLUSIVE
+ : StreamConfiguration.SHARING_MODE_SHARED);
+ }
+ });
+
+ mActualSessionIdView = (TextView) findViewById(R.id.sessionId);
+ mRequestAudioEffect = (CheckBox) findViewById(R.id.requestAudioEffect);
+ mRequestAudioEffect.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mRequestedConfiguration.setSessionId(mRequestAudioEffect.isChecked()
+ ? StreamConfiguration.SESSION_ID_ALLOCATE
+ : StreamConfiguration.SESSION_ID_NONE);
+ }
+ });
+
+ mActualSampleRateView = (TextView) findViewById(R.id.actualSampleRate);
+ mSampleRateSpinner = (Spinner) findViewById(R.id.spinnerSampleRate);
+ mSampleRateSpinner.setOnItemSelectedListener(new SampleRateSpinnerListener());
+
+ mActualChannelCountView = (TextView) findViewById(R.id.actualChannelCount);
+ mChannelCountSpinner = (Spinner) findViewById(R.id.spinnerChannelCount);
+ mChannelCountSpinner.setOnItemSelectedListener(new ChannelCountSpinnerListener());
+
+ mActualFormatView = (TextView) findViewById(R.id.actualAudioFormat);
+ mFormatSpinner = (Spinner) findViewById(R.id.spinnerFormat);
+ mFormatSpinner.setOnItemSelectedListener(new FormatSpinnerListener());
+
+ mActualPerformanceView = (TextView) findViewById(R.id.actualPerformanceMode);
+ mPerformanceSpinner = (Spinner) findViewById(R.id.spinnerPerformanceMode);
+ mPerformanceSpinner.setOnItemSelectedListener(new PerformanceModeSpinnerListener());
+ mPerformanceSpinner.setSelection(StreamConfiguration.PERFORMANCE_MODE_LOW_LATENCY
+ - StreamConfiguration.PERFORMANCE_MODE_NONE);
+
+ mStreamInfoView = (TextView) findViewById(R.id.streamInfo);
+
+ mDeviceSpinner = (AudioDeviceSpinner) findViewById(R.id.devices_spinner);
+ mDeviceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
+ int id = ((AudioDeviceListEntry) mDeviceSpinner.getSelectedItem()).getId();
+ mRequestedConfiguration.setDeviceId(id);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> adapterView) {
+ mRequestedConfiguration.setDeviceId(StreamConfiguration.UNSPECIFIED);
+ }
+ });
+ }
+
+ public void setOutput(boolean output) {
+ if (output) {
+ mDeviceSpinner.setDirectionType(AudioManager.GET_DEVICES_OUTPUTS);
+ } else {
+ mDeviceSpinner.setDirectionType(AudioManager.GET_DEVICES_INPUTS);
+ }
+ }
+
+
+ private class NativeApiSpinnerListener implements android.widget.AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ mRequestedConfiguration.setNativeApi(pos);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ mRequestedConfiguration.setNativeApi(StreamConfiguration.NATIVE_API_UNSPECIFIED);
+ }
+ }
+
+ private class PerformanceModeSpinnerListener implements android.widget.AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int performanceMode, long id) {
+ mRequestedConfiguration.setPerformanceMode(performanceMode
+ + StreamConfiguration.PERFORMANCE_MODE_NONE);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ mRequestedConfiguration.setPerformanceMode(StreamConfiguration.PERFORMANCE_MODE_NONE);
+ }
+ }
+
+ private class ChannelCountSpinnerListener implements android.widget.AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ mRequestedConfiguration.setChannelCount(pos);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ mRequestedConfiguration.setChannelCount(StreamConfiguration.UNSPECIFIED);
+ }
+ }
+
+ private class SampleRateSpinnerListener implements android.widget.AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ String text = parent.getItemAtPosition(pos).toString();
+ int sampleRate = Integer.parseInt(text);
+ mRequestedConfiguration.setSampleRate(sampleRate);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ mRequestedConfiguration.setPerformanceMode(StreamConfiguration.UNSPECIFIED);
+ }
+ }
+
+ private class FormatSpinnerListener implements android.widget.AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
+ // Menu position matches actual enum value!
+ mRequestedConfiguration.setFormat(pos);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ mRequestedConfiguration.setPerformanceMode(StreamConfiguration.UNSPECIFIED);
+ }
+ }
+
+ public void setChildrenEnabled(boolean enabled) {
+ mNativeApiSpinner.setEnabled(enabled);
+ mPerformanceSpinner.setEnabled(enabled);
+ mRequestedExclusiveView.setEnabled(enabled);
+ mSampleRateSpinner.setEnabled(enabled);
+ mChannelCountSpinner.setEnabled(enabled);
+ mFormatSpinner.setEnabled(enabled);
+ mDeviceSpinner.setEnabled(enabled);
+ mRequestAudioEffect.setEnabled(enabled);
+ }
+
+ void updateDisplay() {
+ int value;
+
+ value = mActualConfiguration.getNativeApi();
+ mActualNativeApiView.setText(StreamConfiguration.convertNativeApiToText(value));
+
+ value = mActualConfiguration.getSharingMode();
+ mActualExclusiveView.setText(StreamConfiguration.convertSharingModeToText(value));
+
+ value = mActualConfiguration.getPerformanceMode();
+ mActualPerformanceView.setText(StreamConfiguration.convertPerformanceModeToText(value));
+ mActualPerformanceView.requestLayout();
+
+ value = mActualConfiguration.getFormat();
+ mActualFormatView.setText(StreamConfiguration.convertFormatToText(value));
+ mActualFormatView.requestLayout();
+
+ mActualChannelCountView.setText(mActualConfiguration.getChannelCount() + "");
+ mActualSampleRateView.setText(mActualConfiguration.getSampleRate() + "");
+ mActualSessionIdView.setText("S#: " + mActualConfiguration.getSessionId());
+
+ mStreamInfoView.setText("burst = " + mActualConfiguration.getFramesPerBurst()
+ + ", capacity = " + mActualConfiguration.getBufferCapacityInFrames()
+ + ", devID = " + mActualConfiguration.getDeviceId()
+ + ", " + (mActualConfiguration.isMMap() ? "MMAP" : "Legacy")
+ );
+
+ mOptionTable.requestLayout();
+ }
+
+ public StreamConfiguration getRequestedConfiguration() {
+ return mRequestedConfiguration;
+ }
+
+ public StreamConfiguration getActualConfiguration() {
+ return mActualConfiguration;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapLatencyAnalyser.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapLatencyAnalyser.java
new file mode 100644
index 0000000..9f90276
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapLatencyAnalyser.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2015 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.
+ */
+package com.google.sample.oboe.manualtest;
+
+import java.util.ArrayList;
+
+public class TapLatencyAnalyser {
+ public static final int TYPE_TAP = 0;
+ float[] mHighPassBuffer;
+
+ private float mDroop = 0.995f;
+ private static float LOW_THRESHOLD = 0.01f;
+ private static float HIGH_THRESHOLD = 0.03f;
+
+ public static class TapLatencyEvent {
+ public int type;
+ public int sampleIndex;
+ public TapLatencyEvent(int type, int sampleIndex) {
+ this.type = type;
+ this.sampleIndex = sampleIndex;
+ }
+ }
+
+ public TapLatencyEvent[] analyze(float[] buffer, int offset, int numSamples) {
+ // Use high pass filter to remove rumble from air conditioners.
+ mHighPassBuffer = new float[numSamples];
+ highPassFilter(buffer, offset, numSamples, mHighPassBuffer);
+ float[] peakBuffer = new float[numSamples];
+ fillPeakBuffer(mHighPassBuffer, 0, numSamples, peakBuffer);
+ return scanForEdges(peakBuffer, numSamples);
+ }
+
+ public float[] getFilteredBuffer() {
+ return mHighPassBuffer;
+ }
+
+ private void highPassFilter(float[] buffer, int offset, int numSamples, float[] highPassBuffer) {
+ float xn1 = 0.0f;
+ float yn1 = 0.0f;
+ float alpha = 0.05f;
+ for (int i = 0; i < numSamples; i++) {
+ float xn = buffer[i + offset];
+ float yn = alpha * yn1 + ((1.0f - alpha) * (xn - xn1));
+ highPassBuffer[i] = yn;
+ xn1 = xn;
+ yn1 = yn;
+ }
+ }
+
+ private TapLatencyEvent[] scanForEdges(float[] peakBuffer, int numSamples) {
+ ArrayList<TapLatencyEvent> events = new ArrayList<TapLatencyEvent>();
+ float slow = 0.0f;
+ float fast = 0.0f;
+ float slowCoefficient = 0.01f;
+ float fastCoefficient = 0.10f;
+ boolean armed = true;
+ int sampleIndex = 0;
+ for (float level : peakBuffer) {
+ slow = slow + (level - slow) * slowCoefficient; // low pass filter
+ fast = fast + (level - fast) * fastCoefficient;
+ if (armed && (fast > HIGH_THRESHOLD) && (fast > (2.0 * slow))) {
+ //System.out.println("edge at " + sampleIndex + ", slow " + slow + ", fast " + fast);
+ events.add(new TapLatencyEvent(TYPE_TAP, sampleIndex));
+ armed = false;
+ }
+ // Use hysteresis when rearming.
+ if (!armed && (fast < LOW_THRESHOLD)) {
+ armed = true;
+ }
+ sampleIndex++;
+ }
+ return events.toArray(new TapLatencyEvent[0]);
+ }
+
+ private void fillPeakBuffer(float[] buffer, int offset, int numSamples, float[] peakBuffer) {
+ float previous = 0.0f;
+ float maxInput = 0.0f;
+ float maxOutput = 0.0f;
+ for (int i = 0; i < numSamples; i++) {
+ float input = buffer[i + offset];
+ if (input > maxInput) {
+ maxInput = input;
+ }
+ float output = previous * mDroop;
+ if (input > output) {
+ output = input;
+ }
+ previous = output;
+ peakBuffer[i] = output;
+ if (output > maxOutput) {
+ maxOutput = output;
+ }
+ }
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapToToneActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapToToneActivity.java
new file mode 100644
index 0000000..cdf87ea
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TapToToneActivity.java
@@ -0,0 +1,373 @@
+/*
+ * Copyright 2015 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.media.midi.MidiDevice;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiInputPort;
+import android.media.midi.MidiManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.sample.oboe.manualtest.R;
+import com.mobileer.miditools.MidiOutputPortConnectionSelector;
+import com.mobileer.miditools.MidiPortConnector;
+import com.mobileer.miditools.MidiTools;
+
+import java.io.IOException;
+
+import static com.google.sample.oboe.manualtest.AudioMidiTester.TestListener;
+import static com.google.sample.oboe.manualtest.AudioMidiTester.TestResult;
+
+public class TapToToneActivity extends TestOutputActivityBase {
+ private static final int MY_PERMISSIONS_REQUEST_RECORD_AUDIO = 1234;
+ private TextView mResultView;
+ private MidiManager mMidiManager;
+ private MidiInputPort mInputPort;
+
+ protected AudioMidiTester mAudioMidiTester;
+
+ private MidiOutputPortConnectionSelector mPortSelector;
+ private MyTestListener mTestListener = new MyTestListener();
+ private WaveformView mWaveformView;
+ // Stats for latency
+ private int mMeasurementCount;
+ private int mLatencySumSamples;
+ private int mLatencyMin;
+ private int mLatencyMax;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_tap_to_tone);
+
+ mResultView = (TextView) findViewById(R.id.resultView);
+
+ findAudioCommon();
+
+ if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_MIDI)) {
+ setupMidi();
+ } else {
+ Toast.makeText(TapToToneActivity.this,
+ "MIDI not supported!", Toast.LENGTH_LONG)
+ .show();
+ }
+
+ mWaveformView = (WaveformView) findViewById(R.id.waveview_audio);
+
+ // Start a blip test when the waveform view is tapped.
+ mWaveformView.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent event) {
+ int action = event.getActionMasked();
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ mAudioMidiTester.setEnabled(true);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_POINTER_UP:
+ mAudioMidiTester.setEnabled(false);
+ break;
+ }
+ // Must return true or we do not get the ACTION_MOVE and
+ // ACTION_UP events.
+ return true;
+ }
+ });
+
+ updateEnabledWidgets();
+ }
+
+ @Override
+ protected void onDestroy() {
+ mAudioMidiTester.removeTestListener(mTestListener);
+ closeMidiResources();
+ super.onDestroy();
+ }
+
+ private void setupMidi() {
+ // Setup MIDI
+ mMidiManager = (MidiManager) getSystemService(MIDI_SERVICE);
+ MidiDeviceInfo[] infos = mMidiManager.getDevices();
+
+ // Open the port now so that the AudioMidiTester gets created.
+ for (MidiDeviceInfo info : infos) {
+ Bundle properties = info.getProperties();
+ String product = properties
+ .getString(MidiDeviceInfo.PROPERTY_PRODUCT);
+
+ Log.i(TAG, "product = " + product);
+ if ("AudioLatencyTester".equals(product)) {
+ openPort(info);
+ break;
+ }
+ }
+
+ }
+
+ // These should only be set after mAudioMidiTester is set.
+ private void setSpinnerListeners() {
+ MidiDeviceInfo synthInfo = MidiTools.findDevice(mMidiManager, "AndroidTest",
+ "AudioLatencyTester");
+ Log.i(TAG, "found tester virtual device info: " + synthInfo);
+ int portIndex = 0;
+ mPortSelector = new MidiOutputPortConnectionSelector(mMidiManager, this,
+ R.id.spinner_synth_sender, synthInfo, portIndex);
+ mPortSelector.setConnectedListener(new MyPortsConnectedListener());
+
+ }
+
+ private class MyTestListener implements TestListener {
+ @Override
+ public void onTestFinished(final TestResult result) {
+ runOnUiThread(new Runnable() {
+ public void run() {
+ showTestResults(result);
+ }
+ });
+ }
+
+ @Override
+ public void onNoteOn(final int pitch) {
+ runOnUiThread(new Runnable() {
+ public void run() {
+ mStatusView.setText("MIDI pitch = " + pitch);
+ }
+ });
+ }
+ }
+
+ // Runs on UI thread.
+ private void showTestResults(TestResult result) {
+ String text;
+ int previous = 0;
+ if (result == null) {
+ text = "";
+ mWaveformView.clearSampleData();
+ } else {
+ if (result.events.length < 2) {
+ text = "Not enough edges.\n";
+ mWaveformView.setCursorData(null);
+ } else if (result.events.length > 2) {
+ text = "Too many edges.\n";
+ mWaveformView.setCursorData(null);
+ } else {
+ int[] cursors = new int[2];
+ cursors[0] = result.events[0].sampleIndex;
+ cursors[1] = result.events[1].sampleIndex;
+ int latencySamples = cursors[1] - cursors[0];
+ mLatencySumSamples += latencySamples;
+ mMeasurementCount++;
+
+ int latencyMillis = 1000 * latencySamples / result.frameRate;
+ if (mLatencyMin > latencyMillis) {
+ mLatencyMin = latencyMillis;
+ }
+ if (mLatencyMax < latencyMillis) {
+ mLatencyMax = latencyMillis;
+ }
+
+ text = String.format("latency = %3d msec\n", latencyMillis);
+ mWaveformView.setCursorData(cursors);
+ }
+ mWaveformView.setSampleData(result.filtered);
+ }
+
+ if (mMeasurementCount > 0) {
+ int averageLatencySamples = mLatencySumSamples / mMeasurementCount;
+ int averageLatencyMillis = 1000 * averageLatencySamples / result.frameRate;
+ final String plural = (mMeasurementCount == 1) ? "test" : "tests";
+ text = text + String.format("min = %3d, avg = %3d, max = %3d, %d %s",
+ mLatencyMin, averageLatencyMillis, mLatencyMax, mMeasurementCount, plural);
+ }
+ final String postText = text;
+ mWaveformView.post(new Runnable() {
+ public void run() {
+ mResultView.setText(postText);
+ mWaveformView.postInvalidate();
+ }
+ });
+ }
+
+ private void openPort(final MidiDeviceInfo info) {
+ mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
+ @Override
+ public void onDeviceOpened(MidiDevice device) {
+ if (device == null) {
+ Log.e(TAG, "could not open device " + info);
+ } else {
+ mInputPort = device.openInputPort(0);
+ Log.i(TAG, "opened MIDI port = " + mInputPort + " on " + info);
+ mAudioMidiTester = AudioMidiTester.getInstance();
+ mAudioStreamTester = mAudioOutTester = AudioOutputTester.getInstance();
+ Log.i(TAG, "openPort() mAudioMidiTester = " + mAudioMidiTester);
+ // Now that we have created the AudioMidiTester, close the port so we can
+ // open it later.
+ try {
+ mInputPort.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ mAudioMidiTester.addTestListener(mTestListener);
+
+ setSpinnerListeners();
+ }
+ }
+ }, new Handler(Looper.getMainLooper())
+ );
+ }
+
+ // TODO Listen to the synth server
+ // for open/close events and then disable/enable the spinner.
+ private class MyPortsConnectedListener
+ implements MidiPortConnector.OnPortsConnectedListener {
+ @Override
+ public void onPortsConnected(final MidiDevice.MidiConnection connection) {
+ Log.i(TAG, "onPortsConnected, connection = " + connection);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ if (connection == null) {
+ Toast.makeText(TapToToneActivity.this,
+ R.string.error_port_busy, Toast.LENGTH_LONG)
+ .show();
+ mPortSelector.clearSelection();
+ } else {
+ Toast.makeText(TapToToneActivity.this,
+ R.string.port_open_ok, Toast.LENGTH_LONG)
+ .show();
+ }
+ }
+ });
+ }
+ }
+
+ private void closeMidiResources() {
+ if (mPortSelector != null) {
+ mPortSelector.close();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+
+ //noinspection SimplifiableIfStatement
+ if (id == R.id.action_settings) {
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ private boolean hasRecordAudioPermission(){
+ boolean hasPermission = (checkSelfPermission(
+ Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED);
+ Log.i(TAG, "Has RECORD_AUDIO permission? " + hasPermission);
+ return hasPermission;
+ }
+
+ private void requestRecordAudioPermission(){
+
+ String requiredPermission = Manifest.permission.RECORD_AUDIO;
+
+ // If the user previously denied this permission then show a message explaining why
+ // this permission is needed
+ if (shouldShowRequestPermissionRationale(requiredPermission)) {
+ showToast("This app needs to record audio through the microphone....");
+ }
+
+ // request the permission.
+ requestPermissions(new String[]{requiredPermission},
+ MY_PERMISSIONS_REQUEST_RECORD_AUDIO);
+ }
+ @Override
+ public void onRequestPermissionsResult(int requestCode,
+ String permissions[], int[] grantResults) {
+ // TODO
+ }
+
+ @Override
+ public void startAudio() {
+ if (hasRecordAudioPermission()) {
+ startAudioPermitted();
+ } else {
+ requestRecordAudioPermission();
+ }
+ }
+
+ private void startAudioPermitted() {
+ super.startAudio();
+ resetLatency();
+ try {
+ mAudioMidiTester.start();
+ mAudioOutTester.setToneType(OboeAudioOutputStream.TONE_TYPE_SAW_PING);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void stopAudio() {
+ mAudioMidiTester.stop();
+ super.stopAudio();
+ }
+
+ @Override
+ public void pauseAudio() {
+ mAudioMidiTester.stop();
+ super.pauseAudio();
+ }
+
+ @Override
+ public void closeAudio() {
+ mAudioMidiTester.stop();
+ super.closeAudio();
+ }
+
+ private void resetLatency() {
+ mMeasurementCount = 0;
+ mLatencySumSamples = 0;
+ mLatencyMin = Integer.MAX_VALUE;
+ mLatencyMax = 0;
+ showTestResults(null);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestAudioActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestAudioActivity.java
new file mode 100644
index 0000000..094eaeb
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestAudioActivity.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.app.Activity;
+import android.content.Context;
+import android.media.AudioManager;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.sample.oboe.manualtest.R;
+
+import java.io.IOException;
+
+/**
+ * Base class for other Activities.
+ */
+abstract class TestAudioActivity extends Activity {
+ public static final String TAG = "TestOboe";
+
+ protected static final int FADER_THRESHOLD_MAX = 1000;
+ public static final int STATE_OPEN = 0;
+ public static final int STATE_STARTED = 1;
+ public static final int STATE_PAUSED = 2;
+ public static final int STATE_STOPPED = 3;
+ public static final int STATE_CLOSED = 4;
+ public static final int COLOR_ACTIVE = 0xFFD0D0A0;
+ public static final int COLOR_IDLE = 0xFFD0D0D0;
+
+ private int mState = STATE_CLOSED;
+ protected TextView mStatusView;
+ protected String audioManagerSampleRate;
+ protected int audioManagerFramesPerBurst;
+ protected AudioStreamTester mAudioStreamTester;
+ protected StreamConfigurationView mStreamConfigurationView;
+ private Button mOpenButton;
+ private Button mStartButton;
+ private Button mPauseButton;
+ private Button mStopButton;
+ private Button mCloseButton;
+ private MyStreamSniffer mStreamSniffer;
+
+ // Periodically query the status of the stream.
+ protected class MyStreamSniffer {
+ public static final int SNIFFER_UPDATE_PERIOD_MSEC = 150;
+ public static final int SNIFFER_UPDATE_DELAY_MSEC = 300;
+
+ private int mFramesPerBurst = 1;
+ private int mNumUpdates = 0;
+ private Handler mHandler;
+
+ // Define the code block to be executed
+ private Runnable runnableCode = new Runnable() {
+ @Override
+ public void run() {
+ // Handler runs this on the main UI thread.
+ AudioStreamBase.StreamStatus status = mAudioStreamTester.getCurrentAudioStream().getStreamStatus();
+ updateStreamStatusView(status);
+ // Repeat this runnable code block again.
+ mHandler.postDelayed(runnableCode, SNIFFER_UPDATE_PERIOD_MSEC);
+ }
+ };
+
+ private void startStreamSniffer() {
+ stopStreamSniffer();
+ mNumUpdates = 0;
+ mHandler = new Handler(Looper.getMainLooper());
+ // Start the initial runnable task by posting through the handler
+ mFramesPerBurst = mAudioStreamTester.getCurrentAudioStream().getFramesPerBurst();
+ mHandler.postDelayed(runnableCode, SNIFFER_UPDATE_DELAY_MSEC);
+ }
+
+ private void stopStreamSniffer() {
+ if (mHandler != null) {
+ mHandler.removeCallbacks(runnableCode);
+ }
+ }
+
+ // These are constantly changing.
+ private void updateStreamStatusView(final AudioStreamBase.StreamStatus status) {
+ if (status.bufferSize < 0 || status.framesWritten < 0) {
+ return;
+ }
+ int numBuffers = -1;
+ if (status.bufferSize > 0 && mFramesPerBurst > 0) {
+ numBuffers = status.bufferSize / mFramesPerBurst;
+ }
+ String latencyText = (status.latency < 0.0)
+ ? "?"
+ : String.format("%6.1f msec", status.latency);
+ final String msg = "buffer size = "
+ + ((status.bufferSize < 0) ? "?" : status.bufferSize) + " = "
+ + numBuffers + " * " + mFramesPerBurst + ", xRunCount = "
+ + ((status.xRunCount < 0) ? "?" : status.xRunCount) + "\n"
+ + "frames written " + status.framesWritten + " - read " + status.framesRead
+ + " = " + (status.framesWritten - status.framesRead) + "\n"
+ + "latency = " + latencyText
+ + ", state = " + status.state
+ + ", #updates " + mNumUpdates++
+ ;
+ runOnUiThread(new Runnable() {
+ public void run() {
+ mStatusView.setText(msg);
+ updateStreamDisplay();
+ }
+ });
+ }
+ }
+
+ void updateStreamDisplay() {
+ }
+
+ @Override
+ protected void onDestroy() {
+ try {
+ mAudioStreamTester.stop();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ mState = STATE_CLOSED;
+ super.onDestroy();
+ }
+
+ int getState() {
+ return mState;
+ }
+
+ protected void updateEnabledWidgets() {
+ if (mOpenButton != null) {
+ mOpenButton.setBackgroundColor(mState == STATE_OPEN ? COLOR_ACTIVE : COLOR_IDLE);
+ mStartButton.setBackgroundColor(mState == STATE_STARTED ? COLOR_ACTIVE : COLOR_IDLE);
+ mPauseButton.setBackgroundColor(mState == STATE_PAUSED ? COLOR_ACTIVE : COLOR_IDLE);
+ mStopButton.setBackgroundColor(mState == STATE_STOPPED ? COLOR_ACTIVE : COLOR_IDLE);
+ mCloseButton.setBackgroundColor(mState == STATE_CLOSED ? COLOR_ACTIVE : COLOR_IDLE);
+ }
+ mStreamConfigurationView.setChildrenEnabled(mState == STATE_CLOSED);
+ }
+
+ abstract boolean isOutput();
+
+ protected void findAudioCommon() {
+ mStatusView = (TextView) findViewById(R.id.statusView);
+
+ mOpenButton = (Button) findViewById(R.id.button_open);
+ if (mOpenButton != null) {
+ mStartButton = (Button) findViewById(R.id.button_start);
+ mPauseButton = (Button) findViewById(R.id.button_pause);
+ mStopButton = (Button) findViewById(R.id.button_stop);
+ mCloseButton = (Button) findViewById(R.id.button_close);
+ }
+
+ mStreamConfigurationView = (StreamConfigurationView)
+ findViewById(R.id.outputStreamConfiguration);
+ mStreamConfigurationView.setOutput(isOutput());
+
+ queryNativeAudioParameters();
+
+ mStreamSniffer = new MyStreamSniffer();
+ }
+
+ private void queryNativeAudioParameters() {
+ AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ audioManagerSampleRate = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
+ String audioManagerFramesPerBurstText = myAudioMgr.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
+ audioManagerFramesPerBurst = Integer.parseInt(audioManagerFramesPerBurstText);
+ }
+
+ abstract public void setupEffects(int sessionId);
+
+ protected void showToast(String message) {
+ Toast.makeText(this, "Error: " + message, Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ protected void onStop() {
+ Log.i(TAG, "onStop() called so stopping audio =========================");
+ stopAudio();
+ closeAudio();
+ super.onStop();
+ }
+
+ public void openAudio(View view) {
+ openAudio();
+ }
+
+ public void startAudio(View view) {
+ Log.i(TAG, "startAudio() called =======================================");
+ startAudio();
+ }
+
+ public void stopAudio(View view) {
+ stopAudio();
+ }
+
+ public void pauseAudio(View view) {
+ pauseAudio();
+ }
+
+ public void closeAudio(View view) {
+ closeAudio();
+ }
+
+ public void openAudio() {
+ try {
+ StreamConfiguration requestedConfig = mStreamConfigurationView.getRequestedConfiguration();
+ requestedConfig.setFramesPerBurst(audioManagerFramesPerBurst);
+ mAudioStreamTester.open(requestedConfig,
+ mStreamConfigurationView.getActualConfiguration());
+ mState = STATE_OPEN;
+ int sessionId = mStreamConfigurationView.getActualConfiguration().getSessionId();
+ if (sessionId > 0) {
+ setupEffects(sessionId);
+ }
+ mStreamConfigurationView.updateDisplay();
+ updateEnabledWidgets();
+ mStreamSniffer.startStreamSniffer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ mStatusView.setText(e.getMessage());
+ showToast(e.getMessage());
+ }
+ }
+
+ public void startAudio() {
+ try {
+ mAudioStreamTester.start();
+ mState = STATE_STARTED;
+ mStreamConfigurationView.updateDisplay();
+ updateEnabledWidgets();
+ } catch (Exception e) {
+ e.printStackTrace();
+ mStatusView.setText(e.getMessage());
+ showToast(e.getMessage());
+ }
+ }
+
+ public void pauseAudio() {
+ try {
+ mAudioStreamTester.pause();
+ mState = STATE_PAUSED;
+ updateEnabledWidgets();
+ } catch (Exception e) {
+ e.printStackTrace();
+ mStatusView.setText(e.getMessage());
+ showToast(e.getMessage());
+ }
+ }
+
+ public void stopAudio() {
+ try {
+ mAudioStreamTester.stop();
+ mState = STATE_STOPPED;
+ updateEnabledWidgets();
+ } catch (Exception e) {
+ e.printStackTrace();
+ mStatusView.setText(e.getMessage());
+ showToast(e.getMessage());
+ }
+ }
+
+ public void closeAudio() {
+ mStreamSniffer.stopStreamSniffer();
+ mAudioStreamTester.close();
+ mState = STATE_CLOSED;
+ updateEnabledWidgets();
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestInputActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestInputActivity.java
new file mode 100644
index 0000000..90c4094
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestInputActivity.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.media.audiofx.AcousticEchoCanceler;
+import android.media.audiofx.AutomaticGainControl;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.ActivityCompat;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * Test Oboe Capture
+ */
+
+public class TestInputActivity extends TestAudioActivity
+ implements ActivityCompat.OnRequestPermissionsResultCallback {
+
+ private static final int AUDIO_ECHO_REQUEST = 0;
+ private AudioInputTester mAudioInputTester;
+ private static final int NUM_VOLUME_BARS = 4;
+ private TextView[] mVolumeTexts = new TextView[NUM_VOLUME_BARS];
+ private VolumeBarView[] mVolumeBars = new VolumeBarView[NUM_VOLUME_BARS];
+
+ @Override boolean isOutput() { return false; }
+
+ protected void inflateActivity() {
+ setContentView(R.layout.activity_test_input);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ inflateActivity();
+
+ mVolumeTexts[0] = (TextView) findViewById(R.id.volumeText0);
+ mVolumeBars[0] = (VolumeBarView) findViewById(R.id.volumeBar0);
+ mVolumeTexts[1] = (TextView) findViewById(R.id.volumeText1);
+ mVolumeBars[1] = (VolumeBarView) findViewById(R.id.volumeBar1);
+ mVolumeTexts[2] = (TextView) findViewById(R.id.volumeText2);
+ mVolumeBars[2] = (VolumeBarView) findViewById(R.id.volumeBar2);
+ mVolumeTexts[3] = (TextView) findViewById(R.id.volumeText3);
+ mVolumeBars[3] = (VolumeBarView) findViewById(R.id.volumeBar3);
+
+ findAudioCommon();
+ updateEnabledWidgets();
+
+ mAudioStreamTester = mAudioInputTester = AudioInputTester.getInstance();
+ }
+
+ void updateStreamDisplay() {
+ int numChannels = mAudioInputTester.getCurrentAudioStream().getChannelCount();
+ if (numChannels > NUM_VOLUME_BARS) {
+ numChannels = NUM_VOLUME_BARS;
+ }
+ for (int i = 0; i < numChannels; i++) {
+ double level = mAudioInputTester.getPeakLevel(i);
+ String msg = String.format("level = %8.6f", level);
+ mVolumeTexts[i].setText(msg);
+ mVolumeBars[i].setVolume((float) level);
+ }
+ }
+
+ public void openAudio() {
+ if (!isRecordPermissionGranted()){
+ requestRecordPermission();
+ return;
+ }
+ super.openAudio();
+ }
+
+ private boolean isRecordPermissionGranted() {
+ return (ActivityCompat.checkSelfPermission(this,
+ Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED);
+ }
+
+ private void requestRecordPermission(){
+ ActivityCompat.requestPermissions(
+ this,
+ new String[]{Manifest.permission.RECORD_AUDIO},
+ AUDIO_ECHO_REQUEST);
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
+ @NonNull int[] grantResults) {
+
+ if (AUDIO_ECHO_REQUEST != requestCode) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ return;
+ }
+
+ if (grantResults.length != 1 ||
+ grantResults[0] != PackageManager.PERMISSION_GRANTED) {
+
+ Toast.makeText(getApplicationContext(),
+ getString(R.string.need_record_audio_permission),
+ Toast.LENGTH_SHORT)
+ .show();
+ } else {
+ // Permission was granted
+ super.openAudio();
+ }
+ }
+
+ public void setupAGC(int sessionId) {
+ AutomaticGainControl effect = AutomaticGainControl.create(sessionId);
+ }
+
+ public void setupAEC(int sessionId) {
+ AcousticEchoCanceler effect = AcousticEchoCanceler.create(sessionId);
+ }
+
+ @Override
+ public void setupEffects(int sessionId) {
+ setupAEC(sessionId);
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivity.java
new file mode 100644
index 0000000..47d61e5
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivity.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.os.Bundle;
+
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * Base class for output test activities
+ */
+public class TestOutputActivity extends TestOutputActivityBase {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_test_output);
+
+ findAudioCommon();
+ updateEnabledWidgets();
+
+ mAudioStreamTester = mAudioOutTester = AudioOutputTester.getInstance();
+ }
+
+ public void startAudio() {
+ super.startAudio();
+ mAudioOutTester.setToneType(OboeAudioOutputStream.TONE_TYPE_SINE_STEADY);
+ mAudioOutTester.setEnabled(true);
+ }
+
+ public void stopAudio() {
+ mAudioOutTester.setEnabled(false);
+ super.stopAudio();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivityBase.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivityBase.java
new file mode 100644
index 0000000..60917d7
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/TestOutputActivityBase.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2017 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.media.audiofx.Equalizer;
+import android.media.audiofx.PresetReverb;
+import android.util.Log;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import com.google.sample.oboe.manualtest.R;
+
+
+class TestOutputActivityBase extends TestAudioActivity {
+ AudioOutputTester mAudioOutTester;
+
+ protected TextView mTextThreshold;
+ protected SeekBar mFaderThreshold;
+ protected ExponentialTaper mTaperThreshold;
+ protected TextView mTextAmplitude;
+ protected SeekBar mFaderAmplitude;
+ protected ExponentialTaper mTaperAmplitude;
+
+ @Override boolean isOutput() { return true; }
+
+ protected void updateEnabledWidgets() {
+ super.updateEnabledWidgets();
+ boolean thresholdSupported = (mAudioStreamTester == null) ? false :
+ mAudioStreamTester.getCurrentAudioStream().isThresholdSupported();
+ mFaderThreshold.setEnabled(getState() == STATE_STARTED && thresholdSupported);
+ }
+
+ private SeekBar.OnSeekBarChangeListener mAmplitudeListener = new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ double amplitude = mTaperAmplitude.linearToExponential(progress);
+ mAudioOutTester.setAmplitude(amplitude);
+ mTextAmplitude.setText("Amplitude = " + amplitude);
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ };
+
+ private SeekBar.OnSeekBarChangeListener mThresholdListener = new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ setBufferSizeByPosition(progress);
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ };
+
+ private void setBufferSizeByPosition(int progress) {
+ double normalizedThreshold = mTaperThreshold.linearToExponential(progress);
+ if (normalizedThreshold < 0.0) normalizedThreshold = 0.0;
+ else if (normalizedThreshold > 1.0) normalizedThreshold = 1.0;
+ if (mAudioStreamTester != null) {
+ mAudioOutTester.setNormalizedThreshold(normalizedThreshold);
+ int percent = (int) (normalizedThreshold * 100);
+ int bufferSize = mAudioStreamTester.getCurrentAudioStream().getBufferSizeInFrames();
+ int bufferCapacity = mAudioStreamTester.getCurrentAudioStream().getBufferCapacityInFrames();
+ mTextThreshold.setText("bufferSize = " + percent + "% = "
+ + bufferSize + " / " + bufferCapacity);
+ }
+ }
+
+ protected void findAudioCommon() {
+ super.findAudioCommon();
+
+ mTextThreshold = (TextView) findViewById(R.id.textThreshold);
+ mFaderThreshold = (SeekBar) findViewById(R.id.faderThreshold);
+ mFaderThreshold.setOnSeekBarChangeListener(mThresholdListener);
+ mTaperThreshold = new ExponentialTaper(FADER_THRESHOLD_MAX, 0.01, 1.0);
+ mFaderThreshold.setProgress(FADER_THRESHOLD_MAX / 2);
+
+ mTextAmplitude = (TextView) findViewById(R.id.textAmplitude);
+ mFaderAmplitude = (SeekBar) findViewById(R.id.faderAmplitude);
+ mFaderAmplitude.setOnSeekBarChangeListener(mAmplitudeListener);
+ mTaperAmplitude = new ExponentialTaper(FADER_THRESHOLD_MAX, 0.01, 4.0);
+ }
+
+ public void pauseAudio() {
+ super.pauseAudio();
+ }
+
+ public void stopAudio() {
+ super.stopAudio();
+ }
+
+ // TODO Add editor
+ public void setupEqualizer(int sessionId) {
+ Equalizer equalizer = new Equalizer(0, sessionId);
+ int numBands = equalizer.getNumberOfBands();
+ Log.d(TAG, "numBands " + numBands);
+ for (short band = 0; band < numBands; band++) {
+ String msg = "band " + band
+ + ", center = " + equalizer.getCenterFreq(band)
+ + ", level = " + equalizer.getBandLevel(band);
+ Log.d(TAG, msg);
+ equalizer.setBandLevel(band, (short)40);
+ }
+
+ equalizer.setBandLevel((short) 1, (short) 300);
+ }
+
+ public void setupReverb(int sessionId) {
+ PresetReverb effect = new PresetReverb(0, sessionId);
+ }
+
+ @Override
+ public void setupEffects(int sessionId) {
+ // setupEqualizer(sessionId);
+ // setupReverb(sessionId);
+ }
+}
\ No newline at end of file
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/VolumeBarView.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/VolumeBarView.java
new file mode 100644
index 0000000..a6f562f
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/VolumeBarView.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class VolumeBarView extends View {
+
+ private Paint mBarPaint;
+ private int mCurrentWidth;
+ private int mCurrentHeight;
+ private Paint mBackgroundPaint;
+ private float mVolume;
+
+ public VolumeBarView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+// TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
+// R.styleable.VolumeBarView, 0, 0);
+ init();
+ }
+
+ private void init() {
+ mBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBarPaint.setColor(Color.RED);
+ mBarPaint.setStyle(Paint.Style.FILL);
+
+ mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBackgroundPaint.setColor(Color.LTGRAY);
+ mBackgroundPaint.setStyle(Paint.Style.FILL);
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ mCurrentWidth = w;
+ mCurrentHeight = h;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRect(0.0f, 0.0f, mCurrentWidth,
+ mCurrentHeight, mBackgroundPaint);
+ float scaledVolume = mVolume * mCurrentWidth;
+ canvas.drawRect(0.0f, 0.0f, scaledVolume,
+ mCurrentHeight, mBarPaint);
+ }
+
+ /**
+ * Set volume between 0.0 and 1.0
+ */
+ public void setVolume(float volume) {
+ mVolume = volume;
+ postInvalidate();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/WaveformView.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/WaveformView.java
new file mode 100644
index 0000000..69e9739
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/WaveformView.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.google.sample.oboe.manualtest;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+import com.google.sample.oboe.manualtest.R;
+
+/**
+ * Display an audio waveform in a custom View.
+ */
+public class WaveformView extends View {
+ private Paint mWavePaint;
+ private int mCurrentWidth;
+ private int mCurrentHeight;
+ private Paint mBackgroundPaint;
+ private float[] mData;
+ private int mSampleCount;
+ private int mSampleOffset;
+ private float mOffsetY;
+ private float mScaleY;
+ private int[] mCursors;
+ private Paint mCursorPaint;
+
+ public WaveformView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
+ R.styleable.WaveformView, 0, 0);
+ init();
+ }
+ @SuppressWarnings("deprecation")
+ private void init() {
+ Resources res = getResources();
+
+ mWavePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mWavePaint.setColor(res.getColor(R.color.waveform_line));
+ float strokeWidth = res.getDimension(R.dimen.waveform_stroke_width);
+ mWavePaint.setStrokeWidth(strokeWidth);
+
+ mCursorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mCursorPaint.setColor(Color.RED);
+ mCursorPaint.setStrokeWidth(3.0f);
+
+ mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBackgroundPaint.setColor(res.getColor(R.color.waveform_background));
+ mBackgroundPaint.setStyle(Paint.Style.FILL);
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ mCurrentWidth = w;
+ mCurrentHeight = h;
+ mOffsetY = 0.5f * h;
+ mScaleY = 0.0f - mOffsetY;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ float [] localData = mData;
+ canvas.drawRect(0.0f, 0.0f, mCurrentWidth,
+ mCurrentHeight, mBackgroundPaint);
+ if (localData == null || mSampleCount == 0) {
+ return;
+ }
+ float xScale = ((float) mCurrentWidth) / mSampleCount;
+ float x0 = 0.0f;
+ float ymin = mOffsetY;
+ float ymax = mOffsetY;
+ for (int i = 1; i < mSampleCount; i++) {
+ float x1 = i * xScale;
+ float y1 = (localData[i] * mScaleY) + mOffsetY;
+ if ((int)x0 != (int)x1) {
+ canvas.drawLine(x0, ymin, x1, ymax, mWavePaint);
+ x0 = x1;
+ ymin = mOffsetY;
+ ymax = mOffsetY;
+ } else {
+ ymin = Math.min(ymin, y1);
+ ymax = Math.max(ymax, y1);
+ }
+ }
+ if (mCursors != null) {
+ for (int i = 0; i < mCursors.length; i++) {
+ float x = mCursors[i] * xScale;
+ canvas.drawLine(x, 0, x, mCurrentHeight, mCursorPaint);
+ }
+ }
+ }
+
+ /**
+ * Copy data into internal buffer then repaint.
+ */
+ public void setSampleData(float[] samples) {
+ setSampleData(samples, 0, samples.length);
+ }
+
+ public void setSampleData(float[] samples, int offset, int count) {
+ if ((offset+count) > samples.length) {
+ throw new IllegalArgumentException("Exceed array bounds. ("
+ + offset + " + " + count + ") > " + samples.length);
+ }
+ if (mData == null || count > mData.length) {
+ mData = new float[count];
+ }
+ System.arraycopy(samples, offset, mData, 0, count);
+ mSampleCount = count;
+ mSampleOffset = offset;
+ }
+
+ public void clearSampleData() {
+ mData = null;
+ mSampleCount = 0;
+ mSampleOffset = 0;
+ }
+
+ /**
+ * Copy cursor positions into internal buffer then repaint.
+ */
+ public void setCursorData(int[] cursors) {
+ if (cursors == null) {
+ mCursors = null;
+ } else {
+ if (mCursors == null || cursors.length != mCursors.length) {
+ mCursors = new int[cursors.length];
+ }
+ System.arraycopy(cursors, 0, mCursors, 0, mCursors.length);
+ }
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/EventScheduler.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/EventScheduler.java
new file mode 100644
index 0000000..29f5b18
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/EventScheduler.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * Store SchedulableEvents in a timestamped buffer.
+ * Events may be written in any order.
+ * Events will be read in sorted order.
+ * Events with the same timestamp will be read in the order they were added.
+ *
+ * Only one Thread can write into the buffer.
+ * And only one Thread can read from the buffer.
+ */
+public class EventScheduler {
+ private static final long NANOS_PER_MILLI = 1000000;
+
+ private final Object lock = new Object();
+ private SortedMap<Long, FastEventQueue> mEventBuffer;
+ // This does not have to be guarded. It is only set by the writing thread.
+ // If the reader sees a null right before being set then that is OK.
+ private FastEventQueue mEventPool = null;
+ private static final int MAX_POOL_SIZE = 200;
+
+ public EventScheduler() {
+ mEventBuffer = new TreeMap<Long, FastEventQueue>();
+ }
+
+ // If we keep at least one node in the list then it can be atomic
+ // and non-blocking.
+ private class FastEventQueue {
+ // One thread takes from the beginning of the list.
+ volatile SchedulableEvent mFirst;
+ // A second thread returns events to the end of the list.
+ volatile SchedulableEvent mLast;
+ volatile long mEventsAdded;
+ volatile long mEventsRemoved;
+
+ FastEventQueue(SchedulableEvent event) {
+ mFirst = event;
+ mLast = mFirst;
+ mEventsAdded = 1; // Always created with one event added. Never empty.
+ mEventsRemoved = 0; // None removed yet.
+ }
+
+ int size() {
+ return (int)(mEventsAdded - mEventsRemoved);
+ }
+
+ /**
+ * Do not call this unless there is more than one event
+ * in the list.
+ * @return first event in the list
+ */
+ public SchedulableEvent remove() {
+ // Take first event.
+ mEventsRemoved++;
+ SchedulableEvent event = mFirst;
+ mFirst = event.mNext;
+ return event;
+ }
+
+ /**
+ * @param event
+ */
+ public void add(SchedulableEvent event) {
+ event.mNext = null;
+ mLast.mNext = event;
+ mLast = event;
+ mEventsAdded++;
+ }
+ }
+
+ /**
+ * Base class for events that can be stored in the EventScheduler.
+ */
+ public static class SchedulableEvent {
+ private long mTimestamp;
+ private SchedulableEvent mNext = null;
+
+ /**
+ * @param timestamp
+ */
+ public SchedulableEvent(long timestamp) {
+ mTimestamp = timestamp;
+ }
+
+ /**
+ * @return timestamp
+ */
+ public long getTimestamp() {
+ return mTimestamp;
+ }
+
+ /**
+ * The timestamp should not be modified when the event is in the
+ * scheduling buffer.
+ */
+ public void setTimestamp(long timestamp) {
+ mTimestamp = timestamp;
+ }
+ }
+
+ /**
+ * Get an event from the pool.
+ * Always leave at least one event in the pool.
+ * @return event or null
+ */
+ public SchedulableEvent removeEventfromPool() {
+ SchedulableEvent event = null;
+ if (mEventPool != null && (mEventPool.size() > 1)) {
+ event = mEventPool.remove();
+ }
+ return event;
+ }
+
+ /**
+ * Return events to a pool so they can be reused.
+ *
+ * @param event
+ */
+ public void addEventToPool(SchedulableEvent event) {
+ if (mEventPool == null) {
+ mEventPool = new FastEventQueue(event); // add event to pool
+ // If we already have enough items in the pool then just
+ // drop the event. This prevents unbounded memory leaks.
+ } else if (mEventPool.size() < MAX_POOL_SIZE) {
+ mEventPool.add(event);
+ }
+ }
+
+ /**
+ * Add an event to the scheduler. Events with the same time will be
+ * processed in order.
+ *
+ * @param event
+ */
+ public void add(SchedulableEvent event) {
+ synchronized (lock) {
+ FastEventQueue list = mEventBuffer.get(event.getTimestamp());
+ if (list == null) {
+ long lowestTime = mEventBuffer.isEmpty() ? Long.MAX_VALUE
+ : mEventBuffer.firstKey();
+ list = new FastEventQueue(event);
+ mEventBuffer.put(event.getTimestamp(), list);
+ // If the event we added is earlier than the previous earliest
+ // event then notify any threads waiting for the next event.
+ if (event.getTimestamp() < lowestTime) {
+ lock.notify();
+ }
+ } else {
+ list.add(event);
+ }
+ }
+ }
+
+ // Caller must synchronize on lock before calling.
+ private SchedulableEvent removeNextEventLocked(long lowestTime) {
+ SchedulableEvent event;
+ FastEventQueue list = mEventBuffer.get(lowestTime);
+ // Remove list from tree if this is the last node.
+ if ((list.size() == 1)) {
+ mEventBuffer.remove(lowestTime);
+ }
+ event = list.remove();
+ return event;
+ }
+
+ /**
+ * Check to see if any scheduled events are ready to be processed.
+ *
+ * @param timestamp
+ * @return next event or null if none ready
+ */
+ public SchedulableEvent getNextEvent(long time) {
+ SchedulableEvent event = null;
+ synchronized (lock) {
+ if (!mEventBuffer.isEmpty()) {
+ long lowestTime = mEventBuffer.firstKey();
+ // Is it time for this list to be processed?
+ if (lowestTime <= time) {
+ event = removeNextEventLocked(lowestTime);
+ }
+ }
+ }
+ // Log.i(TAG, "getNextEvent: event = " + event);
+ return event;
+ }
+
+ /**
+ * Return the next available event or wait until there is an event ready to
+ * be processed. This method assumes that the timestamps are in nanoseconds
+ * and that the current time is System.nanoTime().
+ *
+ * @return event
+ * @throws InterruptedException
+ */
+ public SchedulableEvent waitNextEvent() throws InterruptedException {
+ SchedulableEvent event = null;
+ while (true) {
+ long millisToWait = Integer.MAX_VALUE;
+ synchronized (lock) {
+ if (!mEventBuffer.isEmpty()) {
+ long now = System.nanoTime();
+ long lowestTime = mEventBuffer.firstKey();
+ // Is it time for the earliest list to be processed?
+ if (lowestTime <= now) {
+ event = removeNextEventLocked(lowestTime);
+ break;
+ } else {
+ // Figure out how long to sleep until next event.
+ long nanosToWait = lowestTime - now;
+ // Add 1 millisecond so we don't wake up before it is
+ // ready.
+ millisToWait = 1 + (nanosToWait / NANOS_PER_MILLI);
+ // Clip 64-bit value to 32-bit max.
+ if (millisToWait > Integer.MAX_VALUE) {
+ millisToWait = Integer.MAX_VALUE;
+ }
+ }
+ }
+ lock.wait((int) millisToWait);
+ }
+ }
+ return event;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiConstants.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiConstants.java
new file mode 100644
index 0000000..978a0ce
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiConstants.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools;
+
+/**
+ * MIDI related constants and static methods.
+ * These values are defined in the MIDI Standard 1.0
+ * available from the MIDI Manufacturers Association.
+ */
+public class MidiConstants {
+ protected final static String TAG = "MidiTools";
+ public static final byte STATUS_COMMAND_MASK = (byte) 0xF0;
+ public static final byte STATUS_CHANNEL_MASK = (byte) 0x0F;
+
+ // Channel voice messages.
+ public static final byte STATUS_NOTE_OFF = (byte) 0x80;
+ public static final byte STATUS_NOTE_ON = (byte) 0x90;
+ public static final byte STATUS_POLYPHONIC_AFTERTOUCH = (byte) 0xA0;
+ public static final byte STATUS_CONTROL_CHANGE = (byte) 0xB0;
+ public static final byte STATUS_PROGRAM_CHANGE = (byte) 0xC0;
+ public static final byte STATUS_CHANNEL_PRESSURE = (byte) 0xD0;
+ public static final byte STATUS_PITCH_BEND = (byte) 0xE0;
+
+ // System Common Messages.
+ public static final byte STATUS_SYSTEM_EXCLUSIVE = (byte) 0xF0;
+ public static final byte STATUS_MIDI_TIME_CODE = (byte) 0xF1;
+ public static final byte STATUS_SONG_POSITION = (byte) 0xF2;
+ public static final byte STATUS_SONG_SELECT = (byte) 0xF3;
+ public static final byte STATUS_TUNE_REQUEST = (byte) 0xF6;
+ public static final byte STATUS_END_SYSEX = (byte) 0xF7;
+
+ // System Real-Time Messages
+ public static final byte STATUS_TIMING_CLOCK = (byte) 0xF8;
+ public static final byte STATUS_START = (byte) 0xFA;
+ public static final byte STATUS_CONTINUE = (byte) 0xFB;
+ public static final byte STATUS_STOP = (byte) 0xFC;
+ public static final byte STATUS_ACTIVE_SENSING = (byte) 0xFE;
+ public static final byte STATUS_RESET = (byte) 0xFF;
+
+ /** Number of bytes in a message nc from 8c to Ec */
+ public final static int CHANNEL_BYTE_LENGTHS[] = { 3, 3, 3, 3, 2, 2, 3 };
+
+ /** Number of bytes in a message Fn from F0 to FF */
+ public final static int SYSTEM_BYTE_LENGTHS[] = { 1, 2, 3, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1 };
+
+ /**
+ * MIDI messages, except for SysEx, are 1,2 or 3 bytes long.
+ * You can tell how long a MIDI message is from the first status byte.
+ * Do not call this for SysEx, which has variable length.
+ * @param statusByte
+ * @return number of bytes in a complete message, zero if data byte passed
+ */
+ public static int getBytesPerMessage(byte statusByte) {
+ // Java bytes are signed so we need to mask off the high bits
+ // to get a value between 0 and 255.
+ int statusInt = statusByte & 0xFF;
+ if (statusInt >= 0xF0) {
+ // System messages use low nibble for size.
+ return SYSTEM_BYTE_LENGTHS[statusInt & 0x0F];
+ } else if(statusInt >= 0x80) {
+ // Channel voice messages use high nibble for size.
+ return CHANNEL_BYTE_LENGTHS[(statusInt >> 4) - 8];
+ } else {
+ return 0; // data byte
+ }
+ }
+
+ /**
+ * @param msg
+ * @param offset
+ * @param count
+ * @return true if the entire message is ActiveSensing commands
+ */
+ public static boolean isAllActiveSensing(byte[] msg, int offset,
+ int count) {
+ // Count bytes that are not active sensing.
+ int goodBytes = 0;
+ for (int i = 0; i < count; i++) {
+ byte b = msg[offset + i];
+ if (b != MidiConstants.STATUS_ACTIVE_SENSING) {
+ goodBytes++;
+ }
+ }
+ return (goodBytes == 0);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDeviceMonitor.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDeviceMonitor.java
new file mode 100644
index 0000000..32b9257
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDeviceMonitor.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceStatus;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiManager.DeviceCallback;
+import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Manage a list a of DeviceCallbacks that are called when a MIDI Device is
+ * plugged in or unplugged.
+ *
+ * This class is used to workaround a bug in the M release of the Android MIDI API.
+ * The MidiManager.unregisterDeviceCallback() method was not working. So if an app
+ * was rotated, and the Activity destroyed and recreated, the DeviceCallbacks would
+ * accumulate in the MidiServer. This would result in multiple callbacks whenever a
+ * device was added. This class allow an app to register and unregister multiple times
+ * using a local list of callbacks. It registers a single callback, which stays registered
+ * until the app is dead.
+ *
+ * This code checks to see if the N release is being used. N has a fix for the bug.
+ * For N, the register and unregister calls are passed directly to the MidiManager.
+ *
+ * Note that this code is not thread-safe. It should only be called from the UI thread.
+ */
+public class MidiDeviceMonitor {
+ public final static String TAG = "MidiDeviceMonitor";
+
+ private static MidiDeviceMonitor mInstance;
+ private MidiManager mMidiManager;
+ private HashMap<DeviceCallback, Handler> mCallbacks = new HashMap<DeviceCallback,Handler>();
+ private MyDeviceCallback mMyDeviceCallback;
+ // We only need the workaround for versions before N.
+ private boolean mUseProxy = Build.VERSION.SDK_INT <= Build.VERSION_CODES.M;
+
+ // Use an inner class so we do not clutter the API of MidiDeviceMonitor
+ // with public DeviceCallback methods.
+ protected class MyDeviceCallback extends DeviceCallback {
+
+ @Override
+ public void onDeviceAdded(final MidiDeviceInfo device) {
+ // Call all of the locally registered callbacks.
+ for(Map.Entry<DeviceCallback, Handler> item : mCallbacks.entrySet()) {
+ final DeviceCallback callback = item.getKey();
+ Handler handler = item.getValue();
+ if(handler == null) {
+ callback.onDeviceAdded(device);
+ } else {
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onDeviceAdded(device);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public void onDeviceRemoved(final MidiDeviceInfo device) {
+ for(Map.Entry<DeviceCallback, Handler> item : mCallbacks.entrySet()) {
+ final DeviceCallback callback = item.getKey();
+ Handler handler = item.getValue();
+ if(handler == null) {
+ callback.onDeviceRemoved(device);
+ } else {
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onDeviceRemoved(device);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public void onDeviceStatusChanged(final MidiDeviceStatus status) {
+ for(Map.Entry<DeviceCallback, Handler> item : mCallbacks.entrySet()) {
+ final DeviceCallback callback = item.getKey();
+ Handler handler = item.getValue();
+ if(handler == null) {
+ callback.onDeviceStatusChanged(status);
+ } else {
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onDeviceStatusChanged(status);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ private MidiDeviceMonitor(MidiManager midiManager) {
+ mMidiManager = midiManager;
+ if (mUseProxy) {
+ Log.i(TAG,"Running on M so we need to use the workaround.");
+ mMyDeviceCallback = new MyDeviceCallback();
+ mMidiManager.registerDeviceCallback(mMyDeviceCallback,
+ new Handler(Looper.getMainLooper()));
+ }
+ }
+
+ public synchronized static MidiDeviceMonitor getInstance(MidiManager midiManager) {
+ if (mInstance == null) {
+ mInstance = new MidiDeviceMonitor(midiManager);
+ }
+ return mInstance;
+ }
+
+ public void registerDeviceCallback(DeviceCallback callback, Handler handler) {
+ if (mUseProxy) {
+ // Keep our own list of callbacks.
+ mCallbacks.put(callback, handler);
+ } else {
+ mMidiManager.registerDeviceCallback(callback, handler);
+ }
+ }
+
+ public void unregisterDeviceCallback(DeviceCallback callback) {
+ if (mUseProxy) {
+ mCallbacks.remove(callback);
+ } else {
+ // This works on N or later.
+ mMidiManager.unregisterDeviceCallback(callback);
+ }
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDispatcher.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDispatcher.java
new file mode 100644
index 0000000..73de71e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiDispatcher.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiReceiver;
+import android.media.midi.MidiSender;
+
+import java.io.IOException;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * Utility class for dispatching MIDI data to a list of {@link android.media.midi.MidiReceiver}s.
+ * This class subclasses {@link android.media.midi.MidiReceiver} and dispatches any data it receives
+ * to its receiver list. Any receivers that throw an exception upon receiving data will
+ * be automatically removed from the receiver list, but no IOException will be returned
+ * from the dispatcher's {@link android.media.midi.MidiReceiver#onReceive} in that case.
+ */
+public final class MidiDispatcher extends MidiReceiver {
+
+ private final CopyOnWriteArrayList<MidiReceiver> mReceivers
+ = new CopyOnWriteArrayList<MidiReceiver>();
+
+ private final MidiSender mSender = new MidiSender() {
+ /**
+ * Called to connect a {@link android.media.midi.MidiReceiver} to the sender
+ *
+ * @param receiver the receiver to connect
+ */
+ @Override
+ public void onConnect(MidiReceiver receiver) {
+ mReceivers.add(receiver);
+ }
+
+ /**
+ * Called to disconnect a {@link android.media.midi.MidiReceiver} from the sender
+ *
+ * @param receiver the receiver to disconnect
+ */
+ @Override
+ public void onDisconnect(MidiReceiver receiver) {
+ mReceivers.remove(receiver);
+ }
+ };
+
+ /**
+ * Returns the number of {@link android.media.midi.MidiReceiver}s this dispatcher contains.
+ * @return the number of receivers
+ */
+ public int getReceiverCount() {
+ return mReceivers.size();
+ }
+
+ /**
+ * Returns a {@link android.media.midi.MidiSender} which is used to add and remove
+ * {@link android.media.midi.MidiReceiver}s
+ * to the dispatcher's receiver list.
+ * @return the dispatcher's MidiSender
+ */
+ public MidiSender getSender() {
+ return mSender;
+ }
+
+ @Override
+ public void onSend(byte[] msg, int offset, int count, long timestamp) throws IOException {
+ for (MidiReceiver receiver : mReceivers) {
+ try {
+ receiver.send(msg, offset, count, timestamp);
+ } catch (IOException e) {
+ // if the receiver fails we remove the receiver but do not propagate the exception
+ mReceivers.remove(receiver);
+ }
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ for (MidiReceiver receiver : mReceivers) {
+ receiver.flush();
+ }
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventScheduler.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventScheduler.java
new file mode 100644
index 0000000..610e1ec
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventScheduler.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiReceiver;
+
+import java.io.IOException;
+
+/**
+ * Add MIDI Events to an EventScheduler
+ */
+public class MidiEventScheduler extends EventScheduler {
+ // Maintain a pool of scheduled events to reduce memory allocation.
+ // This pool increases performance by about 14%.
+ private final static int POOL_EVENT_SIZE = 16;
+ private MidiReceiver mReceiver = new SchedulingReceiver();
+
+ private class SchedulingReceiver extends MidiReceiver
+ {
+ /**
+ * Store these bytes in the EventScheduler to be delivered at the specified
+ * time.
+ */
+ @Override
+ public void onSend(byte[] msg, int offset, int count, long timestamp)
+ throws IOException {
+ MidiEvent event = createScheduledEvent(msg, offset, count, timestamp);
+ if (event != null) {
+ add(event);
+ }
+ }
+ }
+
+ public static class MidiEvent extends SchedulableEvent {
+ public int count = 0;
+ public byte[] data;
+
+ private MidiEvent(int count) {
+ super(0);
+ data = new byte[count];
+ }
+
+ private MidiEvent(byte[] msg, int offset, int count, long timestamp) {
+ super(timestamp);
+ data = new byte[count];
+ System.arraycopy(msg, offset, data, 0, count);
+ this.count = count;
+ }
+
+ @Override
+ public String toString() {
+ String text = "Event: ";
+ for (int i = 0; i < count; i++) {
+ text += data[i] + ", ";
+ }
+ return text;
+ }
+ }
+
+ /**
+ * Create an event that contains the message.
+ */
+ private MidiEvent createScheduledEvent(byte[] msg, int offset, int count,
+ long timestamp) {
+ MidiEvent event;
+ if (count > POOL_EVENT_SIZE) {
+ event = new MidiEvent(msg, offset, count, timestamp);
+ } else {
+ event = (MidiEvent) removeEventfromPool();
+ if (event == null) {
+ event = new MidiEvent(POOL_EVENT_SIZE);
+ }
+ System.arraycopy(msg, offset, event.data, 0, count);
+ event.count = count;
+ event.setTimestamp(timestamp);
+ }
+ return event;
+ }
+
+ /**
+ * Return events to a pool so they can be reused.
+ *
+ * @param event
+ */
+ @Override
+ public void addEventToPool(SchedulableEvent event) {
+ // Make sure the event is suitable for the pool.
+ if (event instanceof MidiEvent) {
+ MidiEvent midiEvent = (MidiEvent) event;
+ if (midiEvent.data.length == POOL_EVENT_SIZE) {
+ super.addEventToPool(event);
+ }
+ }
+ }
+
+ /**
+ * This MidiReceiver will write date to the scheduling buffer.
+ * @return the MidiReceiver
+ */
+ public MidiReceiver getReceiver() {
+ return mReceiver;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventThread.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventThread.java
new file mode 100644
index 0000000..0cad562
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiEventThread.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiSender;
+import android.util.Log;
+
+import java.io.IOException;
+
+public class MidiEventThread extends MidiEventScheduler {
+
+ private EventThread mEventThread;
+ MidiDispatcher mDispatcher = new MidiDispatcher();
+
+ class EventThread extends Thread {
+ private boolean go = true;
+
+ @Override
+ public void run() {
+ while (go) {
+ try {
+ MidiEvent event = (MidiEvent) waitNextEvent();
+ try {
+ Log.i(MidiConstants.TAG, "Fire event " + event.data[0] + " at "
+ + event.getTimestamp());
+ mDispatcher.send(event.data, 0,
+ event.count, event.getTimestamp());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // Put event back in the pool for future use.
+ addEventToPool(event);
+ } catch (InterruptedException e) {
+ // OK, this is how we stop the thread.
+ }
+ }
+ }
+
+ /**
+ * Asynchronously tell the thread to stop.
+ */
+ public void requestStop() {
+ go = false;
+ interrupt();
+ }
+ }
+
+ public void start() {
+ stop();
+ mEventThread = new EventThread();
+ mEventThread.start();
+ }
+
+ /**
+ * Asks the thread to stop then waits for it to stop.
+ */
+ public void stop() {
+ if (mEventThread != null) {
+ mEventThread.requestStop();
+ try {
+ mEventThread.join(500);
+ } catch (InterruptedException e) {
+ Log.e(MidiConstants.TAG,
+ "Interrupted while waiting for MIDI EventScheduler thread to stop.");
+ } finally {
+ mEventThread = null;
+ }
+ }
+ }
+
+ public MidiSender getSender() {
+ return mDispatcher.getSender();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiFramer.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiFramer.java
new file mode 100644
index 0000000..f196cb7
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiFramer.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiReceiver;
+
+import java.io.IOException;
+
+/**
+ * Convert stream of arbitrary MIDI bytes into discrete messages.
+ *
+ * Parses the incoming bytes and then posts individual messages to the receiver
+ * specified in the constructor. Short messages of 1-3 bytes will be complete.
+ * System Exclusive messages may be posted in pieces.
+ *
+ * Resolves Running Status and interleaved System Real-Time messages.
+ */
+public class MidiFramer extends MidiReceiver {
+ private MidiReceiver mReceiver;
+ private byte[] mBuffer = new byte[3];
+ private int mCount;
+ private byte mRunningStatus;
+ private int mNeeded;
+ private boolean mInSysEx;
+
+ public MidiFramer(MidiReceiver receiver) {
+ mReceiver = receiver;
+ }
+
+ /*
+ * @see android.midi.MidiReceiver#onSend(byte[], int, int, long)
+ */
+ @Override
+ public void onSend(byte[] data, int offset, int count, long timestamp)
+ throws IOException {
+ int sysExStartOffset = (mInSysEx ? offset : -1);
+
+ for (int i = 0; i < count; i++) {
+ final byte currentByte = data[offset];
+ final int currentInt = currentByte & 0xFF;
+ if (currentInt >= 0x80) { // status byte?
+ if (currentInt < 0xF0) { // channel message?
+ mRunningStatus = currentByte;
+ mCount = 1;
+ mNeeded = MidiConstants.getBytesPerMessage(currentByte) - 1;
+ } else if (currentInt < 0xF8) { // system common?
+ if (currentInt == 0xF0 /* SysEx Start */) {
+ // Log.i(TAG, "SysEx Start");
+ mInSysEx = true;
+ sysExStartOffset = offset;
+ } else if (currentInt == 0xF7 /* SysEx End */) {
+ // Log.i(TAG, "SysEx End");
+ if (mInSysEx) {
+ mReceiver.send(data, sysExStartOffset,
+ offset - sysExStartOffset + 1, timestamp);
+ mInSysEx = false;
+ sysExStartOffset = -1;
+ }
+ } else {
+ mBuffer[0] = currentByte;
+ mRunningStatus = 0;
+ mCount = 1;
+ mNeeded = MidiConstants.getBytesPerMessage(currentByte) - 1;
+ }
+ } else { // real-time?
+ // Single byte message interleaved with other data.
+ if (mInSysEx) {
+ mReceiver.send(data, sysExStartOffset,
+ offset - sysExStartOffset, timestamp);
+ sysExStartOffset = offset + 1;
+ }
+ mReceiver.send(data, offset, 1, timestamp);
+ }
+ } else { // data byte
+ if (!mInSysEx) {
+ mBuffer[mCount++] = currentByte;
+ if (--mNeeded == 0) {
+ if (mRunningStatus != 0) {
+ mBuffer[0] = mRunningStatus;
+ }
+ mReceiver.send(mBuffer, 0, mCount, timestamp);
+ mNeeded = MidiConstants.getBytesPerMessage(mBuffer[0]) - 1;
+ mCount = 1;
+ }
+ }
+ }
+ ++offset;
+ }
+
+ // send any accumulatedSysEx data
+ if (sysExStartOffset >= 0 && sysExStartOffset < offset) {
+ mReceiver.send(data, sysExStartOffset,
+ offset - sysExStartOffset, timestamp);
+ }
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiInputPortSelector.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiInputPortSelector.java
new file mode 100644
index 0000000..818c688
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiInputPortSelector.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.app.Activity;
+import android.media.midi.MidiDevice;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiInputPort;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiReceiver;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Manages a Spinner for selecting a MidiInputPort.
+ */
+public class MidiInputPortSelector extends MidiPortSelector {
+
+ private MidiInputPort mInputPort;
+ private MidiDevice mOpenDevice;
+
+ /**
+ * @param midiManager
+ * @param activity
+ * @param spinnerId ID from the layout resource
+ */
+ public MidiInputPortSelector(MidiManager midiManager, Activity activity,
+ int spinnerId) {
+ super(midiManager, activity, spinnerId, MidiDeviceInfo.PortInfo.TYPE_INPUT);
+ }
+
+ @Override
+ public void onPortSelected(final MidiPortWrapper wrapper) {
+ close();
+ final MidiDeviceInfo info = wrapper.getDeviceInfo();
+ if (info != null) {
+ mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
+ @Override
+ public void onDeviceOpened(MidiDevice device) {
+ if (device == null) {
+ Log.e(MidiConstants.TAG, "could not open " + info);
+ } else {
+ mOpenDevice = device;
+ mInputPort = mOpenDevice.openInputPort(
+ wrapper.getPortIndex());
+ if (mInputPort == null) {
+ Log.e(MidiConstants.TAG, "could not open input port on " + info);
+ }
+ }
+ }
+ }, null);
+ // Don't run the callback on the UI thread because openInputPort might take a while.
+ }
+ }
+
+ public MidiReceiver getReceiver() {
+ return mInputPort;
+ }
+
+ @Override
+ public void onClose() {
+ try {
+ if (mInputPort != null) {
+ Log.i(MidiConstants.TAG, "MidiInputPortSelector.onClose() - close port");
+ mInputPort.close();
+ }
+ mInputPort = null;
+ if (mOpenDevice != null) {
+ mOpenDevice.close();
+ }
+ mOpenDevice = null;
+ } catch (IOException e) {
+ Log.e(MidiConstants.TAG, "cleanup failed", e);
+ }
+ super.onClose();
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortConnectionSelector.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortConnectionSelector.java
new file mode 100644
index 0000000..e3959ca
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortConnectionSelector.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.app.Activity;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiManager;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Select an output port and connect it to a destination input port.
+ */
+public class MidiOutputPortConnectionSelector extends MidiPortSelector {
+ public final static String TAG = "MidiOutputPortConnectionSelector";
+ private MidiPortConnector mSynthConnector;
+ private MidiDeviceInfo mDestinationDeviceInfo;
+ private int mDestinationPortIndex;
+ private MidiPortWrapper mLastWrapper;
+ private MidiPortConnector.OnPortsConnectedListener mConnectedListener;
+
+ /**
+ * Create a selector for connecting to the destination input port.
+ *
+ * @param midiManager
+ * @param activity
+ * @param spinnerId
+ * @param destinationDeviceInfo
+ * @param destinationPortIndex
+ */
+ public MidiOutputPortConnectionSelector(MidiManager midiManager,
+ Activity activity, int spinnerId,
+ MidiDeviceInfo destinationDeviceInfo, int destinationPortIndex) {
+ super(midiManager, activity, spinnerId,
+ MidiDeviceInfo.PortInfo.TYPE_OUTPUT);
+ mDestinationDeviceInfo = destinationDeviceInfo;
+ mDestinationPortIndex = destinationPortIndex;
+ }
+
+ @Override
+ public void onPortSelected(final MidiPortWrapper wrapper) {
+ if(!wrapper.equals(mLastWrapper)) {
+ onClose();
+ if (wrapper.getDeviceInfo() != null) {
+ mSynthConnector = new MidiPortConnector(mMidiManager);
+ mSynthConnector.connectToDevicePort(wrapper.getDeviceInfo(),
+ wrapper.getPortIndex(), mDestinationDeviceInfo,
+ mDestinationPortIndex,
+ // not safe on UI thread
+ mConnectedListener, null);
+ }
+ }
+ mLastWrapper = wrapper;
+ }
+
+ @Override
+ public void onClose() {
+ try {
+ if (mSynthConnector != null) {
+ mSynthConnector.close();
+ mSynthConnector = null;
+ }
+ } catch (IOException e) {
+ Log.e(MidiConstants.TAG, "Exception in closeSynthResources()", e);
+ }
+ super.onClose();
+ }
+
+ /**
+ * @param connectedListener
+ */
+ public void setConnectedListener(
+ MidiPortConnector.OnPortsConnectedListener connectedListener) {
+ mConnectedListener = connectedListener;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortSelector.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortSelector.java
new file mode 100644
index 0000000..1272f8c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiOutputPortSelector.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.app.Activity;
+import android.media.midi.MidiDevice;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiOutputPort;
+import android.media.midi.MidiSender;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Manages a Spinner for selecting a MidiOutputPort.
+ */
+public class MidiOutputPortSelector extends MidiPortSelector {
+ public final static String TAG = "MidiOutputPortSelector";
+ private MidiOutputPort mOutputPort;
+ private MidiDispatcher mDispatcher = new MidiDispatcher();
+ private MidiDevice mOpenDevice;
+
+ /**
+ * @param midiManager
+ * @param activity
+ * @param spinnerId ID from the layout resource
+ */
+ public MidiOutputPortSelector(MidiManager midiManager, Activity activity,
+ int spinnerId) {
+ super(midiManager, activity, spinnerId, MidiDeviceInfo.PortInfo.TYPE_OUTPUT);
+ }
+
+ @Override
+ public void onPortSelected(final MidiPortWrapper wrapper) {
+ close();
+
+ final MidiDeviceInfo info = wrapper.getDeviceInfo();
+ if (info != null) {
+ mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
+
+ @Override
+ public void onDeviceOpened(MidiDevice device) {
+ if (device == null) {
+ Log.e(MidiConstants.TAG, "could not open " + info);
+ } else {
+ mOpenDevice = device;
+ mOutputPort = device.openOutputPort(wrapper.getPortIndex());
+ if (mOutputPort == null) {
+ Log.e(MidiConstants.TAG,
+ "could not open output port for " + info);
+ return;
+ }
+ mOutputPort.connect(mDispatcher);
+ }
+ }
+ }, null);
+ // Don't run the callback on the UI thread because openOutputPort might take a while.
+ }
+ }
+
+ @Override
+ public void onClose() {
+ try {
+ if (mOutputPort != null) {
+ mOutputPort.disconnect(mDispatcher);
+ }
+ mOutputPort = null;
+ if (mOpenDevice != null) {
+ mOpenDevice.close();
+ }
+ mOpenDevice = null;
+ } catch (IOException e) {
+ Log.e(MidiConstants.TAG, "cleanup failed", e);
+ }
+ super.onClose();
+ }
+
+ /**
+ * You can connect your MidiReceivers to this sender. The user will then select which output
+ * port will send messages through this MidiSender.
+ * @return a MidiSender that will send the messages from the selected port.
+ */
+ public MidiSender getSender() {
+ return mDispatcher.getSender();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortConnector.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortConnector.java
new file mode 100644
index 0000000..ebff022
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortConnector.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiDevice;
+import android.media.midi.MidiDevice.MidiConnection;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiInputPort;
+import android.media.midi.MidiManager;
+import android.os.Handler;
+import android.util.Log;
+
+import java.io.IOException;
+
+/**
+ * Tool for connecting MIDI ports on two remote devices.
+ */
+public class MidiPortConnector {
+ private final MidiManager mMidiManager;
+ private MidiDevice mSourceDevice;
+ private MidiDevice mDestinationDevice;
+ private MidiConnection mConnection;
+
+ /**
+ * @param midiManager
+ */
+ public MidiPortConnector(MidiManager midiManager) {
+ mMidiManager = midiManager;
+ }
+
+ public void close() throws IOException {
+ if (mConnection != null) {
+ Log.i(MidiConstants.TAG,
+ "MidiPortConnector closing connection " + mConnection);
+ mConnection.close();
+ mConnection = null;
+ }
+ if (mSourceDevice != null) {
+ mSourceDevice.close();
+ mSourceDevice = null;
+ }
+ if (mDestinationDevice != null) {
+ mDestinationDevice.close();
+ mDestinationDevice = null;
+ }
+ }
+
+ private void safeClose() {
+ try {
+ close();
+ } catch (IOException e) {
+ Log.e(MidiConstants.TAG, "could not close resources", e);
+ }
+ }
+
+ /**
+ * Listener class used for receiving the results of
+ * {@link #connectToDevicePort}
+ */
+ public interface OnPortsConnectedListener {
+ /**
+ * Called to respond to a {@link #connectToDevicePort} request
+ *
+ * @param connection
+ * a {@link MidiConnection} that represents the connected
+ * ports, or null if connection failed
+ */
+ abstract public void onPortsConnected(MidiConnection connection);
+ }
+
+ /**
+ * Open two devices and connect their ports.
+ *
+ * @param sourceDeviceInfo
+ * @param sourcePortIndex
+ * @param destinationDeviceInfo
+ * @param destinationPortIndex
+ */
+ public void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo,
+ final int sourcePortIndex,
+ final MidiDeviceInfo destinationDeviceInfo,
+ final int destinationPortIndex) {
+ connectToDevicePort(sourceDeviceInfo, sourcePortIndex,
+ destinationDeviceInfo, destinationPortIndex, null, null);
+ }
+
+ /**
+ * Open two devices and connect their ports.
+ * Then notify listener of the result.
+ *
+ * @param sourceDeviceInfo
+ * @param sourcePortIndex
+ * @param destinationDeviceInfo
+ * @param destinationPortIndex
+ * @param listener
+ * @param handler
+ */
+ public void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo,
+ final int sourcePortIndex,
+ final MidiDeviceInfo destinationDeviceInfo,
+ final int destinationPortIndex,
+ final OnPortsConnectedListener listener, final Handler handler) {
+ safeClose();
+ mMidiManager.openDevice(destinationDeviceInfo,
+ new MidiManager.OnDeviceOpenedListener() {
+ @Override
+ public void onDeviceOpened(MidiDevice destinationDevice) {
+ if (destinationDevice == null) {
+ Log.e(MidiConstants.TAG,
+ "could not open " + destinationDeviceInfo);
+ if (listener != null) {
+ listener.onPortsConnected(null);
+ }
+ } else {
+ mDestinationDevice = destinationDevice;
+ Log.i(MidiConstants.TAG,
+ "connectToDevicePort opened "
+ + destinationDeviceInfo);
+ // Destination device was opened so go to next step.
+ MidiInputPort destinationInputPort = destinationDevice
+ .openInputPort(destinationPortIndex);
+ if (destinationInputPort != null) {
+ Log.i(MidiConstants.TAG,
+ "connectToDevicePort opened port on "
+ + destinationDeviceInfo);
+ connectToDevicePort(sourceDeviceInfo,
+ sourcePortIndex,
+ destinationInputPort,
+ listener, handler);
+ } else {
+ Log.e(MidiConstants.TAG,
+ "could not open port on "
+ + destinationDeviceInfo);
+ safeClose();
+ if (listener != null) {
+ listener.onPortsConnected(null);
+ }
+ }
+ }
+ }
+ }, handler);
+ }
+
+
+ /**
+ * Open a source device and connect its output port to the
+ * destinationInputPort.
+ *
+ * @param sourceDeviceInfo
+ * @param sourcePortIndex
+ * @param destinationInputPort
+ */
+ private void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo,
+ final int sourcePortIndex,
+ final MidiInputPort destinationInputPort,
+ final OnPortsConnectedListener listener, final Handler handler) {
+ mMidiManager.openDevice(sourceDeviceInfo,
+ new MidiManager.OnDeviceOpenedListener() {
+ @Override
+ public void onDeviceOpened(MidiDevice device) {
+ if (device == null) {
+ Log.e(MidiConstants.TAG,
+ "could not open " + sourceDeviceInfo);
+ safeClose();
+ if (listener != null) {
+ listener.onPortsConnected(null);
+ }
+ } else {
+ Log.i(MidiConstants.TAG,
+ "connectToDevicePort opened "
+ + sourceDeviceInfo);
+ // Device was opened so connect the ports.
+ mSourceDevice = device;
+ mConnection = device.connectPorts(
+ destinationInputPort, sourcePortIndex);
+ if (mConnection == null) {
+ Log.e(MidiConstants.TAG, "could not connect to "
+ + sourceDeviceInfo);
+ safeClose();
+ }
+ if (listener != null) {
+ listener.onPortsConnected(mConnection);
+ }
+ }
+ }
+ }, handler);
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortSelector.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortSelector.java
new file mode 100644
index 0000000..f020514
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortSelector.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.app.Activity;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceStatus;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiManager.DeviceCallback;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+
+import java.util.HashSet;
+
+/**
+ * Base class that uses a Spinner to select available MIDI ports.
+ */
+public abstract class MidiPortSelector extends DeviceCallback {
+ private int mType = MidiDeviceInfo.PortInfo.TYPE_INPUT;
+ protected ArrayAdapter<MidiPortWrapper> mAdapter;
+ protected HashSet<MidiPortWrapper> mBusyPorts = new HashSet<MidiPortWrapper>();
+ private Spinner mSpinner;
+ protected MidiManager mMidiManager;
+ protected Activity mActivity;
+ private MidiPortWrapper mCurrentWrapper;
+
+ /**
+ * @param midiManager
+ * @param activity
+ * @param spinnerId
+ * ID from the layout resource
+ * @param type
+ * TYPE_INPUT or TYPE_OUTPUT
+ */
+ public MidiPortSelector(MidiManager midiManager, Activity activity,
+ int spinnerId, int type) {
+ mMidiManager = midiManager;
+ mActivity = activity;
+ mType = type;
+ mAdapter = new ArrayAdapter<MidiPortWrapper>(activity,
+ android.R.layout.simple_spinner_item);
+ mAdapter.setDropDownViewResource(
+ android.R.layout.simple_spinner_dropdown_item);
+ mAdapter.add(new MidiPortWrapper(null, 0, 0));
+
+ mSpinner = (Spinner) activity.findViewById(spinnerId);
+ mSpinner.setOnItemSelectedListener(
+ new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView<?> parent, View view,
+ int pos, long id) {
+ mCurrentWrapper = mAdapter.getItem(pos);
+ onPortSelected(mCurrentWrapper);
+ }
+
+ public void onNothingSelected(AdapterView<?> parent) {
+ onPortSelected(null);
+ mCurrentWrapper = null;
+ }
+ });
+ mSpinner.setAdapter(mAdapter);
+
+ MidiDeviceMonitor.getInstance(mMidiManager).registerDeviceCallback(this,
+ new Handler(Looper.getMainLooper()));
+
+ MidiDeviceInfo[] infos = mMidiManager.getDevices();
+ for (MidiDeviceInfo info : infos) {
+ onDeviceAdded(info);
+ }
+ }
+
+ /**
+ * Set to no port selected.
+ */
+ public void clearSelection() {
+ mSpinner.setSelection(0);
+ }
+
+ private int getInfoPortCount(final MidiDeviceInfo info) {
+ int portCount = (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT)
+ ? info.getInputPortCount() : info.getOutputPortCount();
+ return portCount;
+ }
+
+ @Override
+ public void onDeviceAdded(final MidiDeviceInfo info) {
+ int portCount = getInfoPortCount(info);
+ for (int i = 0; i < portCount; ++i) {
+ MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);
+ mAdapter.add(wrapper);
+ Log.i(MidiConstants.TAG, wrapper + " was added to " + this);
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+
+ @Override
+ public void onDeviceRemoved(final MidiDeviceInfo info) {
+ int portCount = getInfoPortCount(info);
+ for (int i = 0; i < portCount; ++i) {
+ MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);
+ MidiPortWrapper currentWrapper = mCurrentWrapper;
+ mAdapter.remove(wrapper);
+ // If the currently selected port was removed then select no port.
+ if (wrapper.equals(currentWrapper)) {
+ clearSelection();
+ }
+ mAdapter.notifyDataSetChanged();
+ Log.i(MidiConstants.TAG, wrapper + " was removed");
+ }
+ }
+
+ @Override
+ public void onDeviceStatusChanged(final MidiDeviceStatus status) {
+ // If an input port becomes busy then remove it from the menu.
+ // If it becomes free then add it back to the menu.
+ if (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT) {
+ MidiDeviceInfo info = status.getDeviceInfo();
+ Log.i(MidiConstants.TAG, "MidiPortSelector.onDeviceStatusChanged status = " + status
+ + ", mType = " + mType
+ + ", activity = " + mActivity.getPackageName()
+ + ", info = " + info);
+ // Look for transitions from free to busy.
+ int portCount = info.getInputPortCount();
+ for (int i = 0; i < portCount; ++i) {
+ MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);
+ if (!wrapper.equals(mCurrentWrapper)) {
+ if (status.isInputPortOpen(i)) { // busy?
+ if (!mBusyPorts.contains(wrapper)) {
+ // was free, now busy
+ mBusyPorts.add(wrapper);
+ mAdapter.remove(wrapper);
+ mAdapter.notifyDataSetChanged();
+ }
+ } else {
+ if (mBusyPorts.remove(wrapper)) {
+ // was busy, now free
+ mAdapter.add(wrapper);
+ mAdapter.notifyDataSetChanged();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Implement this method to handle the user selecting a port on a device.
+ *
+ * @param wrapper
+ */
+ public abstract void onPortSelected(MidiPortWrapper wrapper);
+
+ /**
+ * Implement this method to clean up any open resources.
+ */
+ public void onClose() {
+ }
+
+ /**
+ * Implement this method to clean up any open resources.
+ */
+ public void onDestroy() {
+ MidiDeviceMonitor.getInstance(mMidiManager).unregisterDeviceCallback(this);
+ }
+
+ /**
+ *
+ */
+ public void close() {
+ onClose();
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortWrapper.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortWrapper.java
new file mode 100644
index 0000000..bf48d77
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiPortWrapper.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceInfo.PortInfo;
+
+public class MidiPortWrapper {
+ private MidiDeviceInfo mInfo;
+ private int mPortIndex;
+ private int mType;
+ private String mString;
+
+ /**
+ * Wrapper for a MIDI device and port description.
+ * @param info
+ * @param portType
+ * @param portIndex
+ */
+ public MidiPortWrapper(MidiDeviceInfo info, int portType, int portIndex) {
+ mInfo = info;
+ mType = portType;
+ mPortIndex = portIndex;
+ }
+
+ private void updateString() {
+ if (mInfo == null) {
+ mString = "- - - - - -";
+ } else {
+ StringBuilder sb = new StringBuilder();
+ String name = mInfo.getProperties()
+ .getString(MidiDeviceInfo.PROPERTY_NAME);
+ if (name == null) {
+ name = mInfo.getProperties()
+ .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER) + ", "
+ + mInfo.getProperties()
+ .getString(MidiDeviceInfo.PROPERTY_PRODUCT);
+ }
+ sb.append("#" + mInfo.getId());
+ sb.append(", ").append(name);
+ PortInfo portInfo = findPortInfo();
+ sb.append("[" + mPortIndex + "]");
+ if (portInfo != null) {
+ sb.append(", ").append(portInfo.getName());
+ } else {
+ sb.append(", null");
+ }
+ mString = sb.toString();
+ }
+ }
+
+ /**
+ * @param info
+ * @param portIndex
+ * @return
+ */
+ private PortInfo findPortInfo() {
+ PortInfo[] ports = mInfo.getPorts();
+ for (PortInfo portInfo : ports) {
+ if (portInfo.getPortNumber() == mPortIndex
+ && portInfo.getType() == mType) {
+ return portInfo;
+ }
+ }
+ return null;
+ }
+
+ public int getPortIndex() {
+ return mPortIndex;
+ }
+
+ public MidiDeviceInfo getDeviceInfo() {
+ return mInfo;
+ }
+
+ @Override
+ public String toString() {
+ if (mString == null) {
+ updateString();
+ }
+ return mString;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (!(other instanceof MidiPortWrapper))
+ return false;
+ MidiPortWrapper otherWrapper = (MidiPortWrapper) other;
+ if (mPortIndex != otherWrapper.mPortIndex)
+ return false;
+ if (mType != otherWrapper.mType)
+ return false;
+ if (mInfo == null)
+ return (otherWrapper.mInfo == null);
+ return mInfo.equals(otherWrapper.mInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+ hashCode = 31 * hashCode + mPortIndex;
+ hashCode = 31 * hashCode + mType;
+ hashCode = 31 * hashCode + mInfo.hashCode();
+ return hashCode;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiTools.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiTools.java
new file mode 100644
index 0000000..c759c0c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MidiTools.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+package com.mobileer.miditools;
+
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiManager;
+
+/**
+ * Miscellaneous tools for Android MIDI.
+ */
+public class MidiTools {
+
+ /**
+ * @return a device that matches the manufacturer and product or null
+ */
+ public static MidiDeviceInfo findDevice(MidiManager midiManager,
+ String manufacturer, String product) {
+ for (MidiDeviceInfo info : midiManager.getDevices()) {
+ String deviceManufacturer = info.getProperties()
+ .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER);
+ if ((manufacturer != null)
+ && manufacturer.equals(deviceManufacturer)) {
+ String deviceProduct = info.getProperties()
+ .getString(MidiDeviceInfo.PROPERTY_PRODUCT);
+ if ((product != null) && product.equals(deviceProduct)) {
+ return info;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MusicKeyboardView.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MusicKeyboardView.java
new file mode 100644
index 0000000..e9eee7f
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/MusicKeyboardView.java
@@ -0,0 +1,384 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * View that displays a traditional piano style keyboard. Finger presses are reported to a
+ * MusicKeyListener. Keys that pressed are highlighted. Running a finger along the top of the
+ * keyboard will only hit black keys. Running a finger along the bottom of the keyboard will only
+ * hit white keys.
+ */
+public class MusicKeyboardView extends View {
+ // Adjust proportions of the keys.
+ private static final int WHITE_KEY_GAP = 10;
+ private static final int PITCH_MIDDLE_C = 60;
+ private static final int NOTES_PER_OCTAVE = 12;
+ private static final int[] WHITE_KEY_OFFSETS = {
+ 0, 2, 4, 5, 7, 9, 11
+ };
+ private static final double BLACK_KEY_HEIGHT_FACTOR = 0.60;
+ private static final double BLACK_KEY_WIDTH_FACTOR = 0.6;
+ private static final double BLACK_KEY_OFFSET_FACTOR = 0.18;
+
+ private static final int[] BLACK_KEY_HORIZONTAL_OFFSETS = {
+ -1, 1, -1, 0, 1
+ };
+ private static final boolean[] NOTE_IN_OCTAVE_IS_BLACK = {
+ false, true,
+ false, true,
+ false, false, true,
+ false, true,
+ false, true,
+ false
+ };
+
+ // Preferences
+ private int mNumKeys;
+ private int mNumPortraitKeys = NOTES_PER_OCTAVE + 1;
+ private int mNumLandscapeKeys = (2 * NOTES_PER_OCTAVE) + 1;
+ private int mNumWhiteKeys = 15;
+
+ // Geometry.
+ private int mWidth;
+ private int mHeight;
+ private int mWhiteKeyWidth;
+ private double mBlackKeyWidth;
+ // Y position of bottom of black keys.
+ private int mBlackBottom;
+ private Rect[] mBlackKeyRectangles;
+
+ // Keyboard state
+ private boolean[] mNotesOnByPitch = new boolean[128];
+
+ // Appearance
+ private Paint mShadowPaint;
+ private Paint mBlackOnKeyPaint;
+ private Paint mBlackOffKeyPaint;
+ private Paint mWhiteOnKeyPaint;
+ private Paint mWhiteOffKeyPaint;
+ private boolean mLegato = true;
+
+ private HashMap<Integer, Integer> mFingerMap = new HashMap<Integer, Integer>();
+ // Note number for the left most key.
+ private int mLowestPitch = PITCH_MIDDLE_C - NOTES_PER_OCTAVE;
+ private ArrayList<MusicKeyListener> mListeners = new ArrayList<MusicKeyListener>();
+
+ /** Implement this to receive keyboard events. */
+ public interface MusicKeyListener {
+ /** This will be called when a key is pressed. */
+ public void onKeyDown(int keyIndex);
+
+ /** This will be called when a key is pressed. */
+ public void onKeyUp(int keyIndex);
+ }
+
+ public MusicKeyboardView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ void init() {
+ mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mShadowPaint.setStyle(Paint.Style.FILL);
+ mShadowPaint.setColor(0xFF707070);
+
+ mBlackOnKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBlackOnKeyPaint.setStyle(Paint.Style.FILL);
+ mBlackOnKeyPaint.setColor(0xFF2020E0);
+
+ mBlackOffKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mBlackOffKeyPaint.setStyle(Paint.Style.FILL);
+ mBlackOffKeyPaint.setColor(0xFF202020);
+
+ mWhiteOnKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mWhiteOnKeyPaint.setStyle(Paint.Style.FILL);
+ mWhiteOnKeyPaint.setColor(0xFF6060F0);
+
+ mWhiteOffKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mWhiteOffKeyPaint.setStyle(Paint.Style.FILL);
+ mWhiteOffKeyPaint.setColor(0xFFF0F0F0);
+
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ mWidth = w;
+ mHeight = h;
+ mNumKeys = (mHeight > mWidth) ? mNumPortraitKeys : mNumLandscapeKeys;
+ mNumWhiteKeys = 0;
+ // Count white keys.
+ for (int i = 0; i < mNumKeys; i++) {
+ int pitch = mLowestPitch + i;
+ if (!isPitchBlack(pitch)) {
+ mNumWhiteKeys++;
+ }
+ }
+
+ mWhiteKeyWidth = mWidth / mNumWhiteKeys;
+ mBlackKeyWidth = mWhiteKeyWidth * BLACK_KEY_WIDTH_FACTOR;
+ mBlackBottom = (int) (mHeight * BLACK_KEY_HEIGHT_FACTOR);
+
+ makeBlackRectangles();
+ }
+
+ private void makeBlackRectangles() {
+ int top = 0;
+ ArrayList<Rect> rectangles = new ArrayList<Rect>();
+
+ int whiteKeyIndex = 0;
+ int blackKeyIndex = 0;
+ for (int i = 0; i < mNumKeys; i++) {
+ int x = mWhiteKeyWidth * whiteKeyIndex;
+ int pitch = mLowestPitch + i;
+ int note = pitch % NOTES_PER_OCTAVE;
+ if (NOTE_IN_OCTAVE_IS_BLACK[note]) {
+ double offset = BLACK_KEY_OFFSET_FACTOR
+ * BLACK_KEY_HORIZONTAL_OFFSETS[blackKeyIndex % 5];
+ int left = (int) (x - mBlackKeyWidth * (0.6 - offset));
+ left += WHITE_KEY_GAP / 2;
+ int right = (int) (left + mBlackKeyWidth);
+ Rect rect = new Rect(left, top, right, mBlackBottom);
+ rectangles.add(rect);
+ blackKeyIndex++;
+ } else {
+ whiteKeyIndex++;
+ }
+ }
+ mBlackKeyRectangles = rectangles.toArray(new Rect[0]);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ int whiteKeyIndex = 0;
+ canvas.drawRect(0, 0, mWidth, mHeight, mShadowPaint);
+ // Draw white keys first.
+ for (int i = 0; i < mNumKeys; i++) {
+ int pitch = mLowestPitch + i;
+ int note = pitch % NOTES_PER_OCTAVE;
+ if (!NOTE_IN_OCTAVE_IS_BLACK[note]) {
+ int x = (mWhiteKeyWidth * whiteKeyIndex) + (WHITE_KEY_GAP / 2);
+ Paint paint = mNotesOnByPitch[pitch] ? mWhiteOnKeyPaint
+ : mWhiteOffKeyPaint;
+ canvas.drawRect(x, 0, x + mWhiteKeyWidth - WHITE_KEY_GAP, mHeight,
+ paint);
+ whiteKeyIndex++;
+ }
+ }
+ // Then draw black keys over the white keys.
+ int blackKeyIndex = 0;
+ for (int i = 0; i < mNumKeys; i++) {
+ int pitch = mLowestPitch + i;
+ int note = pitch % NOTES_PER_OCTAVE;
+ if (NOTE_IN_OCTAVE_IS_BLACK[note]) {
+ Rect r = mBlackKeyRectangles[blackKeyIndex];
+ Paint paint = mNotesOnByPitch[pitch] ? mBlackOnKeyPaint
+ : mBlackOffKeyPaint;
+ canvas.drawRect(r, paint);
+ blackKeyIndex++;
+ }
+ }
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ super.onTouchEvent(event);
+ int action = event.getActionMasked();
+ // Track individual fingers.
+ int pointerIndex = event.getActionIndex();
+ int id = event.getPointerId(pointerIndex);
+ // Get the pointer's current position
+ float x = event.getX(pointerIndex);
+ float y = event.getY(pointerIndex);
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ onFingerDown(id, x, y);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ onFingerMove(id, x, y);
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_POINTER_UP:
+ onFingerUp(id, x, y);
+ break;
+ }
+ // Must return true or we do not get the ACTION_MOVE and
+ // ACTION_UP events.
+ return true;
+ }
+
+ private void onFingerDown(int id, float x, float y) {
+ int pitch = xyToPitch(x, y);
+ fireKeyDown(pitch);
+ mFingerMap.put(id, pitch);
+ }
+
+ private void onFingerMove(int id, float x, float y) {
+ Integer previousPitch = mFingerMap.get(id);
+ if (previousPitch != null) {
+ int pitch = -1;
+ if (y < mBlackBottom) {
+ // Only hit black keys if above line.
+ pitch = xyToBlackPitch(x, y);
+ } else {
+ pitch = xToWhitePitch(x);
+ }
+ // Did we change to a new key.
+ if ((pitch >= 0) && (pitch != previousPitch)) {
+ if (mLegato) {
+ fireKeyDown(pitch);
+ fireKeyUp(previousPitch);
+ } else {
+ fireKeyUp(previousPitch);
+ fireKeyDown(pitch);
+ }
+ mFingerMap.put(id, pitch);
+ }
+ }
+ }
+
+ private void onFingerUp(int id, float x, float y) {
+ Integer previousPitch = mFingerMap.get(id);
+ if (previousPitch != null) {
+ fireKeyUp(previousPitch);
+ mFingerMap.remove(id);
+ } else {
+ int pitch = xyToPitch(x, y);
+ fireKeyUp(pitch);
+ }
+ }
+
+ private void fireKeyDown(int pitch) {
+ for (MusicKeyListener listener : mListeners) {
+ listener.onKeyDown(pitch);
+ }
+ mNotesOnByPitch[pitch] = true;
+ invalidate();
+ }
+
+ private void fireKeyUp(int pitch) {
+ for (MusicKeyListener listener : mListeners) {
+ listener.onKeyUp(pitch);
+ }
+ mNotesOnByPitch[pitch] = false;
+ invalidate();
+ }
+
+ private int xyToPitch(float x, float y) {
+ int pitch = -1;
+ if (y < mBlackBottom) {
+ pitch = xyToBlackPitch(x, y);
+ }
+ if (pitch < 0) {
+ pitch = xToWhitePitch(x);
+ }
+ return pitch;
+ }
+
+ private boolean isPitchBlack(int pitch) {
+ int note = pitch % NOTES_PER_OCTAVE;
+ return NOTE_IN_OCTAVE_IS_BLACK[note];
+ }
+
+ // Convert x to MIDI pitch. Ignores black keys.
+ private int xToWhitePitch(float x) {
+ int whiteKeyIndex = (int) (x / mWhiteKeyWidth);
+ int octave = whiteKeyIndex / WHITE_KEY_OFFSETS.length;
+ int indexInOctave = whiteKeyIndex - (octave * WHITE_KEY_OFFSETS.length);
+ int pitch = mLowestPitch + (octave * NOTES_PER_OCTAVE) +
+ WHITE_KEY_OFFSETS[indexInOctave];
+ return pitch;
+ }
+
+ // Convert x to MIDI pitch. Ignores white keys.
+ private int xyToBlackPitch(float x, float y) {
+ int result = -1;
+ int blackKeyIndex = 0;
+ for (int i = 0; i < mNumKeys; i++) {
+ int pitch = mLowestPitch + i;
+ if (isPitchBlack(pitch)) {
+ Rect rect = mBlackKeyRectangles[blackKeyIndex];
+ if (rect.contains((int) x, (int) y)) {
+ result = pitch;
+ break;
+ }
+ blackKeyIndex++;
+ }
+ }
+ return result;
+ }
+
+ public void addMusicKeyListener(MusicKeyListener musicKeyListener) {
+ mListeners.add(musicKeyListener);
+ }
+
+ public void removeMusicKeyListener(MusicKeyListener musicKeyListener) {
+ mListeners.remove(musicKeyListener);
+ }
+
+ /**
+ * Set the pitch of the lowest, leftmost key. If you set it to a black key then it will get
+ * adjusted upwards to a white key. Forces a redraw.
+ */
+ public void setLowestPitch(int pitch) {
+ if (isPitchBlack(pitch)) {
+ pitch++; // force to next white key
+ }
+ mLowestPitch = pitch;
+ postInvalidate();
+ }
+
+ public int getLowestPitch() {
+ return mLowestPitch;
+ }
+
+ /**
+ * Set the number of white keys in portrait mode.
+ */
+ public void setNumPortraitKeys(int numPortraitKeys) {
+ mNumPortraitKeys = numPortraitKeys;
+ postInvalidate();
+ }
+
+ public int getNumPortraitKeys() {
+ return mNumPortraitKeys;
+ }
+
+ /**
+ * Set the number of white keys in landscape mode.
+ */
+ public void setNumLandscapeKeys(int numLandscapeKeys) {
+ mNumLandscapeKeys = numLandscapeKeys;
+ postInvalidate();
+ }
+
+ public int getNumLandscapeKeys() {
+ return mNumLandscapeKeys;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/AudioLatencyTuner.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/AudioLatencyTuner.java
new file mode 100644
index 0000000..dd51268
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/AudioLatencyTuner.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+import android.media.AudioAttributes;
+import android.media.AudioTrack;
+import android.util.Log;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Optimize the buffer size for an AudioTrack based on the underrun count.
+ * <p/>
+ * This feature was added in N. So we check for the methods using reflection.
+ * If you are targeting N or later then you could just call the new methods directly.
+ */
+public class AudioLatencyTuner {
+ private static final String TAG = "AudioLatencyTuner";
+ private static final int STATE_PRIMING = 0;
+ private static final int STATE_LOWERING = 1;
+ private static final int STATE_RAISING = 2;
+
+ private static boolean mLowLatencySupported; // N or later?
+
+ // These are found using reflection.
+ private static int mFlagLowLatency; // AudioAttributes.FLAG_LOW_LATENCY
+ private static Method mSetBufferSizeMethod = null;
+ private static Method mGetBufferCapacityMethod = null;
+ private static Method mGetUnderrunCountMethod = null;
+
+ private final int mInitialSize;
+ private final AudioTrack mAudioTrack;
+ private final int mFramesPerBlock;
+
+ private int mState = STATE_PRIMING;
+ private int mPreviousUnderrunCount;
+
+ static {
+ reflectAdvancedMethods();
+ }
+
+ public AudioLatencyTuner(AudioTrack track, int framesPerBlock) {
+ mAudioTrack = track;
+ mInitialSize = track.getBufferSizeInFrames();
+ mFramesPerBlock = framesPerBlock;
+ reset();
+ }
+
+ /**
+ * Use Java reflection to find the methods added in the N release.
+ */
+ private static void reflectAdvancedMethods() {
+ try {
+ Field field = AudioAttributes.class.getField("FLAG_LOW_LATENCY");
+ mFlagLowLatency = field.getInt(AudioAttributes.class);
+ mLowLatencySupported = true;
+ } catch (NoSuchFieldException e) {
+ mLowLatencySupported = false;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ Method[] methods = AudioTrack.class.getMethods();
+
+ for (Method method : methods) {
+ if (method.getName().equals("setBufferSizeInFrames")) {
+ mSetBufferSizeMethod = method;
+ break;
+ }
+ }
+
+ for (Method method : methods) {
+ if (method.getName().equals("getBufferCapacity")) {
+ mGetBufferCapacityMethod = method;
+ break;
+ }
+ }
+
+ for (Method method : methods) {
+ if (method.getName().equals("getXRunCount")) {
+ mGetUnderrunCountMethod = method;
+ break;
+ }
+ }
+ }
+
+ /**
+ * @return number of times the audio buffer underflowed and glitched.
+ */
+ public int getUnderrunCount() {
+ // Call using reflection.
+ if (mGetUnderrunCountMethod != null && mAudioTrack != null) {
+ try {
+ Object result = mGetUnderrunCountMethod.invoke(mAudioTrack);
+ int count = ((Integer) result).intValue();
+ return count;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * @return allocated size of the buffer
+ */
+ public int getBufferCapacityInFrames() {
+ if (mGetBufferCapacityMethod != null) {
+ try {
+ Object result = mGetBufferCapacityMethod.invoke(mAudioTrack);
+ int size = ((Integer) result).intValue();
+ return size;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ return mInitialSize;
+ }
+
+ /**
+ * Set the amount of the buffer capacity that we want to use.
+ * Lower values will reduce latency but may cause glitches.
+ * Note that you may not get the size you asked for.
+ *
+ * @return actual size of the buffer
+ */
+ public int setBufferSizeInFrames(int thresholdFrames) {
+ if (mSetBufferSizeMethod != null) {
+ try {
+ Object result = mSetBufferSizeMethod.invoke(mAudioTrack, thresholdFrames);
+ int actual = ((Integer) result).intValue();
+ return actual;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ return mInitialSize;
+ }
+
+ public int getBufferSizeInFrames() {
+ return mAudioTrack.getBufferSizeInFrames();
+ }
+
+ public static boolean isLowLatencySupported() {
+ return mLowLatencySupported;
+ }
+
+ public static int getLowLatencyFlag() {
+ return mFlagLowLatency;
+ }
+
+ public void reset() {
+ mState = STATE_PRIMING;
+ mPreviousUnderrunCount = 0;
+ setBufferSizeInFrames(mInitialSize);
+ }
+
+ /**
+ * This should be called after every write().
+ * It will lower the latency until there are underruns.
+ * Then it raises the latency until the underruns stop.
+ */
+ public void update() {
+ if (!mLowLatencySupported) {
+ return;
+ }
+ int nextState = mState;
+ int underrunCount;
+ switch (mState) {
+ case STATE_PRIMING:
+ if (mAudioTrack.getPlaybackHeadPosition() > (8 * mFramesPerBlock)) {
+ nextState = STATE_LOWERING;
+ mPreviousUnderrunCount = getUnderrunCount();
+ }
+ break;
+ case STATE_LOWERING:
+ underrunCount = getUnderrunCount();
+ if (underrunCount > mPreviousUnderrunCount) {
+ nextState = STATE_RAISING;
+ } else {
+ if (incrementThreshold(-1)) {
+ // If we hit bottom then start raising it back up.
+ nextState = STATE_RAISING;
+ }
+ }
+ mPreviousUnderrunCount = underrunCount;
+ break;
+ case STATE_RAISING:
+ underrunCount = getUnderrunCount();
+ if (underrunCount > mPreviousUnderrunCount) {
+ incrementThreshold(1);
+ }
+ mPreviousUnderrunCount = underrunCount;
+ break;
+ }
+ mState = nextState;
+ }
+
+ /**
+ * Raise or lower the buffer size in blocks.
+ * @return true if the size did not change
+ */
+ private boolean incrementThreshold(int deltaBlocks) {
+ int original = getBufferSizeInFrames();
+ int numBlocks = original / mFramesPerBlock;
+ numBlocks += deltaBlocks;
+ int target = numBlocks * mFramesPerBlock;
+ int actual = setBufferSizeInFrames(target);
+ Log.i(TAG, "Buffer size changed from " + original + " to " + actual);
+ return actual == original;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/EnvelopeADSR.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/EnvelopeADSR.java
new file mode 100644
index 0000000..a80d85d
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/EnvelopeADSR.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Very simple Attack, Decay, Sustain, Release envelope with linear ramps.
+ *
+ * Times are in seconds.
+ */
+public class EnvelopeADSR extends SynthUnit {
+ private static final int IDLE = 0;
+ private static final int ATTACK = 1;
+ private static final int DECAY = 2;
+ private static final int SUSTAIN = 3;
+ private static final int RELEASE = 4;
+ private static final int FINISHED = 5;
+ private static final float MIN_TIME = 0.001f;
+
+ private float mAttackRate;
+ private float mRreleaseRate;
+ private float mSustainLevel;
+ private float mDecayRate;
+ private float mCurrent;
+ private int mSstate = IDLE;
+ private int mSamplerate;
+
+ public EnvelopeADSR( int sampleRate) {
+ mSamplerate = sampleRate;
+ setAttackTime(0.003f);
+ setDecayTime(0.08f);
+ setSustainLevel(0.3f);
+ setReleaseTime(1.0f);
+ }
+
+
+
+ public void setAttackTime(float time) {
+ if (time < MIN_TIME)
+ time = MIN_TIME;
+ mAttackRate = 1.0f / (mSamplerate * time);
+ }
+
+ public void setDecayTime(float time) {
+ if (time < MIN_TIME)
+ time = MIN_TIME;
+ mDecayRate = 1.0f / (mSamplerate * time);
+ }
+
+ public void setSustainLevel(float level) {
+ if (level < 0.0f)
+ level = 0.0f;
+ mSustainLevel = level;
+ }
+
+ public void setReleaseTime(float time) {
+ if (time < MIN_TIME)
+ time = MIN_TIME;
+ mRreleaseRate = 1.0f / (mSamplerate * time);
+ }
+
+ public void on() {
+ mSstate = ATTACK;
+ }
+
+ public void off() {
+ mSstate = RELEASE;
+ }
+
+ @Override
+ public float render() {
+ switch (mSstate) {
+ case ATTACK:
+ mCurrent += mAttackRate;
+ if (mCurrent > 1.0f) {
+ mCurrent = 1.0f;
+ mSstate = DECAY;
+ }
+ break;
+ case DECAY:
+ mCurrent -= mDecayRate;
+ if (mCurrent < mSustainLevel) {
+ mCurrent = mSustainLevel;
+ mSstate = SUSTAIN;
+ }
+ break;
+ case RELEASE:
+ mCurrent -= mRreleaseRate;
+ if (mCurrent < 0.0f) {
+ mCurrent = 0.0f;
+ mSstate = FINISHED;
+ }
+ break;
+ }
+ return mCurrent;
+ }
+
+ public boolean isDone() {
+ return mSstate == FINISHED;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/LatencyController.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/LatencyController.java
new file mode 100644
index 0000000..21f7406
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/LatencyController.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Abstract control over the audio latency.
+ */
+public abstract class LatencyController {
+ private boolean mLowLatencyEnabled;
+ private boolean mAutoSizeEnabled;
+
+ public void setLowLatencyEnabled(boolean enabled) {
+ mLowLatencyEnabled = enabled;
+ }
+
+ public boolean isLowLatencyEnabled() {
+ return mLowLatencyEnabled;
+ }
+
+ /**
+ * If true then adjust latency to lowest value that does not produce underruns.
+ *
+ * @param enabled
+ */
+ public void setAutoSizeEnabled(boolean enabled) {
+ mAutoSizeEnabled = enabled;
+ }
+
+ public boolean isAutoSizeEnabled() {
+ return mAutoSizeEnabled;
+ }
+
+ /**
+ * @return true if this version supports the LOW_LATENCY flag
+ */
+ public abstract boolean isLowLatencySupported();
+
+ /**
+ * The amount of the buffer capacity that is being used.
+ * @return
+ */
+ public abstract int getBufferSizeInFrames();
+
+ /**
+ * The allocated size of the buffer.
+ * @return
+ */
+ public abstract int getBufferCapacityInFrames();
+
+ public abstract int getUnderrunCount();
+
+ /**
+ * When the output is running, the LOW_LATENCY flag cannot be set.
+ * @return
+ */
+ public abstract boolean isRunning();
+
+ /**
+ * Calculate the percentage of time that the a CPU is calculating data.
+ * @return percent CPU load
+ */
+ public abstract int getCpuLoad();
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillator.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillator.java
new file mode 100644
index 0000000..d393660
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillator.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+public class SawOscillator extends SynthUnit {
+ private float mPhase = 0.0f;
+ private float mPhaseIncrement = 0.01f;
+ private float mFrequency = 0.0f;
+ private float mFrequencyScaler = 1.0f;
+ private float mAmplitude = 1.0f;
+
+ public void setPitch(float pitch) {
+ float freq = (float) pitchToFrequency(pitch);
+ setFrequency(freq);
+ }
+
+ public void setFrequency(float frequency) {
+ mFrequency = frequency;
+ updatePhaseIncrement();
+ }
+
+ private void updatePhaseIncrement() {
+ mPhaseIncrement = 2.0f * mFrequency * mFrequencyScaler / 48000.0f;
+ }
+
+ public void setAmplitude(float amplitude) {
+ mAmplitude = amplitude;
+ }
+
+ public float getAmplitude() {
+ return mAmplitude;
+ }
+
+ public float getFrequencyScaler() {
+ return mFrequencyScaler;
+ }
+
+ public void setFrequencyScaler(float frequencyScaler) {
+ mFrequencyScaler = frequencyScaler;
+ updatePhaseIncrement();
+ }
+
+ float incrementWrapPhase() {
+ mPhase += mPhaseIncrement;
+ while (mPhase > 1.0) {
+ mPhase -= 2.0;
+ }
+ while (mPhase < -1.0) {
+ mPhase += 2.0;
+ }
+ return mPhase;
+ }
+
+ @Override
+ public float render() {
+ return incrementWrapPhase() * mAmplitude;
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillatorDPW.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillatorDPW.java
new file mode 100644
index 0000000..7c7af8d
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawOscillatorDPW.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Band limited sawtooth oscillator.
+ * This will have very little aliasing at high frequencies.
+ */
+public class SawOscillatorDPW extends SawOscillator {
+ private float mZ1 = 0.0f; // delayed values
+ private float mZ2 = 0.0f;
+ private float mScaler; // frequency dependent scaler
+ private final static float VERY_LOW_FREQ = 0.0000001f;
+
+ @Override
+ public void setFrequency(float freq) {
+ /* Calculate scaling based on frequency. */
+ freq = Math.abs(freq);
+ super.setFrequency(freq);
+ if (freq < VERY_LOW_FREQ) {
+ mScaler = (float) (0.125 * 44100 / VERY_LOW_FREQ);
+ } else {
+ mScaler = (float) (0.125 * 44100 / freq);
+ }
+ }
+
+ @Override
+ public float render() {
+ float phase = incrementWrapPhase();
+ /* Square the raw sawtooth. */
+ float squared = phase * phase;
+ float diffed = squared - mZ2;
+ mZ2 = mZ1;
+ mZ1 = squared;
+ return diffed * mScaler * getAmplitude();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawVoice.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawVoice.java
new file mode 100644
index 0000000..958dae0
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SawVoice.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Sawtooth oscillator with an ADSR.
+ */
+public class SawVoice extends SynthVoice {
+ private SawOscillator mOscillator;
+ private EnvelopeADSR mEnvelope;
+
+ public SawVoice(int sampleRate) {
+ mOscillator = createOscillator();
+ mEnvelope = new EnvelopeADSR(sampleRate);
+ }
+
+ protected SawOscillator createOscillator() {
+ return new SawOscillator();
+ }
+
+ @Override
+ public void noteOn(int noteIndex, int velocity) {
+ super.noteOn(noteIndex, velocity);
+ mOscillator.setPitch(noteIndex);
+ mOscillator.setAmplitude(getAmplitude());
+ mEnvelope.on();
+ }
+
+ @Override
+ public void noteOff() {
+ super.noteOff();
+ mEnvelope.off();
+ }
+
+ @Override
+ public void setFrequencyScaler(float scaler) {
+ mOscillator.setFrequencyScaler(scaler);
+ }
+
+ @Override
+ public float render() {
+ float output = mOscillator.render() * mEnvelope.render();
+ return output;
+ }
+
+ @Override
+ public boolean isDone() {
+ return mEnvelope.isDone();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SimpleAudioOutput.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SimpleAudioOutput.java
new file mode 100644
index 0000000..2064385
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SimpleAudioOutput.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+import android.annotation.TargetApi;
+import android.media.AudioAttributes;
+import android.media.AudioFormat;
+import android.media.AudioTrack;
+import android.os.Build;
+import android.util.Log;
+
+/**
+ * Simple base class for implementing audio output for examples.
+ * This can be sub-classed for experimentation or to redirect audio output.
+ */
+public class SimpleAudioOutput {
+
+ private static final String TAG = "SimpleAudioOutput";
+ public static final int SAMPLES_PER_FRAME = 2;
+ public static final int BYTES_PER_SAMPLE = 4; // float
+ public static final int BYTES_PER_FRAME = SAMPLES_PER_FRAME * BYTES_PER_SAMPLE;
+ // Arbitrary weighting factor for CPU load filter. Higher number for slower response.
+ private static final int LOAD_FILTER_SHIFT = 6;
+ private static final int LOAD_FILTER_SCALER = (1<<LOAD_FILTER_SHIFT) - 1;
+ // LOW_LATENCY_BUFFER_CAPACITY_IN_FRAMES is only used when we do low latency tuning.
+ // The *3 is because some devices have a 1 msec period. And at
+ // 48000 Hz that is 48, which is 16*3.
+ // The 512 is arbitrary. 512*3 gives us a 32 msec buffer at 48000 Hz.
+ // That is more than we need but not hugely wasteful.
+ private static final int LOW_LATENCY_BUFFER_CAPACITY_IN_FRAMES = 512 * 3;
+
+ private AudioTrack mAudioTrack;
+ private int mFrameRate;
+ private AudioLatencyTuner mLatencyTuner;
+ private MyLatencyController mLatencyController = new MyLatencyController();
+ private long previousBeginTime;
+ private volatile long filteredCpuInterval;
+ private volatile long filteredTotalInterval;
+
+ class MyLatencyController extends LatencyController
+ {
+ @Override
+ public boolean isLowLatencySupported() {
+ return AudioLatencyTuner.isLowLatencySupported();
+ }
+
+ @Override
+ public boolean isRunning() {
+ return mAudioTrack != null;
+ }
+
+ public void setAutoSizeEnabled(boolean enabled) {
+ super.setAutoSizeEnabled(enabled);
+ if (!enabled) {
+ AudioLatencyTuner tuner = mLatencyTuner;
+ if (tuner != null) {
+ tuner.reset();
+ }
+ }
+ }
+
+ @Override
+ public int getBufferSizeInFrames() {
+ AudioTrack track = mAudioTrack;
+ if (track != null) {
+ return track.getBufferSizeInFrames();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public int getBufferCapacityInFrames() {
+ AudioLatencyTuner tuner = mLatencyTuner;
+ if (tuner != null) {
+ return tuner.getBufferCapacityInFrames();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public int getUnderrunCount() {
+ AudioLatencyTuner tuner = mLatencyTuner;
+ if (tuner != null) {
+ return tuner.getUnderrunCount();
+ } else {
+ return 0;
+ }
+ }
+
+
+ @Override
+ public int getCpuLoad() {
+ int load = 0;
+ if (filteredTotalInterval > 0) {
+ load = (int) ((filteredCpuInterval * 100) / filteredTotalInterval);
+ }
+ return load;
+ }
+ }
+
+ /**
+ * Create an audio track then call play().
+ */
+ public void start(int framesPerBlock) {
+ stop();
+ mAudioTrack = createAudioTrack();
+
+ mLatencyTuner = new AudioLatencyTuner(mAudioTrack, framesPerBlock);
+ // Use frame rate chosen by the AudioTrack so that we can get a
+ // low latency fast mixer track.
+ mFrameRate = mAudioTrack.getSampleRate();
+ // AudioTrack will wait until it has enough data before starting.
+ mAudioTrack.play();
+ previousBeginTime = 0;
+ filteredCpuInterval = 0;
+ filteredTotalInterval = 0;
+ }
+
+ @TargetApi(Build.VERSION_CODES.M)
+ protected AudioTrack createAudioTrack() {
+ AudioAttributes.Builder attributesBuilder = new AudioAttributes.Builder()
+ .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
+ boolean doLowLatency = (AudioLatencyTuner.isLowLatencySupported()
+ && mLatencyController.isLowLatencyEnabled());
+ if (doLowLatency) {
+ Log.i(TAG, "createAudioTrack() using FLAG_LOW_LATENCY");
+ attributesBuilder.setFlags(AudioLatencyTuner.getLowLatencyFlag());
+ }
+ AudioAttributes attributes = attributesBuilder.build();
+
+ AudioFormat format = new AudioFormat.Builder()
+ .setEncoding(AudioFormat.ENCODING_PCM_FLOAT)
+ .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+ .build();
+ AudioTrack.Builder builder = new AudioTrack.Builder()
+ .setAudioAttributes(attributes)
+ .setAudioFormat(format);
+ if (doLowLatency) {
+ // Start with a bigger buffer because we can lower it later.
+ int bufferSizeInFrames = LOW_LATENCY_BUFFER_CAPACITY_IN_FRAMES;
+ builder.setBufferSizeInBytes(bufferSizeInFrames * BYTES_PER_FRAME);
+ }
+ AudioTrack track = builder.build();
+ if (track == null) {
+ throw new RuntimeException("Could not make the Audio Track! attributes = "
+ + attributes + ", format = " + format);
+ }
+ return track;
+ }
+
+ public int write(float[] buffer, int offset, int length) {
+ endCpuLoadInterval();
+ int result = mAudioTrack.write(buffer, offset, length,
+ AudioTrack.WRITE_BLOCKING);
+ beginCpuLoadInterval();
+ if (result > 0 && mLatencyController.isAutoSizeEnabled()) {
+ mLatencyTuner.update();
+ }
+ return result;
+ }
+
+ private void endCpuLoadInterval() {
+ long now = System.nanoTime();
+ if (previousBeginTime > 0) {
+ long elapsed = now - previousBeginTime;
+ // recursive low pass filter
+ filteredCpuInterval = ((filteredCpuInterval * LOAD_FILTER_SCALER) + elapsed)
+ >> LOAD_FILTER_SHIFT;
+ }
+
+ }
+ private void beginCpuLoadInterval() {
+ long now = System.nanoTime();
+ if (previousBeginTime > 0) {
+ long elapsed = now - previousBeginTime;
+ // recursive low pass filter
+ filteredTotalInterval = ((filteredTotalInterval * LOAD_FILTER_SCALER) + elapsed)
+ >> LOAD_FILTER_SHIFT;
+ }
+ previousBeginTime = now;
+ }
+
+ public void stop() {
+ if (mAudioTrack != null) {
+ mAudioTrack.stop();
+ mAudioTrack.release();
+ mAudioTrack = null;
+ }
+ }
+
+ public int getFrameRate() {
+ return mFrameRate;
+ }
+
+ public LatencyController getLatencyController() {
+ return mLatencyController;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineOscillator.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineOscillator.java
new file mode 100644
index 0000000..6e77f77
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineOscillator.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Sinewave oscillator.
+ */
+public class SineOscillator extends SawOscillator {
+ // Factorial constants.
+ private static final float IF3 = 1.0f / (2 * 3);
+ private static final float IF5 = IF3 / (4 * 5);
+ private static final float IF7 = IF5 / (6 * 7);
+ private static final float IF9 = IF7 / (8 * 9);
+ private static final float IF11 = IF9 / (10 * 11);
+
+ /**
+ * Calculate sine using Taylor expansion. Do not use values outside the range.
+ *
+ * @param currentPhase in the range of -1.0 to +1.0 for one cycle
+ */
+ public static float fastSin(float currentPhase) {
+
+ /* Wrap phase back into region where results are more accurate. */
+ float yp = (currentPhase > 0.5f) ? 1.0f - currentPhase
+ : ((currentPhase < (-0.5f)) ? (-1.0f) - currentPhase : currentPhase);
+
+ float x = (float) (yp * Math.PI);
+ float x2 = (x * x);
+ /* Taylor expansion out to x**11/11! factored into multiply-adds */
+ return x * (x2 * (x2 * (x2 * (x2 * ((x2 * (-IF11)) + IF9) - IF7) + IF5) - IF3) + 1);
+ }
+
+ @Override
+ public float render() {
+ // Convert raw sawtooth to sine.
+ float phase = incrementWrapPhase();
+ return fastSin(phase) * getAmplitude();
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineVoice.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineVoice.java
new file mode 100644
index 0000000..fa92918
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SineVoice.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Replace sawtooth with a sine wave.
+ */
+public class SineVoice extends SawVoice {
+ public SineVoice(int sampleRate) {
+ super(sampleRate);
+ }
+
+ @Override
+ protected SawOscillator createOscillator() {
+ return new SineOscillator();
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthEngine.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthEngine.java
new file mode 100644
index 0000000..1e1c3a8
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthEngine.java
@@ -0,0 +1,315 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+import android.media.midi.MidiReceiver;
+import android.util.Log;
+
+import com.mobileer.miditools.MidiConstants;
+import com.mobileer.miditools.MidiEventScheduler;
+import com.mobileer.miditools.MidiFramer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * Very simple polyphonic, single channel synthesizer. It runs a background
+ * thread that processes MIDI events and synthesizes audio.
+ */
+public class SynthEngine extends MidiReceiver {
+
+ private static final String TAG = "SynthEngine";
+ // 64 is the greatest common divisor of 192 and 128
+ private static final int DEFAULT_FRAMES_PER_BLOCK = 64;
+ private static final int SAMPLES_PER_FRAME = 2;
+
+ private volatile boolean mThreadEnabled;
+ private Thread mThread;
+ private float[] mBuffer = null;
+ private float mFrequencyScaler = 1.0f;
+ private float mBendRange = 2.0f; // semitones
+ private int mProgram;
+
+ private ArrayList<SynthVoice> mFreeVoices = new ArrayList<SynthVoice>();
+ private Hashtable<Integer, SynthVoice>
+ mVoices = new Hashtable<Integer, SynthVoice>();
+ private MidiEventScheduler mEventScheduler;
+ private MidiFramer mFramer;
+ private MidiReceiver mReceiver = new MyReceiver();
+ private SimpleAudioOutput mAudioOutput;
+ private int mSampleRate;
+ private int mFramesPerBlock = DEFAULT_FRAMES_PER_BLOCK;
+ private int mMidiByteCount;
+
+ public SynthEngine() {
+ this(new SimpleAudioOutput());
+ }
+
+ public SynthEngine(SimpleAudioOutput audioOutput) {
+ mAudioOutput = audioOutput;
+ mReceiver = new MyReceiver();
+ mFramer = new MidiFramer(mReceiver);
+ }
+
+ public SimpleAudioOutput getAudioOutput() {
+ return mAudioOutput;
+ }
+
+ /* This will be called when MIDI data arrives. */
+ @Override
+ public void onSend(byte[] data, int offset, int count, long timestamp)
+ throws IOException {
+ if (mEventScheduler != null) {
+ if (!MidiConstants.isAllActiveSensing(data, offset, count)) {
+ mEventScheduler.getReceiver().send(data, offset, count,
+ timestamp);
+ }
+ }
+ mMidiByteCount += count;
+ }
+
+ /**
+ * Call this before the engine is started.
+ * @param framesPerBlock
+ */
+ public void setFramesPerBlock(int framesPerBlock) {
+ mFramesPerBlock = framesPerBlock;
+ }
+
+
+ private class MyReceiver extends MidiReceiver {
+ @Override
+ public void onSend(byte[] data, int offset, int count, long timestamp)
+ throws IOException {
+ byte command = (byte) (data[0] & MidiConstants.STATUS_COMMAND_MASK);
+ int channel = (byte) (data[0] & MidiConstants.STATUS_CHANNEL_MASK);
+ switch (command) {
+ case MidiConstants.STATUS_NOTE_OFF:
+ noteOff(channel, data[1], data[2]);
+ break;
+ case MidiConstants.STATUS_NOTE_ON:
+ noteOn(channel, data[1], data[2]);
+ break;
+ case MidiConstants.STATUS_PITCH_BEND:
+ int bend = (data[2] << 7) + data[1];
+ pitchBend(channel, bend);
+ break;
+ case MidiConstants.STATUS_PROGRAM_CHANGE:
+ mProgram = data[1];
+ mFreeVoices.clear();
+ break;
+ default:
+ logMidiMessage(data, offset, count);
+ break;
+ }
+ }
+ }
+
+ class MyRunnable implements Runnable {
+ @Override
+ public void run() {
+ try {
+ mAudioOutput.start(mFramesPerBlock);
+ mSampleRate = mAudioOutput.getFrameRate(); // rate is now valid
+ if (mBuffer == null) {
+ mBuffer = new float[mFramesPerBlock * SAMPLES_PER_FRAME];
+ }
+ onLoopStarted();
+ // The safest way to exit from a thread is to check a variable.
+ while (mThreadEnabled) {
+ processMidiEvents();
+ generateBuffer();
+ float[] buffer = mBuffer;
+ mAudioOutput.write(buffer, 0, buffer.length);
+ onBufferCompleted(mFramesPerBlock);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "SynthEngine background thread exception.", e);
+ } finally {
+ onLoopEnded();
+ mAudioOutput.stop();
+ }
+ }
+ }
+
+ /**
+ * This is called from the synthesis thread before it starts looping.
+ */
+ public void onLoopStarted() {
+ }
+
+ /**
+ * This is called once at the end of each synthesis loop.
+ *
+ * @param framesPerBuffer
+ */
+ public void onBufferCompleted(int framesPerBuffer) {
+ }
+
+ /**
+ * This is called from the synthesis thread when it stops looping.
+ */
+ public void onLoopEnded() {
+ }
+
+ /**
+ * Assume message has been aligned to the start of a MIDI message.
+ *
+ * @param data
+ * @param offset
+ * @param count
+ */
+ public void logMidiMessage(byte[] data, int offset, int count) {
+ String text = "Received: ";
+ for (int i = 0; i < count; i++) {
+ text += String.format("0x%02X, ", data[offset + i]);
+ }
+ Log.i(TAG, text);
+ }
+
+ /**
+ * @throws IOException
+ *
+ */
+ private void processMidiEvents() throws IOException {
+ long now = System.nanoTime(); // TODO use audio presentation time
+ MidiEventScheduler.MidiEvent event = (MidiEventScheduler.MidiEvent) mEventScheduler.getNextEvent(now);
+ while (event != null) {
+ mFramer.send(event.data, 0, event.count, event.getTimestamp());
+ mEventScheduler.addEventToPool(event);
+ event = (MidiEventScheduler.MidiEvent) mEventScheduler.getNextEvent(now);
+ }
+ }
+
+ /**
+ * Mix the output of each active voice into a buffer.
+ */
+ private void generateBuffer() {
+ float[] buffer = mBuffer;
+ for (int i = 0; i < buffer.length; i++) {
+ buffer[i] = 0.0f;
+ }
+ Iterator<SynthVoice> iterator = mVoices.values().iterator();
+ while (iterator.hasNext()) {
+ SynthVoice voice = iterator.next();
+ if (voice.isDone()) {
+ iterator.remove();
+ // mFreeVoices.add(voice);
+ } else {
+ voice.mix(buffer, SAMPLES_PER_FRAME, 0.25f);
+ }
+ }
+ }
+
+ public void noteOff(int channel, int noteIndex, int velocity) {
+ SynthVoice voice = mVoices.get(noteIndex);
+ if (voice != null) {
+ voice.noteOff();
+ }
+ }
+
+ public void allNotesOff() {
+ Iterator<SynthVoice> iterator = mVoices.values().iterator();
+ while (iterator.hasNext()) {
+ SynthVoice voice = iterator.next();
+ voice.noteOff();
+ }
+ }
+
+ /**
+ * Create a SynthVoice.
+ */
+ public SynthVoice createVoice(int program) {
+ // For every odd program number use a sine wave.
+ if ((program & 1) == 1) {
+ return new SineVoice(mSampleRate);
+ } else {
+ return new SawVoice(mSampleRate);
+ }
+ }
+
+ /**
+ *
+ * @param channel
+ * @param noteIndex
+ * @param velocity
+ */
+ public void noteOn(int channel, int noteIndex, int velocity) {
+ if (velocity == 0) {
+ noteOff(channel, noteIndex, velocity);
+ } else {
+ mVoices.remove(noteIndex);
+ SynthVoice voice;
+ if (mFreeVoices.size() > 0) {
+ voice = mFreeVoices.remove(mFreeVoices.size() - 1);
+ } else {
+ voice = createVoice(mProgram);
+ }
+ voice.setFrequencyScaler(mFrequencyScaler);
+ voice.noteOn(noteIndex, velocity);
+ mVoices.put(noteIndex, voice);
+ }
+ }
+
+ public void pitchBend(int channel, int bend) {
+ double semitones = (mBendRange * (bend - 0x2000)) / 0x2000;
+ mFrequencyScaler = (float) Math.pow(2.0, semitones / 12.0);
+ Iterator<SynthVoice> iterator = mVoices.values().iterator();
+ while (iterator.hasNext()) {
+ SynthVoice voice = iterator.next();
+ voice.setFrequencyScaler(mFrequencyScaler);
+ }
+ }
+
+ /**
+ * Start the synthesizer.
+ */
+ public void start() {
+ stop();
+ mThreadEnabled = true;
+ mThread = new Thread(new MyRunnable());
+ mEventScheduler = new MidiEventScheduler();
+ mThread.start();
+ }
+
+ /**
+ * Stop the synthesizer.
+ */
+ public void stop() {
+ mThreadEnabled = false;
+ if (mThread != null) {
+ try {
+ mThread.interrupt();
+ mThread.join(500);
+ } catch (InterruptedException e) {
+ // OK, just stopping safely.
+ }
+ mThread = null;
+ mEventScheduler = null;
+ }
+ }
+
+ public LatencyController getLatencyController() {
+ return mAudioOutput.getLatencyController();
+ }
+
+ public int getMidiByteCount() {
+ return mMidiByteCount;
+ }
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthUnit.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthUnit.java
new file mode 100644
index 0000000..1b6c30f
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthUnit.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+public abstract class SynthUnit {
+
+ private static final double CONCERT_A_PITCH = 69.0;
+ private static final double CONCERT_A_FREQUENCY = 440.0;
+
+ /**
+ * @param pitch
+ * MIDI pitch in semitones
+ * @return frequency
+ */
+ public static double pitchToFrequency(double pitch) {
+ double semitones = pitch - CONCERT_A_PITCH;
+ return CONCERT_A_FREQUENCY * Math.pow(2.0, semitones / 12.0);
+ }
+
+ public abstract float render();
+}
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthVoice.java b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthVoice.java
new file mode 100644
index 0000000..6b6b7f8
--- /dev/null
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/miditools/synth/SynthVoice.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+package com.mobileer.miditools.synth;
+
+/**
+ * Base class for a polyphonic synthesizer voice.
+ */
+public abstract class SynthVoice {
+ private int mNoteIndex;
+ private float mAmplitude;
+ public static final int STATE_OFF = 0;
+ public static final int STATE_ON = 1;
+ private int mState = STATE_OFF;
+
+ public SynthVoice() {
+ mNoteIndex = -1;
+ }
+
+ public void noteOn(int noteIndex, int velocity) {
+ mState = STATE_ON;
+ this.mNoteIndex = noteIndex;
+ setAmplitude(velocity / 128.0f);
+ }
+
+ public void noteOff() {
+ mState = STATE_OFF;
+ }
+
+ /**
+ * Add the output of this voice to an output buffer.
+ *
+ * @param outputBuffer
+ * @param samplesPerFrame
+ * @param level
+ */
+ public void mix(float[] outputBuffer, int samplesPerFrame, float level) {
+ int numFrames = outputBuffer.length / samplesPerFrame;
+ for (int i = 0; i < numFrames; i++) {
+ float output = render();
+ int offset = i * samplesPerFrame;
+ for (int jf = 0; jf < samplesPerFrame; jf++) {
+ outputBuffer[offset + jf] += output * level;
+ }
+ }
+ }
+
+ public abstract float render();
+
+ public boolean isDone() {
+ return mState == STATE_OFF;
+ }
+
+ public int getNoteIndex() {
+ return mNoteIndex;
+ }
+
+ public float getAmplitude() {
+ return mAmplitude;
+ }
+
+ public void setAmplitude(float amplitude) {
+ this.mAmplitude = amplitude;
+ }
+
+ /**
+ * @param scaler
+ */
+ public void setFrequencyScaler(float scaler) {
+ }
+
+}
diff --git a/apps/OboeTester/app/src/main/res/drawable/button_shape.xml b/apps/OboeTester/app/src/main/res/drawable/button_shape.xml
new file mode 100644
index 0000000..03e7690
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/drawable/button_shape.xml
@@ -0,0 +1,6 @@
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="16dp"
+ android:shape="rectangle">
+ <corners android:radius="6dp" />
+ <gradient android:angle="270" android:endColor="#d0e06E" android:startColor="#a07FCE" />
+ <stroke android:width="1px" android:color="#050875" />
+</shape>
diff --git a/apps/OboeTester/app/src/main/res/layout/activity_main.xml b/apps/OboeTester/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..0d5cacb
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.sample.oboe.manualtest.MainActivity">
+
+ <TextView
+ android:id="@+id/versionText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="V?" />
+
+ <Button
+ android:id="@+id/buttonTestOutput"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onLaunchTestOutput"
+ android:text="Test Output" />
+
+ <Button
+ android:id="@+id/buttonTestInput"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onLaunchTestInput"
+ android:text="Test Input" />
+
+ <Button
+ android:id="@+id/buttonTapToTone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onLaunchTapToTone"
+ android:text="Tap to Tone Latency" />
+
+ <Button
+ android:id="@+id/buttonRecorder"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:onClick="onLaunchRecorder"
+ android:text="Record and Play" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <CheckBox
+ android:id="@+id/useCallback"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="30sp"
+ android:text="Use Callback"
+ android:checked="true"
+ android:onClick="onUseCallbackClicked"
+ />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Size:" />
+
+ <EditText
+ android:id="@+id/callbackSize"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:ems="10"
+ android:text="0"
+ android:inputType="number" />
+
+ </LinearLayout>
+
+ <CheckBox
+ android:id="@+id/setSpeakerphoneOn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="30sp"
+ android:text="call setSpeakerphoneOn()"
+ android:checked="false"
+ android:onClick="onSetSpeakerphoneOn"
+ />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Mode:" />
+
+ <Spinner
+ android:id="@+id/spinnerAudioMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/audio_modes"
+ android:prompt="@string/audio_mode_prompt" />
+
+ </LinearLayout>
+
+
+ <TextView
+ android:id="@+id/deviceView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:lines="1"
+ android:text="@string/init_device" />
+
+</LinearLayout>
diff --git a/apps/OboeTester/app/src/main/res/layout/activity_recorder.xml b/apps/OboeTester/app/src/main/res/layout/activity_recorder.xml
new file mode 100644
index 0000000..bab443e
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/activity_recorder.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.sample.oboe.manualtest.TestInputActivity">
+
+ <com.google.sample.oboe.manualtest.StreamConfigurationView
+ android:id="@+id/outputStreamConfiguration"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="horizontal" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/button_start_recording"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="onStartRecording"
+ android:text="@string/recordAudio" />
+
+ <Button
+ android:id="@+id/button_stop_record_play"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="onStopRecordPlay"
+ android:text="@string/stopAudio" />
+
+ <Button
+ android:id="@+id/button_start_playback"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="onStartPlayback"
+ android:text="@string/playAudio" />
+
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/statusView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:lines="3"
+ android:text="@string/init_status" />
+
+ <TextView
+ android:id="@+id/volumeText0"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar0"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar1"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar2"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar3"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+</LinearLayout>
diff --git a/apps/OboeTester/app/src/main/res/layout/activity_tap_to_tone.xml b/apps/OboeTester/app/src/main/res/layout/activity_tap_to_tone.xml
new file mode 100644
index 0000000..8ec9a1a
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/activity_tap_to_tone.xml
@@ -0,0 +1,46 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.sample.oboe.manualtest.TapToToneActivity">
+
+ <include layout="@layout/merge_audio_common"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="MIDI:" />
+
+ <Spinner
+ android:id="@+id/spinner_synth_sender"
+ style="@android:style/TextAppearance.Large"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/senders" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/resultView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:lines="2"
+ android:text="@string/init_result" />
+
+ <com.google.sample.oboe.manualtest.WaveformView
+ android:id="@+id/waveview_audio"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+
+
+</LinearLayout>
+
diff --git a/apps/OboeTester/app/src/main/res/layout/activity_test_input.xml b/apps/OboeTester/app/src/main/res/layout/activity_test_input.xml
new file mode 100644
index 0000000..d517b5b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/activity_test_input.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.sample.oboe.manualtest.TestInputActivity">
+
+ <include layout="@layout/merge_audio_common"/>
+
+ <TextView
+ android:id="@+id/volumeText0"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar0"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar1"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar2"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+
+ <TextView
+ android:id="@+id/volumeText3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ <com.google.sample.oboe.manualtest.VolumeBarView
+ android:id="@+id/volumeBar3"
+ android:layout_width="fill_parent"
+ android:layout_height="20dp" />
+</LinearLayout>
diff --git a/apps/OboeTester/app/src/main/res/layout/activity_test_output.xml b/apps/OboeTester/app/src/main/res/layout/activity_test_output.xml
new file mode 100644
index 0000000..ff9f58b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/activity_test_output.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.sample.oboe.manualtest.TestOutputActivity">
+
+ <include layout="@layout/merge_audio_common"/>
+
+</LinearLayout>
diff --git a/apps/OboeTester/app/src/main/res/layout/audio_devices.xml b/apps/OboeTester/app/src/main/res/layout/audio_devices.xml
new file mode 100644
index 0000000..12ec7f6
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/audio_devices.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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.
+ -->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/device_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Device Name"/>
diff --git a/apps/OboeTester/app/src/main/res/layout/merge_audio_common.xml b/apps/OboeTester/app/src/main/res/layout/merge_audio_common.xml
new file mode 100644
index 0000000..b79696c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/merge_audio_common.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+
+ <com.google.sample.oboe.manualtest.StreamConfigurationView
+ android:id="@+id/outputStreamConfiguration"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:orientation="horizontal" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/textThreshold"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Threshold" />
+
+ <SeekBar
+ android:id="@+id/faderThreshold"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:max="1000"
+ android:progress="1000" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/textAmplitude"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Amplitude" />
+
+ <SeekBar
+ android:id="@+id/faderAmplitude"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:max="1000"
+ android:progress="1000" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/button_open"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="openAudio"
+ android:text="@string/openAudio" />
+
+ <Button
+ android:id="@+id/button_start"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="startAudio"
+ android:text="@string/startAudio" />
+
+ <Button
+ android:id="@+id/button_pause"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="pauseAudio"
+ android:text="@string/pauseAudio" />
+
+ <Button
+ android:id="@+id/button_stop"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="stopAudio"
+ android:text="@string/stopAudio" />
+
+ <Button
+ android:id="@+id/button_close"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:onClick="closeAudio"
+ android:text="@string/closeAudio" />
+
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/statusView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:lines="3"
+ android:text="@string/init_status" />
+
+</merge>
diff --git a/apps/OboeTester/app/src/main/res/layout/sample_fast_button.xml b/apps/OboeTester/app/src/main/res/layout/sample_fast_button.xml
new file mode 100644
index 0000000..f092b5a
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/sample_fast_button.xml
@@ -0,0 +1,17 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res/com.google.sample.oboe.manualtest"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.google.sample.oboe.manualtest.FastButton
+ android:layout_width="300dp"
+ android:layout_height="300dp"
+ android:background="#ccc"
+ android:paddingBottom="40dp"
+ android:paddingLeft="20dp"
+ app:exampleColor="#33b5e5"
+ app:exampleDimension="24sp"
+ app:exampleDrawable="@android:drawable/ic_menu_add"
+ app:exampleString="Hello, FastButton" />
+
+</FrameLayout>
diff --git a/apps/OboeTester/app/src/main/res/layout/stream_config.xml b/apps/OboeTester/app/src/main/res/layout/stream_config.xml
new file mode 100644
index 0000000..2f3ebbd
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/layout/stream_config.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TableLayout
+ android:id="@+id/optionTable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ >
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="API:" />
+ <Spinner
+ android:id="@+id/spinnerNativeApi"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dp"
+ android:entries="@array/output_modes"
+ android:prompt="@string/output_prompt" />
+ <TextView
+ android:id="@+id/actualNativeApi"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_rate_prompt" />
+
+ <Spinner
+ android:id="@+id/spinnerSampleRate"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/sample_rates"
+ android:prompt="@string/sample_rate_prompt" />
+
+ <TextView
+ android:id="@+id/actualSampleRate"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/channel_count_prompt" />
+
+ <Spinner
+ android:id="@+id/spinnerChannelCount"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/channel_counts"
+ android:prompt="@string/channel_count_prompt" />
+
+ <TextView
+ android:id="@+id/actualChannelCount"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/format_prompt"/>
+
+ <Spinner
+ android:id="@+id/spinnerFormat"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/audio_formats"
+ android:prompt="@string/format_prompt" />
+
+ <TextView
+ android:id="@+id/actualAudioFormat"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Perf:" />
+
+ <Spinner
+ android:id="@+id/spinnerPerformanceMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:entries="@array/performance_modes"
+ android:prompt="@string/performance_prompt" />
+
+ <TextView
+ android:id="@+id/actualPerformanceMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <CheckBox
+ android:id="@+id/requestedExclusiveMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="30sp"
+ android:text="Exclusive" />
+
+ <TextView
+ android:id="@+id/actualExclusiveMode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+
+ <TableRow
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <CheckBox
+ android:id="@+id/requestAudioEffect"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="30sp"
+ android:text="Effect" />
+
+ <TextView
+ android:id="@+id/sessionId"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />
+
+ </TableRow>
+ </TableLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Device: " />
+
+ <com.google.sample.audio_device.AudioDeviceSpinner
+ android:id="@+id/devices_spinner"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </LinearLayout>
+
+<!-- <TextView
+ android:id="@+id/device_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="\?" />-->
+
+ <TextView
+ android:id="@+id/streamInfo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="info:" />
+
+ </LinearLayout>
+
+</merge>
diff --git a/apps/OboeTester/app/src/main/res/menu/menu_main.xml b/apps/OboeTester/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..51f264b
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,5 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" tools:context="com.google.sample.oboe.manualtest.TapToToneActivity">
+ <item android:id="@+id/action_settings" android:title="@string/action_settings"
+ android:orderInCategory="100" android:showAsAction="never" />
+</menu>
diff --git a/apps/OboeTester/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/OboeTester/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/apps/OboeTester/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/OboeTester/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/apps/OboeTester/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/OboeTester/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/apps/OboeTester/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/OboeTester/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/apps/OboeTester/app/src/main/res/values-v21/styles.xml b/apps/OboeTester/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..dba3c41
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="AppTheme" parent="android:Theme.Material.Light">
+ </style>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values-w600dp/dimens.xml b/apps/OboeTester/app/src/main/res/values-w600dp/dimens.xml
new file mode 100644
index 0000000..82ee6d6
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values-w600dp/dimens.xml
@@ -0,0 +1,8 @@
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 600dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+
+ <dimen name="big_font_size">20dp</dimen>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values/attrs_fast_button.xml b/apps/OboeTester/app/src/main/res/values/attrs_fast_button.xml
new file mode 100644
index 0000000..545d7ec
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/attrs_fast_button.xml
@@ -0,0 +1,8 @@
+<resources>
+ <declare-styleable name="FastButton">
+ <attr name="exampleString" format="string" />
+ <attr name="exampleDimension" format="dimension" />
+ <attr name="exampleColor" format="color" />
+ <attr name="exampleDrawable" format="color|reference" />
+ </declare-styleable>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values/attrs_waveform.xml b/apps/OboeTester/app/src/main/res/values/attrs_waveform.xml
new file mode 100644
index 0000000..69b1940
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/attrs_waveform.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <declare-styleable name="WaveformView">
+ <attr name="showZero"
+ format="boolean" />
+ </declare-styleable>
+</resources>
\ No newline at end of file
diff --git a/apps/OboeTester/app/src/main/res/values/colors.xml b/apps/OboeTester/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..4415a50
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/colors.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources>
+ <color name="waveform_line">#ff101080</color>
+ <color name="waveform_background">#ffc0f0c0</color>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values/dimens.xml b/apps/OboeTester/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..4fbc15f
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/dimens.xml
@@ -0,0 +1,8 @@
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+ <dimen name="waveform_stroke_width">2.0dp</dimen>
+
+ <dimen name="big_font_size">90dp</dimen>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values/strings.xml b/apps/OboeTester/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..b052a5c
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/strings.xml
@@ -0,0 +1,96 @@
+<resources>
+ <string name="app_name">Oboe Tester</string>
+ <string name="init_device">Device:</string>
+ <string name="init_status">Status:</string>
+ <string name="init_result">Result:</string>
+ <string name="action_settings">Settings</string>
+ <string name="openAudio">Open</string>
+ <string name="startAudio">Start</string>
+ <string name="pauseAudio">Pause</string>
+ <string name="stopAudio">Stop</string>
+ <string name="closeAudio">Close</string>
+ <string name="GetParam">Get Param</string>
+
+ <string name="output_prompt">Choose an Output Mode</string>
+ <string-array name="output_modes">
+ <item>Unspecified</item>
+ <item>OpenSL ES</item>
+ <item>AAudio</item>
+ </string-array>
+
+ <string name="audio_mode_prompt">Performance Mode</string>
+ <string-array name="audio_modes">
+ <item>NORMAL</item>
+ <item>RINGTONE</item>
+ <item>IN_CALL</item>
+ <item>IN_COMMUNICATION</item>
+ </string-array>
+
+ <string name="sample_rate_prompt">SRate:</string>
+ <string-array name="sample_rates">
+ <item>0</item>
+ <item>8000</item>
+ <item>16000</item>
+ <item>22050</item>
+ <item>32000</item>
+ <item>44100</item>
+ <item>48000</item>
+ <item>64000</item>
+ <item>88200</item>
+ <item>96000</item>
+ </string-array>
+
+ <string name="format_prompt">Format:</string>
+ <string-array name="audio_formats">
+ <item>Unspecified</item>
+ <item>PCM_I16</item>
+ <item>PCM_FLOAT</item>
+ </string-array>
+
+ <string name="channel_count_prompt">Channels:</string>
+ <string-array name="channel_counts">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>7</item>
+ <item>8</item>
+ <item>9</item>
+ </string-array>
+
+ <string name="performance_prompt">Perf:</string>
+ <string-array name="performance_modes">
+ <item>NONE</item>
+ <item>POWER_SAVING</item>
+ <item>LOW_LATENCY</item>
+ </string-array>
+
+ <string name="tone_prompt">Choose a Tone Type</string>
+ <string-array name="tone_types">
+ <item>Saw Ping</item>
+ <item>Sine Steady</item>
+ </string-array>
+
+ <string name="synth_sender_text">Select Sender for Synth</string>
+ <string name="error_port_busy">Selected port is in use or unavailable.</string>
+ <string name="port_open_ok">Port opened OK.</string>
+ <string-array name="senders">
+ <item>"none"</item>
+ </string-array>
+
+ <string name="title_activity_main">Test Oboe</string>
+ <string name="title_activity_test_output">Test Output</string>
+ <string name="title_activity_test_input">Test Input</string>
+ <string name="title_activity_latency">Tap to Tone</string>
+ <string name="title_activity_recorder">Recorder</string>
+
+ <string name="need_record_audio_permission">"This app needs RECORD_AUDIO permission"</string>
+
+ <string name="device_name">Device Name</string>
+ <string name="auto_select">Auto select</string>
+ <string name="recordAudio">Record</string>
+ <string name="playAudio">Play</string>
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/values/styles.xml b/apps/OboeTester/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..ff6c9d2
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
diff --git a/apps/OboeTester/app/src/main/res/xml/service_device_info.xml b/apps/OboeTester/app/src/main/res/xml/service_device_info.xml
new file mode 100644
index 0000000..1cebab7
--- /dev/null
+++ b/apps/OboeTester/app/src/main/res/xml/service_device_info.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<devices>
+ <device manufacturer="AndroidTest" product="AudioLatencyTester">
+ <input-port name="input" />
+ </device>
+</devices>
diff --git a/apps/OboeTester/build.gradle b/apps/OboeTester/build.gradle
new file mode 100644
index 0000000..8054476
--- /dev/null
+++ b/apps/OboeTester/build.gradle
@@ -0,0 +1,18 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.1.4'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ google()
+ }
+}
diff --git a/apps/OboeTester/gradle.properties b/apps/OboeTester/gradle.properties
new file mode 100644
index 0000000..89e0d99
--- /dev/null
+++ b/apps/OboeTester/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/apps/OboeTester/gradle/wrapper/gradle-wrapper.jar b/apps/OboeTester/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/apps/OboeTester/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/apps/OboeTester/gradle/wrapper/gradle-wrapper.properties b/apps/OboeTester/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..797dc65
--- /dev/null
+++ b/apps/OboeTester/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Sep 18 10:50:16 PDT 2018
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/apps/OboeTester/gradlew b/apps/OboeTester/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/apps/OboeTester/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# 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
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# 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\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+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" ] ; 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, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # 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=$((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
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/apps/OboeTester/gradlew.bat b/apps/OboeTester/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/apps/OboeTester/gradlew.bat
@@ -0,0 +1,90 @@
+@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
+
+@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=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@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 init
+
+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 init
+
+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
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+: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 %CMD_LINE_ARGS%
+
+: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
diff --git a/apps/OboeTester/settings.gradle b/apps/OboeTester/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/apps/OboeTester/settings.gradle
@@ -0,0 +1 @@
+include ':app'