1.1.1.4.13 DRV_AK4953_VolumeSet Function

void DRV_AK4953_VolumeSet(DRV_HANDLE handle, DRV_AK4953_CHANNEL channel, uint8_t volume);

Summary

This function sets the volume for AK4953 Codec.

Description

This functions sets the volume value from 0-255.

The codec has DAC value to volume range mapping as :- 00 H : +12dB FF H : -115dB

In order to make the volume value to dB mapping monotonically increasing from 00 to FF, re-mapping is introduced which reverses the volume value to dB mapping as well as normalizes the volume range to a more audible dB range.

The current driver implementation assumes that all dB values under -60 dB are inaudible to the human ear.

Re-Mapped values 00 H : -60 dB FF H : +12 dB

Preconditions

The DRV_AK4953_Initialize routine must have been called for the specified AK4953 driver instance.

DRV_AK4953_Open must have been called to obtain a valid opened device handle.

Parameters

ParametersDescription
handleA valid open-instance handle, returned from the driver's open routine
chanAudio channel volume to be set
volumevolume value specified in the range 0-255 (0x00 to 0xFF)

Returns

None.

Remarks

None.

Example

_\/\/ myAppObj is an application specific object._

MY_APP_OBJ myAppObj;

uint8_t mybuffer[MY_BUFFER_SIZE]; DRV_BUFFER_HANDLE bufferHandle;

_\/\/ myAK4953Handle is the handle returned \/\/ by the DRV_AK4953_Open function._

DRV_AK4953_VolumeSet(myAK4953Handle, DRV_AK4953_CHANNEL_LEFT, 120);

C

void DRV_AK4953_VolumeSet(DRV_HANDLE handle, DRV_AK4953_CHANNEL channel, uint8_t volume);