Home | History | Annotate | Download | only in aaudio
      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 /**
     53  * Control whether AAudioStreamBuilder_openStream() will use the new MMAP data path
     54  * or the older "Legacy" data path.
     55  *
     56  * This will only affect the current process.
     57  *
     58  * If unspecified then the policy will be based on system properties or configuration.
     59  *
     60  * @note This is only for testing. Do not use this in an application.
     61  * It may change or be removed at any time.
     62  *
     63  * @param policy AAUDIO_UNSPECIFIED, AAUDIO_POLICY_NEVER, AAUDIO_POLICY_AUTO, or AAUDIO_POLICY_ALWAYS
     64  * @return AAUDIO_OK or a negative error
     65  */
     66 AAUDIO_API aaudio_result_t AAudio_setMMapPolicy(aaudio_policy_t policy);
     67 
     68 /**
     69  * Get the current MMAP policy set by AAudio_setMMapPolicy().
     70  *
     71  * @note This is only for testing. Do not use this in an application.
     72  * It may change or be removed at any time.
     73  *
     74  * @return current policy
     75  */
     76 AAUDIO_API aaudio_policy_t AAudio_getMMapPolicy();
     77 
     78 /**
     79  * Return true if the stream uses the MMAP data path versus the legacy path.
     80  *
     81  * @note This is only for testing. Do not use this in an application.
     82  * It may change or be removed at any time.
     83  *
     84  * @return true if the stream uses ther MMAP data path
     85  */
     86 AAUDIO_API bool AAudioStream_isMMapUsed(AAudioStream* stream);
     87 
     88 #ifdef __cplusplus
     89 }
     90 #endif
     91 
     92 #endif //AAUDIO_AAUDIO_TESTING_H
     93 
     94 /** @} */
     95