10.3. API Reference¶
thissectionwillsequentiallyDescriptionCVI_AUDIO eachModuleAPIUseMethod, pleaseNoteinUseCVI_ADUDIOtimepleasefirstverify CVI_SYS_Init alreadybeCall, canensureforshouldsystemgroupitemInitialize, CVI_AUDIO_INITalsomustbeCall, canensureAudioModuleinsoftwarealreadybeInitialize, userNoteCVI_AUDIO_INITonlyneed tocallonesecondary. inexit AudioUsetime, pleaseverifyCVI_AUDIOrelated modulealreadyperformDisbale, andconnectwithCall CVI_SYS_Exit.
10.3.1. Module Attribute APIs¶
AudioFunctionAPI:
CVI_AUDIO_INIT: InitializeAudioModule.
CVI_AUDIO_DEINIT: Deinitialize the audio module.
CVI_AUD_SYS_Bind: SetAudioBindAttribute.
CVI_AUD_SYS_UnBind: Unbind Audio.
10.3.1.1. CVI_AUDIO_INIT¶
Description
Initializeaudio Module.
Syntax
CVI_S32 CVI_AUDIO_INIT(void); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
None | No input value is required |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
UseaudioModulebefore, need tothroughthisAPIperformInitialize. otherwiseFunctionwillabnormalorMemoryDataError.
10.3.1.2. CVI_AUDIO_DEINIT¶
Description
Release audio Module.
Syntax
CVI_S32 CVI_AUDIO_DEINIT(void); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
None | No input value is required |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
audioModulebefore, need tothroughthisAPIperformReleaseModule. otherwiseFunctionwillabnormalorbodyDataError.
10.3.1.3. CVI_AUD_SYS_Bind¶
Description
Set Audio ModuleBindAttribute.
Syntax
CVI_S32 CVI_AUD_SYS_Bind(const MMF_CHN_S *pstSrcChn, const MMF_CHN_S *pstDestChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
pstSrcChn | Audio BindSourcePointer. | Input |
pstDestChn | Audio BindPurposePointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
SupportBindobjectis:
(AudIn -> AudEnc),
(AudDec ->AudOut),
See also
cvi_sample_audio.cinSAMPLE_AUDIO_AiAencandSAMPLE_AUDIO_AdecAoUnbind method.
Example
None.
10.3.1.4. CVI_AUD_SYS_UnBind¶
Description
release AUDIO ModuleBind.
Syntax
CVI_S32 CVI_AUD_SYS_UnBind(const MMF_CHN_S *pstSrcChn, const MMF_CHN_S *pstDestChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
pstSrcChn | AUDIO ModuleBindSourcePointer. | Input |
pstDestChn | AUDIO ModuleBindPurposePointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
None
Example
None.
10.3.2. Audio input¶
Audio inputimplementConfigurationandEnableDevice, GetAudioFrameDataetc.Function.
thisFunctionModuleprovidewithunder API:
CVI_AI_SetPubAttr: Set Audio Input Device attributes.
CVI_AI_GetPubAttr: Get Audio Input Device attributes.
CVI_AI_Enable: Enable Audio Input Device.
CVI_AI_Disable: Disable Audio Input Device.
CVI_AI_EnableChn: Enable Audio Input Channel.
CVI_AI_DisableChn: Disable Audio Input Channel.
CVI_AI_GetFrame: GetaudioFrame.
CVI_AI_ReleaseFrame: ReleaseaudioFrame.
CVI_AI_SetChnParam: Set Audio Input ChannelParameter.
CVI_AI_GetChnParam: Get Audio Input ChannelParameter.
CVI_AI_EnableReSmp: Enable Audio Input resampling.
CVI_AI_DisableReSmp: Disable Audio Input resampling.
CVI_AI_ClrPubAttr: Clear Audio Input Device attributes.
CVI_AI_SaveFile: EnableAudio inputsaveFileFunction.
CVI_AI_QueryFileStatus: QueryAudio inputChannelWhetherin the file-saving state.
CVI_AI_EnableAecRefFrame: Allow the user to get the AEC reference frame even when AEC is not enabled.
CVI_AI_DisableAecRefFrame: Prohibit getting the AEC reference frame when AEC is not enabled.
CVI_AI_SetVolume: Set Audio Input DeviceVolume.
CVI_AI_GetVolume: GetAudio Input DeviceVolume.
CVI_AI_SetStereoVolume: Set Audio Input DevicestereoVolume.
CVI_AI_GetStereoVolume: Get Audio Input DevicestereoVolume.
10.3.2.1. CVI_AI_SetPubAttr¶
Description
Set Audio Input Device attributes
Syntax
CVI_S32 CVI_AI_SetPubAttr(AUDIO_DEV AiDevId, const AIO_ATTR_S *pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number | Input |
pstAttr | Audio InputDevice attributesPointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Audio input device attributesdetermineInputDataFormat, InputDevice attributesincludingOperating mode, Sample rate, samplingprecision, buffer Size, eachFramesamplingpointnumber, extendedflag, clockselectandChannelCount. theseAttributeshouldwithforconnect Codec Configurationtimingonecause, that iscanSuccessforconnect.
AiDevId is preset to 0; unless expansion is required, a value above 2 returns an error.
enBitwidth: bitsdepth 8bit, 16bit or 24bit, actualapplicationinsamplingprecisionAudio Codec limit.
buffer Size AIO_ATTR_S in u32FrmNum used to Configuration Audio Input inused to ReceiveAudioDataregionblockAudio.
UsrFrmDept: regionblockaudio frame, recommendneed togreater thanetc.to 5.
enSamplerateWhen AudioSample rateheighttime, recommendshouldincreaseeachFramesamplingpointCount.
ifwillthesecaptured AudioDatasendEncoding, thenshouldeachFrametimenotto 10ms (For example 16K samplingfrequencyunder eachFramesamplingpointnumbertoshouldSetis 160), otherwiseDecodingafteraudiocancanhasabnormal.
enSoundmode: dualAudio ChannelorsingleAudio Channelspeechaudio frameSet
u32ChnCnt: ChannelCount ChannelCountrefers tocurrentInputDevice Audio Input FunctionChannelCount, need towithforconnect Audio Codec Configuration onecause; Support 1, 2.
u32EXFlag: extendedflagfor Audio Input DeviceInvalid
u32ClkSel: clockSet
Example
None.
10.3.2.2. CVI_AI_GetPubAttr¶
Description
Get Audio Input Device attributes
Syntax
CVI_S32 CVI_AI_GetPubAttr(AUDIO_DEV AiDevId, AIO_ATTR_S*pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number | Input |
pstAttr | Audio Input Device attributesPointer | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
ifnot initializedorisCVI_AI_SetPubAttrnotcall, thenuserwilltocontentis0Pointerandnumbervalue.
AiDevId is preset to 0; unless expansion is required, a value above 2 returns an error.
Example
None.
10.3.2.3. CVI_AI_Enable¶
Description
Enable Audio Input Device
Syntax
CVI_S32 CVI_AI_Enable(AUDIO_DEV AiDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
thisAPIisFinally, EnableAudio Inputnumber, inCallbeforepleaseverifyRelatedAttributealreadySetcompleted.
Example
Audio InUse范例: CVI_S32 i; CVI_S32 s32Ret; s32Ret = CVI_AI_SetPubAttr(AiDevId, pstAioAttr); if (s32Ret) { printf("%s: CVI_AI_SetPubAttr(%d) failed with %#x\n" , __func__, AiDevId, s32Ret); return s32Ret; } s32Ret = CVI_AI_Enable(AiDevId); if (s32Ret) { printf("%s: CVI_AI_Enable(%d) failed with %#x\n", __func__, AiDevId, s32Ret); return s32Ret; } for (i = 0; i < s32AiChnCnt >> pstAioAttr->enSoundmode; i++) { s32Ret = CVI_AI_EnableChn(AiDevId, i / (pstAioAttr->enSoundmode + 1)); if (s32Ret) { printf("%s: CVI_AI_EnableChn(%d,%d) failed with %#x\n", __func__, AiDevId, i, s32Ret); return s32Ret; } if (bResampleEn == CVI_TRUE) { s32Ret = CVI_AI_EnableReSmp(AiDevId, i, enOutSampleRate); if (s32Ret) { printf("%s: CVI_AI_EnableReSmp(%d,%d) failed with %#x\n", __func__, AiDevId, i, s32Ret); return s32Ret; } } if (pstAiVqeAttr != NULL) { CVI_BOOL bAiVqe = CVI_TRUE; s32Ret = CVI_AI_SetTalkVqeAttr( 0, 0, 0, 0, (AI_TALKVQE_CONFIG_S *)pstAiVqeAttr); break; } if (s32Ret) { printf("%s: SetAiVqe%d(%d,%d) failed with %#x\n", __func__, u32AiVqeType, AiDevId, i, s32Ret); return s32Ret; } if (bAiVqe) { s32Ret = CVI_AI_EnableVqe(AiDevId, i); if (s32Ret) { printf("%s: CVI_AI_EnableVqe(%d,%d) failed with %#x\n", __func__, AiDevId, i, s32Ret); return s32Ret; } } } 10.3.2.4. CVI_AI_Disable¶
Description
Audio Input Device
Syntax
CVI_S32 CVI_AI_Disable(AUDIO_DEV AiDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
thisAPIisstopAudio InputDeviceFinally, oneprogram, Disable Audio Input Devicebeforemust firstDisablethisDeviceunderalready enabledthehas Audio Input Channel, ifhasAENCorAudio Outputconnect, pleasefirststopwithofbindingthenCallthis.
Example
None.
10.3.2.5. CVI_AI_EnableChn¶
Description
Enable Audio Input Channel
Syntax
CVI_S32 CVI_AI_EnableChn(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Enable Audio Input Channelbefore, must firstEnableitstheAudio InputDevice.
Example
None.
10.3.2.6. CVI_AI_DisableChn¶
Description
Disable Audio Input Channel.
Syntax
CVI_S32 CVI_AI_DisableChn(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
pleasein CVI_AI_Disable beforecallthisAPI, ChannelParameter.
Example
None.
10.3.2.7. CVI_AI_GetFrame¶
Description
Getaudio frame
Syntax
CVI_S32 CVI_AI_GetFrame(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_FRAME_S *pstFrm, AEC_FRAME_S *pstAecFrm , CVI_S32 s32MilliSec); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstFrm | Audio frame structure pointer. The user obtains the audio frame through this structure pointer. | Output |
pstAecFrm | Echo CancellationReferenceFrameStructurePointer. | Output |
s32MilliSec | GetData timeout -1 indicates blocking mode and waits indefinitely when there is no data; 0 meansnon-blockingMode, NoneDatatimethenReturn; >0 meansblocking s32MilliSec milliseconds, TimeoutthenReturn | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
s32MilliSec valuemustgreater thanetc.to-1, etc.to-1 timeusingblockingModeGetData, etc.to 0 time non-blockingModeGetData, greater than 0 time, blocking s32MilliSec millisecondsafter, nothasDatathenReturn timeand.
GetAudioFrameDatabefore, must firstEnableforshould Audio Input Channel.
GetAECaudio frame, pleasefirstdetermineVQEinAECalready enabled.
Example
None.
10.3.2.8. CVI_AI_ReleaseFrame¶
Description
Releaseaudio frame.
Syntax
CVI_S32 CVI_AI_ReleaseFrame(AUDIO_DEV AiDevId, AI_CHN AiChn, const AUDIO_FRAME_S *pstFrm, const AEC_FRAME_S *pstAecFrm); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstFrm | Audio frame structure pointer. The user obtains the audio frame through this structure pointer. | Input |
pstAecFrm | Echo CancellationReferenceFrameStructurePointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
If notneed toReleaseEcho CancellationReferenceFrame, pstAecFrm setis NULL that iscan.
Example
None.
10.3.2.9. CVI_AI_SetChnParam¶
Description
Set Audio Input ChannelParameter.
Syntax
CVI_S32 CVI_AI_SetChnParam(AUDIO_DEV AiDevId, AI_CHN AiChn, const AI_CHN_PARAM_S *pstChnParam); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstChnParam | AudioChannelParameter | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
ChannelParameterbeforeonlyhasaMembervariable, used to SetUserGetAudioFrameregionblockdepth,
defaultdepthis0. thisMembervariablevaluenotcangreater than30.
Example
None.
10.3.2.10. CVI_AI_GetChnParam¶
Description
Get Audio Input ChannelParameter.
Syntax
CVI_S32 CVI_AI_GetChnParam(AUDIO_DEV AiDevId, AI_CHN AiChn, AI_CHN_PARAM_S *pstChnParam); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstChnParam | AudioChannelParameter | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h thisFileprovideandAudioModuletoMiddlewaremultiplebodylayerInterfaceofone
Library files: libcvi_audio.a
Precautions
ChannelParameterbeforeonlyhasaMembervariable, used to SetUserGetAudioFrameregionblockdepth.
Example
None.
10.3.2.11. CVI_AI_EnableReSmp¶
Description
Enable Audio Input resampling.
Syntax
CVI_S32 CVI_AI_EnableReSmp(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_SAMPLE_RATE_E enOutSampleRate); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
enOutSampleRat | AudioresamplingOutputSample rate. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_vqe.so, libcvi_RES1.so
Precautions
None.
Sample rateSupportlevelas follows:
typedef enum _AUDIO_SAMPLE_RATE_E { AUDIO_SAMPLE_RATE_8000 = 8000, /* 8K samplerate*/ AUDIO_SAMPLE_RATE_11025 = 11025, /* 11.025K samplerate*/ AUDIO_SAMPLE_RATE_16000 = 16000, /* 16K samplerate*/ AUDIO_SAMPLE_RATE_22050 = 22050, /* 22.050K samplerate*/ AUDIO_SAMPLE_RATE_24000 = 24000, /* 24K samplerate*/ AUDIO_SAMPLE_RATE_32000 = 32000, /* 32K samplerate*/ AUDIO_SAMPLE_RATE_44100 = 44100, /* 44.1K samplerate*/ AUDIO_SAMPLE_RATE_48000 = 48000, /* 48K samplerate*/ AUDIO_SAMPLE_RATE_64000 = 64000, /* 64K samplerate*/ AUDIO_SAMPLE_RATE_BUTT, } AUDIO_SAMPLE_RATE_E; Example
None.
10.3.2.12. CVI_AI_DisableReSmp¶
Description
Close Audio Input resamplingFunction.
Syntax
CVI_S32 CVI_AI_DisableReSmp(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so
Precautions
requireinCallthisInterfacebefore, firstDisableUsethis Audio Input DeviceshouldChannelAudioData AENC Channel and Audio Output Channel, otherwisecancancausethisInterfaceCallFailure.
Example
None.
10.3.2.13. CVI_AI_ClrPubAttr¶
Description
empty Pub Attribute.
Syntax
CVI_S32 CVI_AI_ClrPubAttr(AUDIO_DEV AiDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Stop the device before clearing device attributes.
ClearDevice attributesbefore, recommendstopthehasinternalorisuser-get modeof, layerstillinaudio framewhilecauseisabnormal.
Example
None.
10.3.2.14. CVI_AI_SaveFile¶
Description
EnableAudio inputsaveFileFunction.
Syntax
CVI_S32 CVI_AI_SaveFile(AUDIO_DEV AiDevId, AI_CHN AiChn, const AUDIO_SAVE_FILE_INFO_S *pstSaveFileInfo); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstSaveFileInfo | Audio save-file attribute structure pointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
This interface is used only to dump Audio Input data when Audio Input-AENC and Audio Input-Audio Output are not system-bound.
Example
None.
10.3.2.15. CVI_AI_QueryFileStatus¶
Description
QueryAudio inputChannelWhetherin the file-saving state.
Syntax
CVI_S32 CVI_AI_QueryFileStatus(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_FILE_STATUS_S* pstFileStatus); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstFileStatus | fileStatusAttribute StructurebodyPointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
thisInterfacemainused to, oneflownotwillto.
This interface is used only to dump Audio Input data when Audio Input-AENC and Audio Input-Audio Output are not system-bound.
thisInterfaceused to QueryAudio inputChannelWhetherin the file-saving state, When UserCall CVI_AI_SaveFile storageFileafter, canCallthisInterfaceQuerystorageFileWhetherreachspecified, If pstFileStatus bSaving is CVI_TRUE, DescriptionnothasreachspecifiedSize, is CVI_FALSEthenalreadyreachspecifiedSize.
Example
None.
10.3.2.16. CVI_AI_EnableAecRefFrame¶
Description
in AEC notOpencaseunderalsomakeUsercanGetto AEC ReferenceFrame.
Syntax
CVI_S32 CVI_AI_EnableAecRefFrame(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
AoDevId | used to Get AEC ReferenceFrame Audio Output Device number. | Input |
AoChn | used to Get AEC ReferenceFrame Audio Output Channel numberDescription | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
None.
Example
None.
10.3.2.17. CVI_AI_DisableAecRefFrame¶
Description
Prohibit getting the AEC reference frame when AEC is not enabled.
Syntax
CVI_S32 CVI_AI_DisableAecRefFrame(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
None.
Example
None.
10.3.2.18. CVI_AI_SetVolume¶
Description
SetInputVolume.
Syntax
CVI_S32 CVI_AI_SetVolume(AUDIO_DEV AiDevId, CVI_S32 s32VolumeStep); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
s32VolumeStep | InputVolumestep[24-0, 0:mute]. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a/libcvi_audio.so
Precautions
None.
Example
None.
10.3.2.19. CVI_AI_GetVolume¶
Description
GetInputVolume.
Syntax
CVI_S32 CVI_AI_GetVolume(AUDIO_DEV AiDevId, CVI_S32 *ps32VolumeStep); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
ps32VolumeStep | VolumestepPointer[24-0, 0:mute]. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a/libcvi_audio.so
Precautions
None.
Example
None.
10.3.2.20. CVI_AI_SetStereoVolume¶
Description
SetAudio inputsingleChannelVolume.
Syntax
CVI_S32 CVI_AI_SetStereoVolume(AUDIO_DEV AiDevId, CVI_S32 AiStereoId, CVI_S32 s32Volume); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio inputDevice number. | Input |
AiStereoId | Audio Input Audio Channel number. | Input |
s32Volume | Volumevalue, Value Range: [0, 24]. | Input |
Return Value
Return Value | Description |
|---|---|
0 | Success. |
Non-zero | Failure; seeError Codes. |
Requirements
Header files: cvi_ai.h
Library files: libai.a
Note
AiStereoId 0: generationTableSetleftAudio ChannelVolumevalue. 1: generationTableSetrightAudio ChannelVolumevalue.
Example
None
10.3.2.21. CVI_AI_GetStereoVolume¶
Description
GetAudio inputChannelVolume.
Syntax
CVI_S32 CVI_AI_GetStereoVolume(AUDIO_DEV AiDevId, CVI_S32 AiStereoId, CVI_S32 *ps32Volume); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio inputDevice number. | Input |
AiStereoId | Audio Input Audio Channel number. | Input |
ps32Volume | VolumevaluePointer, Value Range: [0, 24]. | Output |
Return Value
Return Value | Description |
|---|---|
0 | Success. |
Non-zero | Failure; seeError Codes. |
Requirements
Header files: cvi_ai.h
Library files: libai.a
Note
AiStereoId 0: generationTableGetleftAudio ChannelVolumevalue. 1: generationTableGetrightAudio ChannelVolumevalue.
Example
None
10.3.3. Voice Quality EnhancementAPI¶
CVI_AI_SetVqeAttr: Set attributes related to the Audio Input voice quality enhancement function.
CVI_AI_SetTalkVqeAttr: Set attributes related to the Audio Input speech quality enhancement function.
CVI_AI_GetTalkVqeAttr: Get Audio Input speechqualityenhancementFunctionspeechRelatedAttribute.
CVI_AI_SetRecordVqeAttr: Set Audio Input recordingqualityenhancementFunctionRelatedAttribute. (beforeNot supported);
CVI_AI_GetRecordVqeAttr: Get Audio Input recordingqualityenhancementFunctionRelatedAttribute. (beforeNot supported);
CVI_AI_EnableVqe: Enable Audio Input audioqualityenhancementFunction.
CVI_AO_DisableVqe: Disable Audio Output audioqualityenhancementFunction.
CVI_AI_SetVqeVolume: SetAudio input (AI) DeviceVolume.
CVI_AI_GetVqeVolume: GetAudio input (AI) DeviceVolume.
CVI_AI_VqeFunConfig: ConfigurationAudio input (AI) Deviceaudioqualityenhancement (VQE) Function.
CVI_AI_DisableVqe: Disable Audio Input audioqualityenhancementFunction.
CVI_AI_SetTrackMode: SetAudio ChannelMode.
CVI_AI_GetTrackMode: GetAudio ChannelMode.
CVI_AO_SetVqeAttr: Set attributes related to the Audio Output voice quality enhancement function.
CVI_AO_GetVqeAttr: Get Audio Output audioqualityenhancementFunctionRelatedAttribute.
CVI_AO_EnableVqe: Enable Audio Output audioqualityenhancementFunction.
CVI_AO_DisableVqe: Disable Audio Output audioqualityenhancementFunction.
CVI_VQE_PathSelect: VQE algorithmpathSet.
10.3.3.1. CVI_AI_SetVqeAttr¶
Description
Set attributes related to the Audio Input voice quality enhancement function.
Syntax
CVI_S32 CVI_AI_SetVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_DEV AoDevId, AO_CHN AoChn, AI_VQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
AoDevId | Audio OutputDevice number, used to Echo Cancellation. | Input |
AoChn | Audio Output Channel number used for echo cancellation. | Input |
pstVqeConfig | Audio input voice quality enhancement configuration structure pointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so,
Precautions
EnableaudioqualityenhancementFunctionbeforemust firstSetRelativeshould Audio Input ChannelaudioqualityenhancementFunctionRelatedAttribute.
Set Audio Input audioqualityenhancementFunctionRelatedAttributebefore, must firstEnableforshould Audio Input Channel.
same Audio Input ChannelaudioqualityenhancementFunctionNot supporteddynamicSetAttribute, againSet Audio Input Channelaudio qualityenhancementFunctionRelatedAttributetime, need tofirstClose Audio Input ChannelaudioqualityFunction, thenSet Audio Input ChannelaudioqualityenhancementFunctionRelatedAttribute.
Example
None.
10.3.3.2. CVI_AI_SetTalkVqeAttr¶
Description
Set Audio Input audioqualityenhancementFunction (Talk) RelatedAttribute.
Syntax
CVI_S32 CVI_AI_SetTalkVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_DEV AoDevId, AO_CHN AoChn, AI_TALKVQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
AoDevId | Audio OutputDevice number, used to Echo Cancellation. | Input |
AoChn | Audio Output Channel number used for echo cancellation. | Input |
pstVqeConfig | Audio input voice quality enhancement configuration structure pointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
Talk Vqe mainin IPC sceneunderUse.
same Audio Input ChannelaudioqualityenhancementFunctionNot supporteddynamicSetAttribute, againSet Audio Input Channelaudio qualityenhancementFunctionRelatedAttributetime, need tofirstClose Audio Input ChannelaudioqualityFunction, thenSet Audio Input Channel audioqualityenhancementFunctionRelatedAttribute.
Example
None.
10.3.3.3. CVI_AI_GetTalkVqeAttr¶
Description
Get Audio Input audioqualityenhancementFunction (Talk) RelatedAttribute
Syntax
CVI_S32 CVI_AI_GetTalkVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, AI_TALKVQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstVqeConfig | Audio input voice quality enhancement configuration structure pointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
GetaudioqualityenhancementFunctionRelatedAttributebeforemust firstSetRelativeshould Audio Input ChannelaudioqualityenhancementFunctionRelatedAttribute.
Example
None.
10.3.3.4. CVI_AI_SetRecordVqeAttr¶
Description
Set attributes related to the Audio Input voice quality enhancement function (Record).
Syntax
CVI_S32 CVI_AI_SetRecordVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, const AI_RECORDVQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstVqeConfig | Audio input voice quality enhancement configuration structure pointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
None.
Example
None.
10.3.3.5. CVI_AI_GetRecordVqeAttr¶
Description
Set attributes related to the Audio Input voice quality enhancement function (Record).
Syntax
CVI_AI_GetRecordVqeAttr (AUDIO_DEV AiDevId, AI_CHN AiChn, const AI_RECORDVQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error | Input |
AiChn | Audio input channel number. It is independent of the channel mode description in enSoundmode. Users can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
pstVqeConfig | Audio input voice quality enhancement configuration structure pointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
None.
Example
None.
10.3.3.6. CVI_AI_EnableVqe¶
Description
Enable Audio Input audioqualityenhancementFunction.
Syntax
CVI_S32 CVI_AI_EnableVqe(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AiChn | Audio Input channel number. It is unrelated to the Audio Channel mode description in enSoundmode. The user can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
EnableaudioqualityenhancementFunctionbeforemust firstEnableRelativeshould Audio Input Channel.
multiplesecondaryEnablesame Audio Input ChannelaudioqualityenhancementFunctiontime, ReturnSuccess.
Disable Audio Input Channelafter, If againEnable Audio Input Channel, andUseaudioqualityenhancementFunction, need toCallthisconnect againEnableaudioqualityenhancementFunction.
Example
None.
10.3.3.7. CVI_AI_DisableVqe¶
Description
Disable Audio Input audioqualityenhancementFunction
Syntax
CVI_S32 CVI_AI_DisableVqe(AUDIO_DEV AiDevId, AI_CHN AiChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AiChn | Audio Input channel number. It is unrelated to the Audio Channel mode description in enSoundmode. The user can obtain the same device audio source through different AiChn values under the same AiDevId. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
notthenUse Audio Input audioqualityenhancementFunctiontime, shouldthisCallthisInterfacewillitsDisable.
Example
None.
10.3.3.8. CVI_AI_SetTrackMode¶
Description
Set Audio Input Audio ChannelMode
Syntax
CVI_S32 CVI_AI_SetTrackMode(AUDIO_DEV AiDevId, AUDIO_TRACK_MODE_E enTrackMode); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error | Input |
enTrackMode | typedef enum _AUDIO_TRACK_MODE_E { AUDIO_TRACK_NORMAL = 0, AUDIO_TRACK_BOTH_LEFT = 1, AUDIO_TRACK_BOTH_RIGHT = 2, AUDIO_TRACK_EXCHANGE = 3, AUDIO_TRACK_MIX = 4, AUDIO_TRACK_LEFT_MUTE = 5, AUDIO_TRACK_RIGHT_MUTE = 6, AUDIO_TRACK_BOTH_MUTE = 7, AUDIO_TRACK_BUTT } AUDIO_TRACK_MODE_E; | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
When the Audio Input device operates in I2S mode, getting the Audio Channel mode is supported; it is not supported in PCM mode.
Call this interface after the Audio Input device has been successfully enabled.
Track mode capabilities are related to the audio codec. Settings may differ if the client uses its own codec.
Example
None.
10.3.3.9. CVI_AI_GetTrackMode¶
Description
Get Audio Input Audio ChannelMode
Syntax
CVI_S32 CVI_AI_GetTrackMode(AUDIO_DEV AiDevId, AUDIO_TRACK_MODE_E *penTrackMode); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error | Input |
enTrackMode | typedef enum _AUDIO_TRACK_MODE_E { AUDIO_TRACK_NORMAL = 0, AUDIO_TRACK_BOTH_LEFT = 1, AUDIO_TRACK_BOTH_RIGHT = 2, AUDIO_TRACK_EXCHANGE = 3, AUDIO_TRACK_MIX = 4, AUDIO_TRACK_LEFT_MUTE = 5, AUDIO_TRACK_RIGHT_MUTE = 6, AUDIO_TRACK_BOTH_MUTE = 7, AUDIO_TRACK_BUTT } AUDIO_TRACK_MODE_E; | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libcvi_RES1.so, libcvi_vqe.so, libssp.so
Precautions
When the Audio Input device operates in I2S mode, getting the Audio Channel mode is supported; it is not supported in PCM mode.
Call this interface after the Audio Input device has been successfully enabled.
Track mode capabilities are related to the audio codec. Settings may differ if the client uses its own codec.
Example
None.
10.3.3.10. CVI_AO_SetVqeAttr¶
Description
Set attributes related to the Audio Output voice quality enhancement function.
Syntax
CVI_S32 CVI_AO_SetVqeAttr(AUDIO_DEV AoDevId, AO_CHN AoChn, AO_VQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
AoChn | Audio output channel number | Input |
pstVqeConfig | Audio Output voice quality enhancement configuration structure pointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so
Precautions
EnableaudioqualityenhancementFunctionbeforemust firstSetRelativeshould Audio Output ChannelaudioqualityenhancementFunctionRelatedAttribute.
Set Audio Output audioqualityenhancementFunctionRelatedAttributebefore, must firstEnableforshould Audio Output Channel.
Example
None.
10.3.3.11. CVI_AO_GetVqeAttr¶
Description
Get Audio Output audioqualityenhancementFunctionRelatedAttribute.
Syntax
CVI_S32 CVI_AO_GetVqeAttr(AUDIO_DEV AoDevId, AO_CHN AoChn, AO_VQE_CONFIG_S *pstVqeConfig); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
AoChn | Audio output channel number | Input |
pstVqeConfig | Audio Output voice quality enhancement configuration structure pointer | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so, libcvi_vqe.so
Precautions
GetaudioqualityenhancementFunctionRelatedAttributebeforemust firstSetRelativeshould Audio Output ChannelaudioqualityenhancementFunctionRelatedAttribute
Example
None.
10.3.3.12. CVI_AO_EnableVqe¶
Description
Enable Audio Output audioqualityenhancementFunction.
Syntax
CVI_S32 CVI_AO_EnableVqe(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio output channel number. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so, libcvi_vqe.so
Precautions
EnableaudioqualityenhancementFunctionbeforemust firstEnableRelativeshouldAudio OutputChannel.
Disable Audio Output Channelafter, If againEnable Audio Output Channel, andUseaudioqualityenhancementFunction, need toCallthis InterfaceagainEnableaudioqualityenhancementFunction.
Example
None.
10.3.3.13. CVI_AO_DisableVqe¶
Description
Disable Audio Output audioqualityenhancementFunction.
Syntax
CVI_S32 CVI_AO_DisableVqe(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio output channel number. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp2.so, libcvi_RES1.so, libcvi_dnvqe.so
Precautions
notthenUse AO audioqualityenhancementFunctiontime, shouldthisCallthisInterfacewillitsDisable.
Example
None.
10.3.3.14. CVI_AI_SetVqeVolume¶
Description
SetAudio input (AI) DeviceVolume.
Syntax
CVI_S32 CVI_AI_SetVqeVolume(AUDIO_DEV AiDevId, AI_CHN AiChn, CVI_S32 s32VolumeDb); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number. | Input |
AiChn | Audio input channel number. | Input |
s32VolumeDb | Volumevalue, Unitis (dB). | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so, libcvi_vqe.so
Precautions
Call this interface after enabling AI VQE.
Example
None.
10.3.3.15. CVI_AI_GetVqeVolume¶
Description
GetAudio input (AI) DeviceVolume.
Syntax
CVI_S32 CVI_AI_GetVqeVolume(AUDIO_DEV AiDevId, AI_CHN AiChn, CVI_S32 *ps32VolumeDb); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number. | Input |
AiChn | Audio input channel number. | Input |
ps32VolumeDb | used to storageGettoVolumevalue, Unitis (dB). | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so, libcvi_vqe.so
Precautions
Call this interface after enabling AI VQE.
Example
None.
10.3.3.16. CVI_AI_VqeFunConfig¶
Description
ConfigurationAudio input (AI) Deviceaudioqualityenhancement (VQE) Function.
Syntax
CVI_S32 CVI_AI_VqeFunConfig(AUDIO_DEV AiDevId, AI_CHN AiChn, int u32Mask); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AiDevId | AudioDevice number. | Input |
AiChn | Audio input channel number. | Input |
u32Mask | FunctionConfigurationmask. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a, libssp.so, libcvi_RES1.so, libcvi_vqe.so
Precautions
Call this interface after enabling AI VQE.
Example
None.
10.3.3.17. CVI_VQE_PathSelect¶
Description
VQE algorithmpathSet.
Syntax
CVI_S32 CVI_VQE_PathSelect(E_VQE_ALGO_PATH eVqePath); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
eVqePath | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.so, libssp.so, libcvi_vqe.so
Precautions
thisAPI onlyinSupportICundercanUse, Usetimeneed toinENABLEbeforeEnable.
Example
None.
10.3.4. Audio output¶
Audio output (Audio Output) mainimplementEnableAudio outputDevice, SendAudioFrametoOutputChanneletc.Function.
belowlistAPIanddetailscontent:
CVI_AO_SetPubAttr: Set Audio Output Device attributes.
CVI_AO_GetPubAttr: Get Audio Output Device attributes.
CVI_AO_Enable: Enable Audio Output Device.
CVI_AO_Disable: Disable Audio Output Device.
CVI_AO_EnableChn: Enable Audio Output Channel.
CVI_AO_DisableChn: Disable Audio Output Channel.
CVI_AO_SendFrame: Send Audio Output AudioFrame.
CVI_AO_EnableReSmp: Enable Audio Output resampling.
CVI_AO_DisableReSmp: Disable Audio Output resampling.
CVI_AO_PauseChn: currently Audio Output Channel.
CVI_AO_ResumeChn: resume Audio Output Channel.
CVI_AO_ClearChnBuf: Clear Audio Output ChannelincurrentAudioDataregionblock.
CVI_AO_QueryChnStat: Query Audio Output ChannelincurrentAudioDataregionblockStatus.
CVI_AO_SetTrackMode: Set Audio Output DeviceAudio ChannelMode.
CVI_AO_GetTrackMode: Get Audio Output DeviceAudio ChannelMode.
CVI_AO_SetVolume: Set Audio Output DeviceVolumeSize.
CVI_AO_GetVolume: Get Audio Output DeviceVolumeSize.
CVI_AO_SetMute: Set Audio Output DeviceMuteStatus.
CVI_AO_GetMute: Get Audio Output DeviceMuteStatus.
CVI_AO_SaveFile: EnableAudio outputsaveFileFunction. (beforeNot supportedthisFunction, caninCVI_AO_SendFramebeforefile saving);
CVI_AO_ClrPubAttr: Clear Audio Output Device attributes.
CVI_AO_SetStereoVolume: Set Audio Output DevicestereoVolume.
CVI_AO_GetStereoVolume: Get Audio Output DevicestereoVolume.
10.3.4.1. CVI_AO_SetPubAttr¶
Description
Set Audio Output Device attributes
Syntax
CVI_S32 CVI_AO_SetPubAttr(AUDIO_DEV AoDevId,const AIO_ATTR_S *pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
pstAttr | Audio outputDevice attributes. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
inSetAttributebeforeneed to Audio Output toDisableStatus, If toEnableStatusthenneed to firstDisable Audio Output Device.
Audio Output mustand DA work withtocannormalOperation, Usermust DA SendDataFormatandChannelrelationshipcanfromcorrectChannelSendData.
Audio Output DevicemainModetime, determine Audio Output DeviceOutputclockConfigurationisSample rate, samplingprecisionand ChannelCount, samplingprecisionwithChannelCountthat isis Audio Output Devicetimingonesecondarysamplingbit width.
Audio Output DeviceAttribute StructurebodyinotherSee Audio Input ModuleMediumRelatedInterfaceDescription.
Example
None.
10.3.4.2. CVI_AO_GetPubAttr¶
Description
Get Audio Output Device attributes.
Syntax
CVI_S32 CVI_AO_GetPubAttr(AUDIO_DEV AoDevId, AIO_ATTR_S *pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
pstAttr | Audio outputDevice attributesPointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: ibcvi_audio.a
Precautions
GetAttributeisbeforeonesecondaryConfigurationAttribute.
If fromnot configuredAttribute, thenReturnAttributenot configuredError.
Example
CVI_S32 s32ret; AUDIO_DEV AoDevId = 0; AIO_ATTR_S stAttr; s32ret = CVI_AO_GetPubAttr(AoDevId, &stAttr); if(s32ret != CVI_SUCCESS) { printf("get ao %d attr err:0x%x\n", AoDevId,s32ret); return s32ret; } 10.3.4.3. CVI_AO_Enable¶
Description
Enable Audio Output Device.
Syntax
CVI_S32 CVI_AO_Enable(AUDIO_DEV AoDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
requireinEnablebeforeConfiguration Audio Output Device attributes, otherwise, it returnsAttributenot configuredError.
If Audio Output Devicealready enabled, thenconnectReturnSuccess.
Example
CVI_S32 i; CVI_S32 s32Ret; s32Ret = CVI_AO_SetPubAttr(AoDevId, pstAioAttr); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_SetPubAttr(%d) failed with %#x!\n", __func__, AoDevId, s32Ret); return CVI_FAILURE; } s32Ret = CVI_AO_Enable(AoDevId); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_Enable(%d) failed with %#x!\n", __func__, AoDevId, s32Ret); return CVI_FAILURE; } for (i = 0; i < s32AoChnCnt; i++) { s32Ret = CVI_AO_EnableChn(AoDevId, i / (pstAioAttr->enSoundmode + 1)); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_EnableChn(%d) failed with %#x!\n", __func__, i, s32Ret); return CVI_FAILURE; } if (bResampleEn == CVI_TRUE) { s32Ret = CVI_AO_DisableReSmp(AoDevId, i); s32Ret |= CVI_AO_EnableReSmp(AoDevId, i, enInSampleRate); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_EnableReSmp(%d,%d) failed with %#x!\n", __func__, AoDevId, i, s32Ret); return CVI_FAILURE; } } } s32Ret = CVI_AO_EnableChn(AoDevId, AO_SYSCHN_CHNID); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_EnableChn(%d) failed with %#x!\n", __func__, i, s32Ret); return CVI_FAILURE; } 10.3.4.4. CVI_AO_Disable¶
Description
Audio Output Device.
Syntax
CVI_S32 CVI_AO_Disable(AUDIO_DEV AoDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Disable Audio Output Devicebeforemust firstDisableDeviceunderthehas Audio Output Channel.
Example
None.
10.3.4.5. CVI_AO_EnableChn¶
Description
Enable Audio Output Channel.
Syntax
CVI_S32 CVI_AO_EnableChn(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Enable Audio Output Channelbefore, must firstEnableitsthe Audio Output Device, otherwise, it returnsDevicenotbootError Codes
Example
None.
10.3.4.6. CVI_AO_DisableChn¶
Description
Disable Audio Output Channel.
Syntax
CVI_S32 CVI_AO_DisableChn(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
None.
Example
None.
10.3.4.7. CVI_AO_SendFrame¶
Description
Send Audio Output audio frame.
Syntax
CVI_S32 CVI_AO_SendFrame(AUDIO_DEV AoDevId, AO_CHN AoChn, const AUDIO_FRAME_S *pstData, CVI_S32 s32MilliSec); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio output channel number. SupportChannelRangeby Audio Output DescriptioninDevice attributesinMaximumChannelCountu32ChnCntdeterminewithAudio ChannelMode enSoundmode determine. | Input |
pstData | AudioFrameStructurePointer. | Input |
s32MilliSec | SendDataTimeouttime -1 meansblockingMode; 0Descriptioninmeansnon-blockingMode; >0 indicates blocking for s32MilliSec milliseconds; a timeout returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
thisInterfaceused to UsermainSendAudioFrameto Audio Output Output.
Audio Output ChannelalreadythroughSystem Binding CVI_SYS_Bind) Interfacewith Audio Input or ADEC Bind, notneed toalsonotrecommendthisInterface.
CallthisInterfaceSendAudioFrameto Audio Output Outputtime, must firstEnableforshould Audio Output Channel.
Example
None.
10.3.4.8. CVI_AO_SetStereoVolume¶
Description
SetAudio outputChannelVolume.
Syntax
CVI_S32 CVI_AO_SetStereoVolume(AUDIO_DEV AoDevId, CVI_S32 AoStereoId, CVI_S32 s32Volume); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio outputDevice number. | Input |
AoStereoId | Audio Output Audio Channel number. | Input |
s32Volume | Volumevalue, Value Range: [0, 32]. | Input |
Return Value
Return Value | Description |
|---|---|
0 | Success. |
Non-zero | Failure; seeError Codes. |
Requirements
Header files: cvi_ao.h
Library files: libao.a
Note
AoStereoId 0: generationTableSetleftAudio ChannelVolumevalue. 1: generationTableSetrightAudio ChannelVolumevalue.
Example
None
10.3.4.9. CVI_AO_GetStereoVolume¶
Description
GetAudio outputChannelVolume.
Syntax
CVI_S32 CVI_AO_GetStereoVolume(AUDIO_DEV AoDevId, CVI_S32 AoStereoId, CVI_S32 *ps32Volume); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio outputDevice number. | Input |
AoStereoId | Audio Output Audio Channel number. | Input |
ps32Volume | VolumevaluePointer, Value Range: [0, 32]. | Output |
Return Value
Return Value | Description |
|---|---|
0 | Success. |
Non-zero | Failure; seeError Codes. |
Requirements
Header files: cvi_ao.h
Library files: libao.a
Note
AoStereoId 0: generationTableGetleftAudio ChannelVolumevalue. 1: generationTableGetrightAudio ChannelVolumevalue.
Example
None
10.3.4.10. CVI_AO_EnableReSmp¶
Description
Enable Audio Output resampling.
Syntax
CVI_S32 CVI_AO_EnableReSmp(AUDIO_DEV AoDevId, AO_CHN AoChn, AUDIO_SAMPLE_RATE_E enInSampleRate); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number.Device numberPreset to0, in notrequireunder, Setexceeds2, returns an error. | Input |
AoChn | Audio output channel number. SupportChannelRangeby Audio Output DescriptioninDevice attributesinMaximumChannelCount u32ChnCntdeterminewithAudio ChannelMode enSoundmode determine. | Input |
enInSampleRate | AudioresamplingInputSample rate. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
inUseCVI_AUD_SYS_BindStatusunder, Not supportedthisAPI
shouldthisinEnable Audio Output Channelafter that, Bind Audio Output Channelbefore, CallthisInterfaceEnableresamplingFunction.
repeatEnableresamplingFunction, butmust ensureafterConfigurationresamplingInputSample ratewithbeforeConfiguration resamplingInputSample rateone.
inDisable Audio Output Channelafter, If againEnable Audio Output Channel, andUseresamplingFunction, need toCallthisInterface againEnableresampling.
Audio Output resamplingInputSample ratemustwith Audio Output Device attributesConfigurationSample ratenotsame.
Example
None.
10.3.4.11. CVI_AO_DisableReSmp¶
Description
Disable Audio Output resampling.
Syntax
CVI_S32 CVI_AO_DisableReSmp(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
AoChn | Audio output channel number. SupportChannelRangeby Audio OutputDescriptioninDevice attributesinMaximumChannelCount u32ChnCntdeterminewithAudio ChannelMode enSoundmodedetermine. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
notthenUse Audio Output resamplingFunction, shouldthisCallthisInterfacewillitsDisable
Example
None.
10.3.4.12. CVI_AO_PauseChn¶
Description
currently Audio Output Channel.
Syntax
CVI_S32 CVI_AO_PauseChn(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Audio Output Channelcurrentlyafter, If Bind ADEC ChanneltothisChannelSendAudioFrameData, SendAudioFrameDatawillwillbeblocking; whileIf Bind Audio Input ChanneltothisChannelSendAudioFrameData, in ChannelnotfullcaseunderthenwillAudioFrameinBuffer, infullcaseunderthenwillAudioFramediscard.
Audio Output ChannelisDisableStatustime, notCallthisInterfacecurrently Audio Output Channel.
Example
None.
10.3.4.13. CVI_AO_ResumeChn¶
Description
resume Audio Output Channel.
Syntax
CVI_S32 CVI_AO_ResumeChn(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Audio Output ChannelcurrentlyaftercanthroughCallthisInterfaceagainresume
Audio Output ChanneliscurrentlyStatusorEnableStatusunder, CallthisInterfaceReturnSuccess; otherwiseCallwillreturns an error
Example
None.
10.3.4.14. CVI_AO_ClearChnBuf¶
Description
Clear Audio Output ChannelincurrentAudioDataregionblock.
Syntax
CVI_S32 CVI_AO_ClearChnBuf(AUDIO_DEV AoDevId, AO_CHN AoChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output channel has been successfully enabled.
iscompletelyClearDecodingplaybackpathonthehasregionblockData, thisInterfaceshouldthiswith CVI_ADEC_ClearChnBuf Interfacework withUse.
notrecommendedUse
Example
None.
10.3.4.15. CVI_AO_QueryChnStat¶
Description
Query Audio Output ChannelincurrentAudioDataregionblockStatus.
Syntax
CVI_S32 CVI_AO_QueryChnStat(AUDIO_DEV AoDevId, AO_CHN AoChn, AO_CHN_STATE_S *pstStatus); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
AoChn | Audio Output channel number. The supported channel range is determined by the maximum channel count u32ChnCnt in the Audio Output device attributes and the Audio Channel mode enSoundmode. | Input |
pstStatus | regionblockStatusStructurePointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output channel has been successfully enabled.
Example
None.
10.3.4.16. CVI_AO_SetTrackMode¶
Description
Set Audio Output DeviceAudio ChannelMode.
Syntax
CVI_S32 CVI_AO_SetTrackMode(AUDIO_DEV AoDevId, AUDIO_TRACK_MODE_E enTrackMode); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
enTrackMode | AudioDeviceAudio ChannelMode. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Audio Output DeviceOperationin I2S Modetime, SupportSetAudio ChannelMode, PCM ModeunderNot supported.
Example
CVO_S32 s32Ret; AUDIO_DEV AoDev = 0; AUDIO_TRACK_MODE_E enTrackMode = AUDIO_TRACK_NORMAL; AUDIO_TRACK_MODE_E temp; s32Ret = CVI_AO_SetTrackMode(AoDev, enTrackMode); if (CVI_SUCCESS != s32Ret) { printf("Ao set track mode failure! AoDev: %d, enTrackMode: %d, s32Ret: 0x%x.\n", AoDev, enTrackMode, s32Ret); return s32Ret; } s32Ret = CVI_AO_GetTrackMode(AoDev, &temp); if (s32Ret!=CVI_SUCCESS) { printf("Ao get track mode failure! AoDev: %d, s32Ret: 0x%x.\n", AoDev, s32Ret); return s32Ret; } 10.3.4.17. CVI_AO_GetTrackMode¶
Description
Get Audio Output DeviceAudio ChannelMode.
Syntax
CVI_S32 CVI_AO_GetTrackMode(AUDIO_DEV AoDevId, AUDIO_TRACK_MODE_E *penTrackMode); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
enTrackMode | AudioDeviceAudio ChannelMode. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Audio Output DeviceOperationin I2S Modetime, SupportGetAudio ChannelMode, PCM ModeunderNot supported.
Example
None.
10.3.4.18. CVI_AO_SetVolume¶
Description
Set Audio Output DeviceVolumeSize.
Syntax
CVI_S32 CVI_AO_SetVolume(AUDIO_DEV AoDevId, CVI_S32 s32VolumeDb); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
s32VolumeDb | VolumeRangeis[32~0], forshouldgain [0d - 22.5dB], eachonestep1.5dB. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Example
None.
10.3.4.19. CVI_AO_GetVolume¶
Description
Get Audio Output DeviceVolumeSize.
Syntax
CVI_S32 CVI_AO_GetVolume(AUDIO_DEV AoDevId, CVI_S32 *ps32VolumeDb); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
ps32VolumeDb | AudioDeviceVolumeSizePointer. VolumeRangeis[32~0], forshouldgain [0dB ~ -22.5dB], eachonestep1.5dB. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Example
None.
10.3.4.20. CVI_AO_SetMute¶
Description
Set Audio Output DeviceMuteStatus.
Syntax
CVI_S32 CVI_AO_SetMute(AUDIO_DEV AoDevId, CVI_BOOL bEnable, const AUDIO_FADE_S *pstFade); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
bEnable | AudioDeviceWhetherEnableMute. CVI_TRUE: EnableMuteFunction; CVI_FALSE: CloseMuteFunction | Input |
pstFade | Fade-in/fade-out structure pointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Example
None.
10.3.4.21. CVI_AO_GetMute¶
Description
Get Audio Output DeviceMuteStatus.
Syntax
CVI_S32 CVI_AO_GetMute(AUDIO_DEV AoDevId, CVI_BOOL *pbEnable, AUDIO_FADE_S *pstFade); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | Audio device number. The device number is preset to 0. Unless customization requires expansion, setting it above 2 returns an error. | Input |
bEnable | AudioDeviceMuteStatusPointer. | Output |
pstFade | Fade-in/fade-out structure pointer. | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Call this interface after the Audio Output device has been successfully enabled.
Example
None.
10.3.4.22. CVI_AO_SaveFile¶
Description
beforeNot supportedthisFunction, UsercanthroughCVI_AO_SendFramebeforefile saving.
Syntax
CVI_S32 CVI_AO_SaveFile(AUDIO_DEV AoDevId, AO_CHN AoChn, AUDIO_SAVE_FILE_INFO_S* pstSaveFileInfo); Parameters
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Precautions
Example
None.
10.3.4.23. CVI_AO_ClrPubAttr¶
Description
Clear Audio Output Device attributes.
Syntax
CVI_S32 CVI_AO_ClrPubAttr(AUDIO_DEV AoDevId); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AoDevId | AudioDevice number. Device numberPreset to0, Unless customization requires expansion, Setexceeds2, returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h
Library files: libcvi_audio.a
Precautions
Stop the device before clearing device attributes.
Audio Input DeviceandAudio Output DeviceclockNoneneed toSet.
Example
None.
10.3.5. Audio encoding¶
AENCModuleprovidewithunderAPIs:
CVI_AENC_CreateChn: CreateAudioEncoding channel.
CVI_AENC_DestroyChn: DestroyAudioEncoding channel.
CVI_AENC_SendFrame: SendAudio encodingAudioFrame
CVI_AENC_GetStream: GetAudio encodingBitstream.
CVI_AENC_ReleaseStream: ReleaseAudio encodingBitstream.
CVI_AENC_SaveFile: EnableAudio encodingbeforeChannelstorageFileFunction.
CVI_AENC_GetStreamBufInfo: GetAudioBitstream buffer RelatedInformation.
CVI_AENC_SetMute: SetAENCMuteStatus.
CVI_ADEC_GetMute: GetAENCMuteStatus.
10.3.5.1. CVI_AENC_CreateChn¶
Description
CreateAudioEncoding channel.
Syntax
CVI_S32 CVI_AENC_CreateChn(AENC_CHN AeChn, const AENC_CHN_ATTR_S *pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
pstAttr | Encoding channelAttributePointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
beforeSupport G711, G726, ADPCM
SupportInputpcm audio frame, audioFormat(format)Support16 bitsend(S16LE)itsNot supported, UsetimepleasesynchronizationwillAudio Input attribute/AENC attribute performforshouldSet, ifinVQEofafterUse, pleasewillaudio frameLengthsetis160timesnumber, withdescriptorcombinedCvitek VQE.
Audio encodingpartAttributeneed towithInputAudioDataAttributematch, For exampleSample rate, Frame (each FramesamplingpointCount) etc.
buffer SizewithFrameas the unit, Value Rangeis[2, MAX_BUFFERING_DEPTH], It is recommended to Configuration is 10 withon, buffer ConfigurationcancancauseFrameetc.abnormal.
Example
None.
10.3.5.2. CVI_AENC_DestroyChn¶
Description
DestroyAudio encoding.
Syntax
CVI_S32 CVI_AENC_DestroyChn(AENC_CHN AeChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
Channelifnot created, thenCallthisfunctionInvalid.
If currentlyinGet/ReleaseBitstreamoruserSendFrametimeDestroythisChannel, thenwillReturnFailure, Usersynchronizationprocessingtimeneed toNote.
Example
None.
10.3.5.3. CVI_AENC_SendFrame¶
Description
SendAudio encodingAudioFrame.
Syntax
CVI_S32 CVI_AENC_SendFrame(AENC_CHN AeChn, const AUDIO_FRAME_S *pstFrm, const AEC_FRAME_S *pstAecFrm); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
pstFrm | AudioFrameStructurePointer. | Input |
pstAecFrm | Echo CancellationReferenceFrameStructurePointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
Channelifnot created, callthisfunctionInvalid.
If notneed toEcho Cancellation, pstAecFrm cansetis NULL.
thisInterfaceused to UsermainSendAudioFrameperform Encoding, If AENC ChannelalreadythroughSystem BindingInterfacewith Audio Input Bind, notneed toalsonotrecommendthisInterface.
Example
s32Ret = CVI_AI_GetChnParam(AiDev, AiChn, &stAiChnPara); if (s32Ret != CVI_SUCCESS) { printf("%s: Get ai chn param failed\n", __func__); return NULL; } stAiChnPara.u32UsrFrmDepth = 10; s32Ret = CVI_AI_SetChnParam( AiDev, AiChn, &stAiChnPara); if (s32Ret != CVI_SUCCESS) { printf("%s: set ai chn param failed\n", __func__); return NULL; } while ( 1) { /* get frame from ai chn */ memset(&stAecFrm, 0, sizeof(AEC_FRAME_S)); s32Ret = CVI_AI_GetFrame( AiDev, AiChn, &stFrame, &stAecFrm, CVI_FALSE); if (s32Ret != CVI_SUCCESS) { printf("CVI_AI_GetFrame none!!\n"); continue; } /* send frame to encoder */ if ( bSendAenc == CVI_TRUE) { s32Ret = CVI_AENC_SendFrame( AencChn, &stFrame, &stAecFrm); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AENC_SendFrame(%d), failed with %#x!\n", __func__, AencChn, s32Ret); bStart = CVI_FALSE; return NULL; } } /* send frame to ao */ /* If owner toggle bSendAenc, do not toggle bSendAo */ /* You cannot send encode frame to CVI_AO_SendFrame */ /* It cannot play out encode frame by only AO_SendFrame*/ if ( bSendAo == CVI_TRUE) { s32Ret = CVI_AO_SendFrame( AoDev, AoChn, &stFrame, 1000); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AO_SendFrame(%d, %d), failed with %#x!\n", __func__, AoDev, AoChn, s32Ret); bStart = CVI_FALSE; return NULL; } } /* finally you must release the stream */ s32Ret = CVI_AI_ReleaseFrame( AiDev, AiChn, &stFrame, &stAecFrm); if (s32Ret != CVI_SUCCESS) { printf("%s: CVI_AI_ReleaseFrame(%d, %d), failed with %#x!\n", __func__, AiDev, AiChn, s32Ret); bStart = CVI_FALSE; return NULL; } } 10.3.5.4. CVI_AENC_GetStream¶
Description
GetEncodingafterBitstream.
Syntax
CVI_S32 CVI_AENC_GetStream(AENC_CHN AeChn, AUDIO_STREAM_S *pstStream, CVI_S32 s32MilliSec); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
pstStream | GetAudioBitstream. | Output |
s32MilliSec | GetData timeout -1 indicates blocking mode and waits indefinitely when there is no data; 0meansnon-blockingMode, NoneDatatimethenReturn; >0 indicates blocking for s32MilliSec milliseconds; a timeout returns an error. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
mustCreateChannelaftercancanGetBitstream, otherwiseconnectReturnFailure, If inGetBitstreamprocessin ChannelthenwillReturnFailure.
s32MilliSec valuemustgreater thanetc.to-1, etc.to-1 timeusingblockingModeGetData, etc.to 0 time non-blockingModeGetData, greater than 0 time, blocking s32MilliSec millisecondsafter, nothasDatathenReturnTimeoutand.
Example
None.
10.3.5.5. CVI_AENC_ReleaseStream¶
Description
ReleasefromAudioEncoding channelGetBitstream.
Syntax
CVI_S32 CVI_AENC_ReleaseStream(AENC_CHN AeChn, const AUDIO_STREAM_S *pstStream); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
pstStream | GetAudioBitstreamofPointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
BitstreamcanenoughinUsecompleteofafterthat isRelease, If notandtimeRelease, willcauseEncodingprocessblocking.
ReleaseBitstreammustisfromthisChannelGetBitstream, notforBitstreamInformationStructureperform anymodify, otherwisewillcauseBitstreamnotcanRelease, makethisBitstream buffer lost, tocauseprogramabnormal.
ReleaseBitstreamtimemust ensureChannelalreadybeCreate, otherwiseconnectReturnFailure, If inReleaseBitstreamprocess MediumDestroyChannelthenwillReturnFailure.
Example
None.
10.3.5.6. CVI_AENC_SaveFile¶
Description
EnableAudio encodingbeforeChannelstorageFileFunction.
Syntax
CVI_S32 CVI_AENC_SaveFile(AENC_CHN AeChn, const AUDIO_SAVE_FILE_INFO_S *pstSaveFileInfo); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | AudioEncoding channel number. Value Range: [0, AENC_MAX_CHN_NUM]. | Input |
pstSaveFileInfo | Audio save-file attribute structure pointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
Cvitek notthisAPI.
pleaseUse CVI_AI_SaveFile.
Example
None.
10.3.5.7. CVI_AENC_GetStreamBufInfo¶
Description
GetAudioBitstream buffer RelatedInformation.
Syntax
CVI_S32 CVI_AENC_GetStreamBufInfo(AENC_CHN AeChn, CVI_U32 *pu32PhysAddr, CVI_U32 *pu32Size); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | AudioEncoding channel number. Value Range: [0, AENC_MAX_CHN_NUM]. | Input |
pu32PhysAddr | AudioBitstream buffer PhysicalAddress. | Output |
pu32Size | AudioBitstream buffer Length, with byte as the unit | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_aenc.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
None.
Example
None.
10.3.5.8. CVI_AENC_SetMute¶
Description
SetAENCMuteStatus
Syntax
CVI_AENC_SetMute (AENC_CHN AeChn, CVI_BOOL bEnable); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
bEnable | AudioDeviceWhetherEnableMute. CVI_TRUE: EnableMuteFunction; CVI_FALSE: CloseMuteFunction | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_audio.h
Library files: libcvi_audio.a
Precautions
Use only after creating the AENC device signal channel
Example
None.
10.3.5.9. CVI_AENC_GetMute¶
Description
toAENCDeviceMuteStatus
Syntax
CVI_AENC_GetMute(AENC_CHN AeChn, CVI_BOOL *pbEnable); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AeChn | Encoding device channel number. Value range: [0, AENC_MAX_CHN_NUM] | Input |
pbEnable | AudioDeviceaudioStatusPointer | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_audio.h
Library files: libcvi_audio.a
Precautions
Use only after creating the AENC device signal channel
Example
None.
10.3.6. Audio decoding¶
Audio decodingmainimplementCreateDecoding channel, SendAudioBitstreamDecodingandGetDecodingafterAudioFrameetc.Function.
belowSupportAPIanddetailscontent:
CVI_ADEC_CreateChn: CreateAudioDecoding channel.
CVI_ADEC_DestroyChn: DestroyAudioDecoding channel.
CVI_ADEC_SendStream: SendAudioBitstreamtoAudioDecoding channel.
CVI_ADEC_ClearChnBuf: Clear ADEC ChannelincurrentAudioDataregionblock.
CVI_ADEC_GetFrame: GetAudio decodingFrameData.
CVI_ADEC_ReleaseFrame: ReleaseAudio decodingFrameData.
CVI_ADEC_SendEndOfStream: Send the end marker to the decoder and clear the bitstream buffer.
10.3.6.1. CVI_ADEC_CreateChn¶
Description
CreateAudioDecoding channel.
Syntax
CVI_S32 CVI_ADEC_CreateChn(ADEC_CHN AdChn, const ADEC_CHN_ATTR_S *pstAttr); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | Channel number. Value Range: [0, ADEC_MAX_CHN_NUM]. | Input |
pstAttr | Channel attributesPointer. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
beforeSupport G711, G726, ADPCM.
Audio decodingpartAttributeneed towithOutputDevice attributesmatch, For exampleSample rate, Frame (eachFramesampling pointCount) etc.
Example
None.
10.3.6.2. CVI_ADEC_DestroyChn¶
Description
DestroyAudioDecoding channel.
Syntax
CVI_S32 CVI_ADEC_DestroyChn(ADEC_CHN AdChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | Channel number. Value Range: [0, ADEC_MAX_CHN_NUM]. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
Channelnot createdcaseunderCallthisInterfacewillReturnSuccess.
If currentlyinGet/ReleaseBitstreamoruserSendFrame, DestroythisChannelthentheseoperationwillthat isReturnFailure.
Example
None.
10.3.6.3. CVI_ADEC_SendStream¶
Description
toAudioDecoding channelSendBitstream.
Syntax
CVI_S32 CVI_ADEC_SendStream(ADEC_CHN AdChn, const AUDIO_STREAM_S *pstStream, CVI_BOOL bBlock); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | Channel number. Value Range: [0, ADEC_MAX_CHN_NUM]. | Input |
pstStream | AudioBitstream | Input |
bBlock | CVI_TRUE: blocking. CVI_FALSE: non-blocking. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
stream Methodused to notdetermineBitstreampacketisoneFrame(greater thanetc.tooneFrame)caseunder, effectivelow, andcancanwillhasdelay
SendDatatimemust ensureChannelalreadybeCreate, otherwiseconnectReturnFailure, If insendDataprocessin DestroyChannelthenwillReturnFailure.
ensureSendgive ADEC ChannelBitstreamDatacorrectness, otherwisecancanDecodingdeviceabnormalexit.
Example
None.
10.3.6.4. CVI_ADEC_ClearChnBuf¶
Description
Clear ADEC ChannelincurrentAudioDataregionblock.
Syntax
CVI_S32 CVI_ADEC_ClearChnBuf(ADEC_CHN AdChn); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | Channel number. Value Range: [0, ADEC_MAX_CHN_NUM]. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
requireDecoding channelalreadybeCreate.
UsethisInterfacetime, notrecommendUse stream MethodDecoding. Use stream MethodDecodingperform Clearregionblocktime, Userneed toensureClearcompleteregionblockafter, SendgiveDecodingdeviceDatamustiscompleteoneFrameBitstream, otherwisecancancauseDecodingdevicenotcannormalOperation.
NoneWhetherUse streamMethodDecoding, ensuresendDataDecodingoperationandClearregionblockoperationbetweensynchronization.
Example
None.
10.3.6.5. CVI_ADEC_GetFrame¶
Description
Getdecodingafteraudio frame.
Syntax
CVI_S32 CVI_ADEC_GetFrame(ADEC_CHN AdChn, AUDIO_FRAME_INFO_S *pstFrmInfo, CVI_BOOL bBlock); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | AudioDecoding channel. | Input |
pstFrmInfo | AudioFrameDataStructure. | Output |
bBlock | WhetherwithblockingMethodGet. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
mustin ADEC Channelafter creationCall
UsethisInterfaceGetDecodingFrameDatatime, It is recommended to SendBitstreamtimepressFrameSend
UsethisInterfaceGetAudioDatatime, pleaserelease ADEC with Audio Output Binding Relationships, otherwiseGettoFrame isnotcontinuous.
UsethisInterfaceGetAudioFrameDatatime, If SendBitstreampressstreamSend, pleaseGetDecodingFrame Dataandtimeness, otherwisewillhasabnormal.
Example
None.
10.3.6.6. CVI_ADEC_ReleaseFrame¶
Description
ReleaseGettoAudio decodingFrameData.
Syntax
CVI_S32 CVI_ADEC_ReleaseFrame(ADEC_CHN AdChn, AUDIO_FRAME_INFO_S *pstFrmInfo); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | AudioDecoding channel. | Input |
pstFrmInfo | AudioFrameDataStructure. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
thisInterfacemustwithInterface CVI_ADEC_GetFrame work withUse.
mustin ADEC Channelafter creationCall.
Example
None.
10.3.6.7. CVI_ADEC_SendEndOfStream¶
Description
Send the end marker to the decoder and clear the bitstream buffer.
Syntax
CVI_S32 CVI_ADEC_SendEndOfStream (ADEC_CHN AdChn, CVI_BOOL bInstant); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
AdChn | AudioDecoding channel. | Input |
bInstant | Whetherthat isClearDecodingdeviceinternalregionblockData. Value Range: CVI_FALSE: timeClear. notwillthat isClearDecodingdeviceinternalcacheData, Decodingwillperform, toremainingbuffer notoneFrameDatatimeperform Clearoperation. CVI_TRUE: that isClearDecodingdeviceinternalregionblockData. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_comm_adec.h
Library files: libcvi_audio.a, libcvi_VoiceEngine.so, libcvi_RES1.so
Precautions
None.
Example
None.
10.3.7. resampling¶
Resampler Moduleprovidesingleresamplingprocessing. When customerneed toinonlayerforDataresamplingtime, canUsethisModule.
withunderisRelatedAPIanddetailsDescription:
CVI_Resampler_Create: Create a resamplingModule.
CVI_Resampler_Process: resamplingModuleDataprocessing.
CVI_Resampler_Destroy: DestroyresamplingModule.
CVI_Resampler_GetMaxOutputNum: calculateresamplingMaximumOutputData.
10.3.7.1. CVI_Resampler_Create¶
Description
Create a resamplingModule.
Syntax
CVI_VOID* CVI_Resampler_Create(CVI_S32 s32Inrate, CVI_S32 s32Outrate, CVI_S32 s32Chans); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
s32Inrate | InputSample rate. Value Range: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000. | Input |
s32Outrate | OutputSample rate. Value Range: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000. | Input |
s32Chans | processingAudio Channelnumber(beforeCvitekSupportsingleAudio Channel) | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_resample_api.h
Library files: libcvi_audio.a, libcvi_RES1.so
Precautions
InputSample rateandOutputSample rateneed tonotonecause.
Example
None.
10.3.7.2. CVI_Resampler_Process¶
Description
processingoneFrameresamplingData.
Syntax
CVI_S32 CVI_Resampler_Process(CVI_VOID* inst, CVI_S16* s16Inbuf, CVI_S32 s32Insamps, CVI_S16* s16Outbuf); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
inst | resamplingModulehandle. | Input |
s16Inbuf | InputData buf Pointer. | Input |
s32Insamps | InputDatasamplingpointnumber. Value Range: [0, 2048] | Input |
s16Outbuf | OutputData buf Pointer | Output |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_resample_api.h
Library files: libcvi_audio.a, libcvi_RES1.so
Precautions
MaximumInputsamplingpointnumberneed toless than 2048.
Example
None.
10.3.7.3. CVI_Resampler_Destroy¶
Description
Destroy a resamplingModuleexample.
Syntax
CVI_VOID CVI_Resampler_Destroy(CVI_VOID* inst); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
inst | resamplingModulehandle. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_resample_api.h
Library files: libcvi_audio.a, libcvi_RES1.so
Precautions
None.
Example
None.
10.3.7.4. CVI_Resampler_GetMaxOutputNum¶
Description
GetMaximumOutputsamplingpointnumber (eachoneAudio Channel).
Syntax
CVI_S32 CVI_Resampler_GetMaxOutputNum(CVI_VOID* inst, CVI_S32 s32Insamps); Parameters
Parameter Name | Description | Input/Output |
|---|---|---|
inst | resamplingModulehandle. | Input |
s32Insamps | eachoneAudio ChannelInputsamplingpointnumber. | Input |
Return Value
Parameter Name | Description |
|---|---|
0 | Success. |
Non-zero | Failure; its value is Error Codes. |
Requirements
Header files: cvi_comm_aio.h, cvi_audio.h, cvi_resample_api.h
Library files: libcvi_audio.a, libcvi_RES1.so
Precautions
None.
Example
None.