1 Star 0 Fork 5K

xuhui / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
AudioRender.md 21.60 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

AudioRender

Overview

Related Modules:

Audio

Description:

Provides capabilities for audio rendering, including controlling the rendering, setting audio attributes, scenes, and volume, obtaining hardware latency, and rendering audio frames.

Since:

1.0

Version:

1.0

Summary

Data Fields

Variable Name

Description

control

struct AudioControl 

Defines the audio control. For details, see AudioControl.

attr

struct AudioAttribute 

Defines the audio attribute. For details, see AudioAttribute.

scene

struct AudioScene 

Defines the audio scene. For details, see AudioScene.

volume

struct AudioVolume 

Defines audio volume. For details, see AudioVolume.

GetLatency )(struct AudioRender *render, uint32_t *ms)

int32_t(* 

Obtains the estimated latency of the audio device driver.

RenderFrame )(struct AudioRender *render, const void *frame, uint64_t requestBytes, uint64_t *replyBytes)

int32_t(* 

Writes a frame of output data (downlink data) into the audio driver for rendering.

GetRenderPosition )(struct AudioRender *render, uint64_t *frames, struct AudioTimeStamp *time)

int32_t(* 

Obtains the last number of output audio frames.

SetRenderSpeed )(struct AudioRender *render, float speed)

int32_t(* 

Sets the audio rendering speed.

GetRenderSpeed )(struct AudioRender *render, float *speed)

int32_t(* 

Obtains the current audio rendering speed.

SetChannelMode )(struct AudioRender *render, enum AudioChannelMode mode)

int32_t(* 

Sets the channel mode for audio rendering.

GetChannelMode )(struct AudioRender *render, enum AudioChannelMode *mode)

int32_t(* 

Obtains the current channel mode for audio rendering.

Details

Field Documentation

GetChannelMode

int32_t(* AudioRender::GetChannelMode) (struct [AudioRender](AudioRender.md) *render, enum [AudioChannelMode](Audio.md#ga78aab1fafb9657451804e42b42897123) *mode)

Description:

Obtains the current channel mode for audio rendering.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
mode Indicates the pointer to the channel mode to obtain.

Returns:

Returns 0 if the mode is successfully obtained; returns a negative value otherwise.

See also:

SetChannelMode

GetLatency

int32_t(* AudioRender::GetLatency) (struct [AudioRender](AudioRender.md) *render, uint32_t *ms)

Description:

Obtains the estimated latency of the audio device driver.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
ms Indicates the pointer to the latency (in milliseconds) to be obtained.

Returns:

Returns 0 if the latency is obtained; returns a negative value otherwise.

GetRenderPosition

int32_t(* AudioRender::GetRenderPosition) (struct [AudioRender](AudioRender.md) *render, uint64_t *frames, struct [AudioTimeStamp](AudioTimeStamp.md) *[time](zh-cn_topic_0000001054879478.md#gae7841e681c8c9d59818568d39553642c))

Description:

Obtains the last number of output audio frames.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
frames Indicates the pointer to the last number of output audio frames.
time Indicates the pointer to the timestamp associated with the frame.

Returns:

Returns 0 if the last number is obtained; returns a negative value otherwise.

See also:

RenderFrame

GetRenderSpeed

int32_t(* AudioRender::GetRenderSpeed) (struct [AudioRender](AudioRender.md) *render, float *speed)

Description:

Obtains the current audio rendering speed.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
speed Indicates the pointer to the current rendering speed to obtain.

Returns:

Returns 0 if the speed is successfully obtained; returns a negative value otherwise.

See also:

SetRenderSpeed

RenderFrame

int32_t(* AudioRender::RenderFrame) (struct [AudioRender](AudioRender.md) *render, const void *frame, uint64_t requestBytes, uint64_t *replyBytes)

Description:

Writes a frame of output data (downlink data) into the audio driver for rendering.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
frame Indicates the pointer to the frame to write.
requestBytes Indicates the size of the frame, in bytes.
replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to write.

Returns:

Returns 0 if the data is written successfully; returns a negative value otherwise.

SetChannelMode

int32_t(* AudioRender::SetChannelMode) (struct [AudioRender](AudioRender.md) *render, enum [AudioChannelMode](Audio.md#ga78aab1fafb9657451804e42b42897123) mode)

Description:

Sets the channel mode for audio rendering.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
mode Indicates the channel mode to set.

Returns:

Returns 0 if the setting is successful; returns a negative value otherwise.

See also:

GetChannelMode

SetRenderSpeed

int32_t(* AudioRender::SetRenderSpeed) (struct [AudioRender](AudioRender.md) *render, float speed)

Description:

Sets the audio rendering speed.

Parameters:

Name

Description

render Indicates the pointer to the AudioRender object to operate.
speed Indicates the rendering speed to set.

Returns:

Returns 0 if the setting is successful; returns a negative value otherwise.

See also:

GetRenderSpeed

1
https://gitee.com/flyinghui/docs.git
git@gitee.com:flyinghui/docs.git
flyinghui
docs
docs
master

搜索帮助