Developer World
Spresense SDK Library v3.2.0-ebc0364
Playlist Class Reference

Public Types

enum  PlayMode { PlayModeNormal = 0 , PlayModeShuffle , NumOfPlayMode }
 
enum  RepeatMode { RepeatModeOff = 0 , RepeatModeOn , NumOfRepeatMode }
 
enum  ListType {
  ListTypeAllTrack = 0 , ListTypeArtist , ListTypeAlbum , ListTypeUser ,
  NumOfListType
}
 

Public Member Functions

 Playlist (FAR const char *file_name)
 Playlist Constructor. More...
 
 ~Playlist ()
 Playlist Destructor.
 
bool init (const char *playlist_path)
 Init playlist. More...
 
bool setPlayMode (PlayMode play_mode)
 Set play mode. More...
 
bool setRepeatMode (RepeatMode repeat_mode)
 Set repeat mode. More...
 
bool select (ListType type, FAR const char *key_str)
 Select playlist to play. More...
 
bool updatePlaylist (ListType type, FAR const char *key_str)
 Update playlist. More...
 
bool addTrack (FAR const char *key_str, int track_no)
 Add track to playlist. More...
 
bool removeTrack (FAR const char *key_str, uint32_t remove_pos)
 Remove track from playlist. More...
 
bool updateTrackDb (const char *audiofile_root_path)
 Update track database. More...
 
bool deleteAll (void)
 Delete all playlist. More...
 
bool deleteOne (ListType type, FAR const char *key_str)
 Delete playlist. More...
 
bool getNextTrack (FAR Track *track)
 Get next track. More...
 
bool getPrevTrack (FAR Track *track)
 Get previous track. More...
 
bool restart (void)
 Restart playlist. More...
 

Member Enumeration Documentation

◆ PlayMode

enum PlayMode
Enumerator
PlayModeNormal 

Normal play mode.

PlayModeShuffle 

Shuffle play mode.

◆ RepeatMode

enum RepeatMode
Enumerator
RepeatModeOff 

Play all track at once.

RepeatModeOn 

Play all track repeat.

◆ ListType

enum ListType
Enumerator
ListTypeAllTrack 

All track (which is written in playlist file) list.

ListTypeArtist 

Artist categorized track list.

ListTypeAlbum 

Album categorized track list.

ListTypeUser 

User defined track list.

Constructor & Destructor Documentation

◆ Playlist()

Playlist ( FAR const char *  file_name)
inline

Playlist Constructor.

Parameters
[in]file_namePlaylist file name.

Member Function Documentation

◆ init()

bool init ( const char *  playlist_path)

Init playlist.

Parameters
[in]playlist_pathPath to playlist file
Return values
true: success
false: failure

◆ setPlayMode()

bool setPlayMode ( PlayMode  play_mode)

Set play mode.

Parameters
[in]play_modePlayModeNormal, PlayModeShuffle
Return values
true: success
false: failure

◆ setRepeatMode()

bool setRepeatMode ( RepeatMode  repeat_mode)

Set repeat mode.

Parameters
[in]repeat_modeRepeatModeOff, RepeatModeOn
Return values
true: success
false: failure

◆ select()

bool select ( ListType  type,
FAR const char *  key_str 
)

Select playlist to play.

Note
If type is ListTypeAllTrack, key_str is not cared.
Parameters
[in]typeListTypeAllTrack, ListTypeArtist, ListTypeAlbum, ListTypeUser
[in]key_strKey string to select playlist. Author name, album name, etc...
Return values
true: success
false: failure

◆ updatePlaylist()

bool updatePlaylist ( ListType  type,
FAR const char *  key_str 
)

Update playlist.

Create or update playlist. Target playlist should be selected by parameters.

Note
If type is ListTypeAllTrack, key_str is not cared.
Parameters
[in]typeListTypeAllTrack, ListTypeArtist, ListTypeAlbum, ListTypeUser
[in]key_strKey string to filter playlist. Author name, album name, etc...
Return values
true: success
false: failure

◆ addTrack()

bool addTrack ( FAR const char *  key_str,
int  track_no 
)

Add track to playlist.

Note
Target playlist is always user defined playlist(ListTypeUser).
Parameters
[in]key_strKey string to filter playlist. Author name, album name, etc...
[in]track_noTrack number of which would like to add to playlist.
Return values
true: success
false: failure

◆ removeTrack()

bool removeTrack ( FAR const char *  key_str,
uint32_t  remove_pos 
)

Remove track from playlist.

Note
Target playlist is always user defined playlist(ListTypeUser).
Parameters
[in]key_strKey string to filter playlist. Author name, album name, etc...
[in]remove_posTrack number of which would like to remove from playlist.
Return values
true: success
false: failure

◆ updateTrackDb()

bool updateTrackDb ( const char *  audiofile_root_path)

Update track database.

Create or update all track playlist by tracks in path/to/.

Parameters
[in]audiofile_root_pathPath to audio data file.
Return values
true: success
false: failure

◆ deleteAll()

bool deleteAll ( void  )

Delete all playlist.

Note
Delete playlist which is created internally. track database(***.csv) will not be deleted.
Return values
true: success
false: failure

◆ deleteOne()

bool deleteOne ( ListType  type,
FAR const char *  key_str 
)

Delete playlist.

Parameters
[in]typeListTypeAllTrack, ListTypeArtist, ListTypeAlbum, ListTypeUser
[in]key_strKey string to filter playlist. Author name, album name, etc...
Return values
true: success
false: failure

◆ getNextTrack()

bool getNextTrack ( FAR Track track)

Get next track.

Get next track in playlist which is selected by select().

Parameters
[out]trackTrack information
Return values
true: success
false: failure

◆ getPrevTrack()

bool getPrevTrack ( FAR Track track)

Get previous track.

Get previous track in playlist which is selected by select().

Parameters
[out]trackTrack information
Return values
true: success
false: failure

◆ restart()

bool restart ( void  )

Restart playlist.

Restart from top of playlist.

Return values
true: success
false: failure

The documentation for this class was generated from the following file: