1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUDIO_COMMON_TEST_H 17 #define AUDIO_COMMON_TEST_H 18 19 #include "audio_internal.h" 20 #include "audio_interface_lib_common.h" 21 22 namespace comfun { 23 const float GAIN_MIN = 0; 24 const float GAIN_MAX = 15; 25 const int PORTNUM = 1; 26 const int AUDIO_CHANNELCOUNT = 2; 27 const int AUDIO_PORT_ID = 2; // portId 28 const int AUDIO_SAMPLE_RATE_48K = 48000; 29 const int DEEP_BUFFER_RENDER_PERIOD_SIZE = 4096; 30 const int INT_32_MAX = 0x7fffffff; 31 const int DEFAULT_RENDER_SAMPLING_RATE = 48000; 32 const int DEEP_BUFFER_RENDER_PERIOD_COUNT = 8; 33 const int PARAMS_LEN = 256; 34 const int PARAMS_ERR = 10; 35 const int REQ_SIZE = 1024; 36 37 int32_t InitPort(struct AudioPort &portIndex); 38 int32_t InitHwRender(struct AudioHwRender &hwRender, 39 const struct AudioDeviceDescriptor &desc, const struct AudioSampleAttributes &attrs); 40 int32_t InitHwCapture(struct AudioHwCapture &hwCapture, const struct AudioDeviceDescriptor &desc, 41 const struct AudioSampleAttributes &attrs); 42 int32_t InitAttrs(struct AudioSampleAttributes &attrs); 43 int32_t InitDevDesc(struct AudioDeviceDescriptor &devDesc); 44 int32_t InitAttrsCapture(struct AudioSampleAttributes &attrs); 45 int32_t InitDevDescCapture(struct AudioDeviceDescriptor &devDesc); 46 int32_t AudioRenderCallbackUtTest(enum AudioCallbackType type, void *reserved, void *cookie); 47 } 48 #endif 49