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

  1. int32_t(* AudioAdapter::CreateCapture) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, const struct [AudioDeviceDescriptor]($api-api-SmartVision-Devices-AudioDeviceDescriptor.md) *desc, const struct [AudioSampleAttributes]($api-api-SmartVision-Devices-AudioSampleAttributes.md) *attrs, struct [AudioCapture]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::CreateRender) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, const struct [AudioDeviceDescriptor]($api-api-SmartVision-Devices-AudioDeviceDescriptor.md) *desc, const struct [AudioSampleAttributes]($api-api-SmartVision-Devices-AudioSampleAttributes.md) *attrs, struct [AudioRender]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::DestroyCapture) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, struct [AudioCapture]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::DestroyRender) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, struct [AudioRender]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::GetPassthroughMode) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, const struct [AudioPort]($api-api-SmartVision-Devices-AudioPort.md) *port, enum [AudioPortPassthroughMode]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::GetPortCapability) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, const struct [AudioPort]($api-api-SmartVision-Devices-AudioPort.md) *port, struct [AudioPortCapability]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::InitAllPorts) (struct [AudioAdapter]($api-api-SmartVision-Devices-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

  1. int32_t(* AudioAdapter::SetPassthroughMode) (struct [AudioAdapter]($api-api-SmartVision-Devices-AudioAdapter.md) *adapter, const struct [AudioPort]($api-api-SmartVision-Devices-AudioPort.md) *port, enum [AudioPortPassthroughMode]($api-api-SmartVision-Devices-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