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
16package ohos.hdi.distributed_audio.audio.v1_0;
17
18import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes;
19import ohos.hdi.distributed_audio.audio.v1_0.IAudioCallback;
20
21/**
22 * @brief Provides capabilities for audio rendering, including controlling the rendering, setting audio attributes,
23 * scenes, and volume, obtaining hardware latency, and rendering audio frames.
24 *
25 * @since 4.1
26 * @version 1.0
27 */
28interface IAudioRender {
29    GetLatency([out] unsigned int ms);
30    RenderFrame([in] byte[] frame, [out] unsigned long replyBytes);
31    GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time);
32    SetRenderSpeed([in] float speed);
33    GetRenderSpeed([out] float speed);
34    SetChannelMode([in] enum AudioChannelMode mode);
35    GetChannelMode([out] enum AudioChannelMode mode);
36    RegCallback([in] IAudioCallback audioCallback, [in] byte cookie);
37    DrainBuffer([out] enum AudioDrainNotifyType type);
38    IsSupportsDrain([out] boolean support);
39    CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported);
40    SelectScene([in] struct AudioSceneDescriptor scene);
41    SetMute([in] boolean mute);
42    GetMute([out] boolean mute);
43    SetVolume([in] float volume);
44    GetVolume([out] float volume);
45    GetGainThreshold([out] float min, [out] float max);
46    GetGain([out] float gain);
47    SetGain([in] float gain);
48    GetFrameSize([out] unsigned long size);
49    GetFrameCount([out] unsigned long count);
50    SetSampleAttributes([in] struct AudioSampleAttributes attrs);
51    GetSampleAttributes([out] struct AudioSampleAttributes attrs);
52    GetCurrentChannelId([out] unsigned int channelId);
53    SetExtraParams([in] String keyValueList);
54    GetExtraParams([out] String keyValueList);
55    ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc);
56    GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time);
57    AddAudioEffect([in] unsigned long effectid);
58    RemoveAudioEffect([in] unsigned long effectid);
59    GetFrameBufferSize([out] unsigned long bufferSize);
60    Start();
61    Stop();
62    Pause();
63    Resume();
64    Flush();
65    TurnStandbyMode();
66    AudioDevDump([in] int range, [in] int fd);
67    IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume);
68}