网站建设优化哪家公司好,关于百度网站的优缺点,搭建wordpress博客终端,中国核工业华兴建设有限公司网站1 音乐播放控制
1.1 播放列表更新
文件系统在sd卡中保存header.bin及name.bin两份文件用于歌曲名称的存储。为方便应用层进行歌曲显示及列表管理#xff0c;可将这两个bin文件信息读取并保存到nor flash中。需要播放指定名称的歌曲时#xff0c;将对于歌曲名称传递给文件系…1 音乐播放控制
1.1 播放列表更新
文件系统在sd卡中保存header.bin及name.bin两份文件用于歌曲名称的存储。为方便应用层进行歌曲显示及列表管理可将这两个bin文件信息读取并保存到nor flash中。需要播放指定名称的歌曲时将对于歌曲名称传递给文件系统接口可直接完成歌曲的播放。 uint32_t audio_fs_get_header_list_size(void); uint32_t audio_fs_get_name_list_size(void); uint16_t audio_fs_read_header_list(uint32_t offset, uint8_t *readBuf, uint32_t readLen, uint32_t *len); uint16_t audio_fs_read_name_list(uint32_t offset, uint8_t *readBuf, uint32_t readLen, uint32_t *len); offset文件偏移地址readBuf读取数据bufferreadLen期望读取长度len实际读取长度
header.bin描述歌曲总数及各个歌曲名称在name.bin中的偏移及长度信息。header.bin格式如下。 Count Reserved Song info1 Song info2 …… 2bytes 4bytes Sizeof(T_SONG_NAME_INFO) Sizeof(T_SONG_NAME_INFO) typedef struct { uint32_t offset; //Start offset of the song name uint16_t length; //Length of the song name uint16_t plIndex; /*Play List Index, indicate which playlist the song belongs to. uint8_t isDeleted : 1; /* flag of if song is deleted.1: deleted,0: not deleted */ uint8_t needToUnlink : 1; /* flag of if song need to unlink. */ uint8_t extension : 6; uint16_t rsv; /* Reserve for future usage, should set to 0 */ } __attribute__((packed)) T_SONG_NAME_INFO; name.bin保存各个歌曲的名称信息结合song info中提供的offset和length部分可以提取到各个歌曲的名称。 Song name 1 Song name 2 …… Name data(Unicode) Name data(Unicode)
1.2音乐播放控制 T_APP_AUDIO_FS_ERROR app_audio_fs_interface_play_by_name(uint8_t *file_name, uint16_t length) void app_mmi_handle_action(uint8_t action) case IO_MSG_MMI: { uint8_t action p_watch_msg-u.param; app_mmi_handle_action(action); } break; case IO_MSG_PLAY_BY_NAME: { if (app_db.usb_status USB_PLUG_OUT) { T_SONG_NAME_INFO *play_name (T_SONG_NAME_INFO *)p_watch_msg-u.param; app_audio_fs_interface_play_by_name((uint8_t *)(MUSIC_NAME_BIN_ADDR play_name-offset), play_name-length); } else { APP_PRINT_INFO0(ERROR: USB plug in, disallow play media now!); } } break; 音频控制包括播放、暂停、音量调节等可通过MMIMan Machine Interface和app_audio_fs_interface_play_by_name完成。播放列表的维护由上层进行切换歌曲时上层只需要控制传入歌曲的名称信息即可。MMI命令所定义的action可参考T_MMI_ACTION已实现的功能参考void app_mmi_handle_action(uint8_t action)。
本地播放模式与耳机播放模式下上层共用MMI命令底下会做区分。不同模式之间的切换也可通过MMI命令完成。