1 /* 2 * Copyright (c) 2023 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 #ifndef AUDIO_DEBUG_H 16 #define AUDIO_DEBUG_H 17 18 #include <cstdint> 19 #include <string> 20 #ifdef AUDIO_DATA_DEBUG 21 #include <memory> 22 #include <fstream> 23 #endif 24 25 namespace OHOS { 26 namespace IntellVoiceEngine { 27 class AudioDebug { 28 public: 29 AudioDebug() = default; 30 ~AudioDebug() = default; 31 32 void CreateAudioDebugFile(const std::string &suffix); 33 void WriteData(const char *data, uint32_t length); 34 void DestroyAudioDebugFile(); 35 36 private: 37 #ifdef AUDIO_DATA_DEBUG 38 std::unique_ptr<std::ofstream> fileStream_ = nullptr; 39 #endif 40 }; 41 } 42 } 43 #endif