• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * This is test support for AAudio.
19  */
20 #ifndef AAUDIO_AAUDIO_TESTING_H
21 #define AAUDIO_AAUDIO_TESTING_H
22 
23 #include <aaudio/AAudio.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /************************************************************************************
30  * The definitions below are only for testing. Do not use them in an application.
31  * They may change or be removed at any time.
32  ************************************************************************************/
33 
34 enum {
35     /**
36      * Related feature is disabled and never used.
37      */
38     AAUDIO_POLICY_NEVER = 1,
39 
40     /**
41      * If related feature works then use it. Otherwise fall back to something else.
42      */
43      AAUDIO_POLICY_AUTO,
44 
45     /**
46      * Related feature must be used. If not available then fail.
47      */
48     AAUDIO_POLICY_ALWAYS
49 };
50 typedef int32_t aaudio_policy_t;
51 
52 // Internal error codes. Only used by the framework.
53 enum {
54     AAUDIO_INTERNAL_ERROR_BASE = -1000,
55     AAUDIO_ERROR_STANDBY,
56 };
57 
58 /**
59  * Control whether AAudioStreamBuilder_openStream() will use the new MMAP data path
60  * or the older "Legacy" data path.
61  *
62  * This will only affect the current process.
63  *
64  * If unspecified then the policy will be based on system properties or configuration.
65  *
66  * @note This is only for testing. Do not use this in an application.
67  * It may change or be removed at any time.
68  *
69  * @param policy AAUDIO_UNSPECIFIED, AAUDIO_POLICY_NEVER, AAUDIO_POLICY_AUTO, or AAUDIO_POLICY_ALWAYS
70  * @return AAUDIO_OK or a negative error
71  */
72 AAUDIO_API aaudio_result_t AAudio_setMMapPolicy(aaudio_policy_t policy);
73 
74 /**
75  * Get the current MMAP policy set by AAudio_setMMapPolicy().
76  *
77  * @note This is only for testing. Do not use this in an application.
78  * It may change or be removed at any time.
79  *
80  * @return current policy
81  */
82 AAUDIO_API aaudio_policy_t AAudio_getMMapPolicy();
83 
84 /**
85  * Return true if the stream uses the MMAP data path versus the legacy path.
86  *
87  * @note This is only for testing. Do not use this in an application.
88  * It may change or be removed at any time.
89  *
90  * @return true if the stream uses ther MMAP data path
91  */
92 AAUDIO_API bool AAudioStream_isMMapUsed(AAudioStream* stream);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif //AAUDIO_AAUDIO_TESTING_H
99 
100 /** @} */
101