Developer World
Spresense SDK Library v3.3.0-375c679
Audio Player API
Collaboration diagram for Audio Player API:

Files

file  audio_player_api.h
 CXD5602 Audio Player API.
 

Classes

struct  AsPlayerInputDeviceHdlrForRAM
 
struct  AsActivatePlayerParam
 
struct  AsActivatePlayer
 
struct  SetPlayerStsParam
 
struct  AsDeactivatePlayer
 
struct  AsInitPlayerParam
 
union  AsPcmDataDest
 
struct  AsPlayPlayerParam
 
struct  AsStopPlayerParam
 
struct  AsSetGainParam
 
struct  AsRequestNextParam
 
struct  PlayerCommand
 
struct  AsPlayerMsgQueId_t
 
struct  AsPlayerPoolId_t
 
struct  AsPlayerPoolId_old_t
 
struct  AsCreatePlayerParam_t
 
struct  AsCreatePlayerParams_t
 

Typedefs

typedef void(* AudioSimpleFifoReadDoneCallbackFunction) (uint32_t size)
 
typedef bool(* MediaPlayerCallback) (AsPlayerEvent evtype, uint32_t result, uint32_t sub_result)
 
typedef void(* DecodeDoneCallback) (AsPcmDataParam param)
 

Enumerations

enum  AsPlayerEvent {
  AsPlayerEventAct = 0 , AsPlayerEventInit , AsPlayerEventPlay , AsPlayerEventStop ,
  AsPlayerEventDeact , AsPlayerEventSetGain
}
 
enum  AsPlayerId { AS_PLAYER_ID_0 = 0 , AS_PLAYER_ID_1 , AS_PLAYER_ID_NUM }
 
enum  AsSetActivatePlayer { AS_ACTPLAYER_MAIN = 1 , AS_ACTPLAYER_SUB , AS_ACTPLAYER_BOTH , AS_ACTPLAYER_NUM }
 
enum  AsSetPlayerInputDevice {
  AS_SETPLAYER_INPUTDEVICE_EMMC = 0 , AS_SETPLAYER_INPUTDEVICE_A2DPFIFO , AS_SETPLAYER_INPUTDEVICE_I2SINPUT , AS_SETPLAYER_INPUTDEVICE_RAM ,
  AS_SETPLAYER_INPUTDEVICE_NUM
}
 
enum  AsSetPlayerOutputDevice { AS_SETPLAYER_OUTPUTDEVICE_SPHP = 0 , AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT , AS_SETPLAYER_OUTPUTDEVICE_A2DPFIFO , AS_SETPLAYER_OUTPUTDEVICE_NUM }
 
enum  AsStopPlayerStopMode { AS_STOPPLAYER_NORMAL = 0 , AS_STOPPLAYER_ESEND , AS_STOPPLAYER_FORCIBLY = 0xFF }
 
enum  AsPcmDataPath { AsPcmDataReply = 0 , AsPcmDataTunnel }
 
enum  AsRequestNextType { AsNextNormalRequest = 0 , AsNextStopResRequest }
 

Functions

bool AS_CreatePlayer (AsPlayerId id, FAR AsCreatePlayerParam_t *param)
 Create audio main player. More...
 
bool AS_CreatePlayerMulti (AsPlayerId id, FAR AsCreatePlayerParam_t *param, AudioAttentionCb attcb)
 Create audio main player using memory pool in work area of src. More...
 
