1 Star 0 Fork 4.9K

famoustang / docs

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

AudioAdapter

Overview

Related Modules:

Audio

Description:

Provides audio adapter capabilities, including initializing ports, creating rendering and capturing tasks, and obtaining the port capability set.

Since:

1.0

Version:

1.0

Summary

Data Fields

Variable Name

Description

InitAllPorts )(struct AudioAdapter *adapter)

int32_t(* 

Initializes all ports of an audio adapter.

CreateRender )(struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, const struct AudioSampleAttributes *attrs, struct AudioRender **render)

int32_t(* 

Creates an AudioRender object.

DestroyRender )(struct AudioAdapter *adapter, struct AudioRender *render)

int32_t(* 

Destroys an AudioRender object.

CreateCapture )(struct AudioAdapter *adapter, const struct AudioDeviceDescriptor *desc, const struct AudioSampleAttributes *attrs, struct AudioCapture **capture)

int32_t(* 

Creates an AudioCapture object.

DestroyCapture )(struct AudioAdapter *adapter, struct AudioCapture *capture)

int32_t(* 

Destroys an AudioCapture object.

GetPortCapability )(struct AudioAdapter *adapter, const struct AudioPort *port, struct AudioPortCapability *capability)

int32_t(* 

Obtains the capability set of the port driver for the audio adapter.

SetPassthroughMode )(struct AudioAdapter *adapter, const struct AudioPort *port, enum AudioPortPassthroughMode mode)

int32_t(* 

Sets the passthrough data transmission mode of the audio port driver.

GetPassthroughMode )(struct AudioAdapter *adapter, const struct AudioPort *port, enum AudioPortPassthroughMode *mode)

int32_t(* 

Obtains the passthrough data transmission mode of the audio port driver.

Details

Field Documentation

CreateCapture

int32_t(* AudioAdapter::CreateCapture) (struct [AudioAdapter](AudioAdapter.md) *adapter, const struct [AudioDeviceDescriptor](AudioDeviceDescriptor.md) *desc, const struct [AudioSampleAttributes](AudioSampleAttributes.md) *attrs, struct [AudioCapture](AudioCapture.md) **capture)

Description:

Creates an AudioCapture object.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
desc Indicates the pointer to the descriptor of the audio adapter to start.
attrs Indicates the pointer to the audio sampling attributes to open.
capture Indicates the double pointer to the AudioCapture object.

Returns:

Returns 0 if the AudioCapture object is created successfully; returns a negative value otherwise.

See also:

GetPortCapability

CreateRender

int32_t(* AudioAdapter::CreateRender) (struct [AudioAdapter](AudioAdapter.md) *adapter, const struct [AudioDeviceDescriptor](AudioDeviceDescriptor.md) *desc, const struct [AudioSampleAttributes](AudioSampleAttributes.md) *attrs, struct [AudioRender](AudioRender.md) **render)

Description:

Creates an AudioRender object.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
desc Indicates the pointer to the descriptor of the audio adapter to start.
attrs Indicates the pointer to the audio sampling attributes to open.
render Indicates the double pointer to the AudioRender object.

Returns:

Returns 0 if the AudioRender object is created successfully; returns a negative value otherwise.

See also:

GetPortCapability

DestroyCapture

int32_t(* AudioAdapter::DestroyCapture) (struct [AudioAdapter](AudioAdapter.md) *adapter, struct [AudioCapture](AudioCapture.md) *capture)

Description:

Destroys an AudioCapture object.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
capture Indicates the pointer to the AudioCapture object to operate.

Attention:

Do not destroy the object during audio capturing.

Returns:

Returns 0 if the AudioCapture object is destroyed; returns a negative value otherwise.

See also:

CreateCapture

DestroyRender

int32_t(* AudioAdapter::DestroyRender) (struct [AudioAdapter](AudioAdapter.md) *adapter, struct [AudioRender](AudioRender.md) *render)

Description:

Destroys an AudioRender object.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
render Indicates the pointer to the AudioRender object to operate.

Attention:

Do not destroy the object during audio rendering.

Returns:

Returns 0 if the AudioRender object is destroyed; returns a negative value otherwise.

See also:

CreateRender

GetPassthroughMode

int32_t(* AudioAdapter::GetPassthroughMode) (struct [AudioAdapter](AudioAdapter.md) *adapter, const struct [AudioPort](AudioPort.md) *port, enum [AudioPortPassthroughMode](Audio.md#ga186d2d4f9a2ecacb80cd2cce2bd26f0e) *mode)

Description:

Obtains the passthrough data transmission mode of the audio port driver.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
port Indicates the pointer to the port.
mode Indicates the pointer to the passthrough transmission mode to obtain.

Returns:

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

See also:

SetPassthroughMode

GetPortCapability

int32_t(* AudioAdapter::GetPortCapability) (struct [AudioAdapter](AudioAdapter.md) *adapter, const struct [AudioPort](AudioPort.md) *port, struct [AudioPortCapability](AudioPortCapability.md) *capability)

Description:

Obtains the capability set of the port driver for the audio adapter.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
port Indicates the pointer to the port.
capability Indicates the pointer to the capability set to obtain.

Returns:

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

InitAllPorts

int32_t(* AudioAdapter::InitAllPorts) (struct [AudioAdapter](AudioAdapter.md) *adapter)

Description:

Initializes all ports of an audio adapter.

Call this function before calling other driver functions to check whether the initialization is complete. If the initialization is not complete, wait for a while (for example, 100 ms) and perform the check again until the port initialization is complete.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.

Returns:

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

SetPassthroughMode

int32_t(* AudioAdapter::SetPassthroughMode) (struct [AudioAdapter](AudioAdapter.md) *adapter, const struct [AudioPort](AudioPort.md) *port, enum [AudioPortPassthroughMode](Audio.md#ga186d2d4f9a2ecacb80cd2cce2bd26f0e) mode)

Description:

Sets the passthrough data transmission mode of the audio port driver.

Parameters:

Name

Description

adapter Indicates the pointer to the audio adapter to operate.
port Indicates the pointer to the port.
mode Indicates the passthrough transmission mode to set.

Returns:

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

See also:

GetPassthroughMode

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

搜索帮助