1 /* 2 * Copyright (c) 2021-2022 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 INTERRUPT_MULTI_RENDERER_TEST_H 17 #define INTERRUPT_MULTI_RENDERER_TEST_H 18 19 #include "audio_renderer.h" 20 21 namespace OHOS { 22 namespace AudioStandard { 23 class AudioRendererCallbackTestImpl : public AudioRendererCallback { 24 public: 25 void OnInterrupt(const InterruptEvent &interruptEvent) override; 26 void OnStateChange(const RendererState state) override; 27 bool isRendererPaused_ = false; 28 bool isStopInProgress_ = false; 29 bool isRendererStopped_ = false; 30 bool isRendererResumed_ = false; 31 }; 32 class InterruptMultiRendererTest { 33 public: 34 int32_t TestPlayback(int argc, char *argv[]) const; 35 private: 36 bool InitRender(const std::unique_ptr<AudioRenderer> &audioRenderer, FILE* &wavFile) const; 37 bool StartRender(const std::unique_ptr<AudioRenderer> &audioRenderer) const; 38 void WriteBuffer(AudioRenderer* audioRenderer, FILE* wavFile, 39 const std::shared_ptr<AudioRendererCallbackTestImpl> &cb) const; 40 int32_t ValidateFile(char *filePath, char path[]) const; 41 }; 42 } // namespace AudioStandard 43 } // namespace OHOS 44 #endif // INTERRUPT_MULTI_RENDERER_TEST_H 45