bool AS_CreatePlayerMulti (AsPlayerId id, FAR AsCreatePlayerParams_t *param, AudioAttentionCb attcb)
 
 __attribute__ ((deprecated("\n \ \n Deprecated create API is used. \ \n Use \"AS_CreatePlayerMulti(AsPlayerId, \ \n AsCreatePlayerParam_t *, \ \n AudioAttentionCb)\". \ \n \ \n"))) bool AS_CreatePlayerMulti(AsPlayerId id
 
bool AS_CreatePlayerMulti (AsPlayerId id, FAR AsCreatePlayerParams_t *param)
 
bool AS_ActivatePlayer (AsPlayerId id, FAR AsActivatePlayer *actparam)
 Activate audio (sub)player. More...
 
bool AS_InitPlayer (AsPlayerId id, FAR AsInitPlayerParam *initparam)
 Initialize audio (sub)player. More...
 
bool AS_PlayPlayer (AsPlayerId id, FAR AsPlayPlayerParam *playparam)
 Play audio (sub)player. More...
 
bool AS_StopPlayer (AsPlayerId id, FAR AsStopPlayerParam *stopparam)
 Stop audio (sub)player. More...
 
bool AS_SetPlayerGain (AsPlayerId id, FAR AsSetGainParam *gainparam)
 Set audio gain level of (sub)player. More...
 
bool AS_RequestNextPlayerProcess (AsPlayerId id, FAR AsRequestNextParam *nextparam)
 Request next process(decode) to (sub)player. More...
 
bool AS_DeactivatePlayer (AsPlayerId id, FAR AsDeactivatePlayer *deactparam)
 Deactivate (sub)player. More...
 
bool AS_DeletePlayer (AsPlayerId id)
 Deactivate audio main player. More...
 
bool AS_checkAvailabilityMediaPlayer (AsPlayerId id)
 Check availability of MediaPlayer. More...
 

Variables

FAR AsCreatePlayerParam_tparam
 

Packet length of player command

#define LENGTH_INIT_PLAYER   (9)
 InitPlayer command (AUDCMD_INITPLAYER) packet length.
 
#define LENGTH_INIT_SUBPLAYER   (LENGTH_INIT_PLAYER)
 InitSubPlayer command (#AUDCMD_INITSUBPLAYER) packet length.
 
#define LENGTH_PLAY_PLAYER   (2)
 PlayPlayer command (AUDCMD_PLAYPLAYER) packet length.
 
#define LENGTH_PLAY_SUBPLAYER   (LENGTH_PLAY_PLAYER)
 PlaySubPlayer command (#AUDCMD_PLAYSUBPLAYER) packet length.
 
#define LENGTH_STOP_PLAYER   (2)
 StopPlayer command (AUDCMD_STOPPLAYER) packet length.
 
#define LENGTH_STOP_SUBPLAYER   (LENGTH_STOP_PLAYER)
 StopSubPlayer command (#AUDCMD_STOPSUBPLAYER) packet length.
 
#define LENGTH_CLK_RECOVERY   (2)
 ClkRecovery command ("AUDCMD_CLKRECOVERY)packet length.
 
#define LENGTH_SET_GAIN   (2)
 Set audio gain leve command ("AUDCMD_SETGAIN)packet length.
 
#define LENGTH_SENDPOSTCMD   (10)
 Send Pfcommand command ("AUDCMD_SENDPOSTCMD") packet length.
 

Detailed Description

Typedef Documentation

◆ AudioSimpleFifoReadDoneCallbackFunction

typedef void(* AudioSimpleFifoReadDoneCallbackFunction) (uint32_t size)

SimpliFifo Callback function

Parameters
[in]size: Set read size after reading the SimpleFifo

◆ DecodeDoneCallback

typedef void(* DecodeDoneCallback) (AsPcmDataParam param)

InitPlayer Command (AUDCMD_INITPLAYER, AUDCMD_INITSUBPLAYER) parameter

Enumeration Type Documentation

◆ AsPlayerEvent

Event type of player

Enumerator
AsPlayerEventAct 

Activate.

AsPlayerEventInit 

Init.

AsPlayerEventPlay 

Play.

AsPlayerEventStop 

Stop.

AsPlayerEventDeact 

Deactivate.

AsPlayerEventSetGain 

Set gain.

◆ AsPlayerId

enum AsPlayerId

player id

◆ AsSetActivatePlayer

Select activate player

Enumerator
AS_ACTPLAYER_MAIN 

Activate main player.

AS_ACTPLAYER_SUB 

Activate sub player.

AS_ACTPLAYER_BOTH 

Activate main & sub player.

◆ AsSetPlayerInputDevice

Select Player Input device

Enumerator
AS_SETPLAYER_INPUTDEVICE_EMMC 

eMMC FileSystem

Deprecated:
It will be removed in the future
AS_SETPLAYER_INPUTDEVICE_A2DPFIFO 

A2DP Media Packet FIFO.

Deprecated:
It will be removed in the future
AS_SETPLAYER_INPUTDEVICE_I2SINPUT 

I2S input.

Deprecated:
It will be removed in the future
AS_SETPLAYER_INPUTDEVICE_RAM 

RAM.

◆ AsSetPlayerOutputDevice

Select Player Output device

Enumerator
AS_SETPLAYER_OUTPUTDEVICE_SPHP 

CXD5247 SP/HP.

AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT 

I2S Output.

AS_SETPLAYER_OUTPUTDEVICE_A2DPFIFO 

A2DP Media Packet FIFO.

Deprecated:
It will be removed in the future

◆ AsStopPlayerStopMode

Select stop mode

Enumerator
AS_STOPPLAYER_NORMAL 

Normal stop (immediately stop)

AS_STOPPLAYER_ESEND 

Wait end of es.

AS_STOPPLAYER_FORCIBLY 

Forcibly stop at system failure.

◆ AsPcmDataPath

Enumerator
AsPcmDataReply 

Decodec PCM data will be replied by callback.

AsPcmDataTunnel 

Decodec PCM data will be sent automatically.

Function Documentation

◆ AS_CreatePlayer()

bool AS_CreatePlayer ( AsPlayerId  id,
FAR AsCreatePlayerParam_t param 
)

Create audio main player.

Parameters
[in]paramParameters of resources used by audio main player
Return values
true: success
false: failure
Deprecated:
Use AS_CreatePlayerMulti() instead.

◆ AS_CreatePlayerMulti()

bool AS_CreatePlayerMulti ( AsPlayerId  id,
FAR AsCreatePlayerParam_t param,
AudioAttentionCb  attcb 
)

Create audio main player using memory pool in work area of src.

Parameters
[in]paramParameters of resources used by audio main player
[in]attcbAttention callback of Player. NULL means no callback.
Return values
true: success
false: failure
Note
New create interface. The use size of the heap area is small.

◆ AS_ActivatePlayer()

bool AS_ActivatePlayer ( AsPlayerId  id,
FAR AsActivatePlayer actparam 
)

Activate audio (sub)player.

Parameters
[in]actparamParameters for activation
Return values
true: success
false: failure

◆ AS_InitPlayer()

bool AS_InitPlayer ( AsPlayerId  id,
FAR AsInitPlayerParam initparam 
)

Initialize audio (sub)player.

Parameters
[in]initparamParameters for init player setting
Return values
true: success
false: failure

◆ AS_PlayPlayer()

bool AS_PlayPlayer ( AsPlayerId  id,
FAR AsPlayPlayerParam playparam 
)

Play audio (sub)player.

Parameters
[in]playparamParameters for play player
Return values
true: success
false: failure

◆ AS_StopPlayer()

bool AS_StopPlayer ( AsPlayerId  id,
FAR AsStopPlayerParam stopparam 
)

Stop audio (sub)player.

Parameters
[in]stopparamParameters for stop player
Return values
true: success
false: failure

◆ AS_SetPlayerGain()

bool AS_SetPlayerGain ( AsPlayerId  id,
FAR AsSetGainParam gainparam 
)

Set audio gain level of (sub)player.

Parameters
[in]gainparamGain setting parameters
Return values
true: success
false: failure

◆ AS_RequestNextPlayerProcess()

bool AS_RequestNextPlayerProcess ( AsPlayerId  id,
FAR AsRequestNextParam nextparam 
)

Request next process(decode) to (sub)player.

Parameters
[in]nextparamparameters for next processing
Return values
true: success
false: failure

◆ AS_DeactivatePlayer()

bool AS_DeactivatePlayer ( AsPlayerId  id,
FAR AsDeactivatePlayer deactparam 
)

Deactivate (sub)player.

Parameters
[in]deactparamDeactivation parameters
Return values
true: success
false: failure

◆ AS_DeletePlayer()

bool AS_DeletePlayer ( AsPlayerId  id)

Deactivate audio main player.

Return values
true: success
false: failure

◆ AS_checkAvailabilityMediaPlayer()

bool AS_checkAvailabilityMediaPlayer ( AsPlayerId  id)

Check availability of MediaPlayer.

Return values
true: avaliable
false: Not available