1. MTK铃声修改
1.1 铃声简介
MTK支持的铃声还是比较多的,常见的MP3,WAV,MID等等都支持。同时MTK既支持数组存储的铃声,也支持资源类型的铃声。不过习惯上我们一般都使用数组类型的铃声。所谓数组类型的铃声,就是把铃声数据按字节顺序存储在数组中,标明铃声的类型和长度,供播放函数使用。
1.2 铃声的格式(Audio_Converter.cpp)
#define FORMAT_IMY "18" /* sync with med_main.h */
#define FORMAT_MID "17" /* sync with med_main.h */
#define FORMAT_WAV "13" /* sync with med_main.h */
#define FORMAT_MMF "20" /* sync with med_main.h */
#define FORMAT_MP3 "5" /* sync with med_main.h */
#define FORMAT_PCM "7" /* sync with med_main.h */
#define FORMAT_DVI "11" /* sync with med_main.h */
#define FORMAT_AMR "3" /* sync with med_main.h */
#define FORMAT_AAC "6" /* sync with med_main.h */
#define FORMAT_WMA "24" /* sync with med_main.h */
#define FORMAT_M4A "25" /* sync with med_main.h */
1.3 铃声示例(resource_audio.c)
来电铃声:
const audio_resource_struct mtk_resource_imelodys[]={
{s1imy01_imy, sizeof(s1imy01_imy), 18},
{s1imy02_imy, sizeof(s1imy02_imy), 18},
{s1imy03_imy, sizeof(s1imy03_imy), 18},
{s1imy04_imy, sizeof(s1imy04_imy), 18},
{s1imy05_imy, sizeof(s1imy05_imy), 18},
{s1imy06_imy, sizeof(s1imy06_imy), 18},
{s1imy07_imy, sizeof(s1imy07_imy), 18},
{s1imy08_imy, sizeof(s1imy08_imy), 18},
{s1imy09_imy, sizeof(s1imy09_imy), 18},
{s1imy10_imy, sizeof(s1imy10_imy), 18},
};
注:18对应的是音乐格式
开关机音调:
const audio_resource_struct mtk_resource_sounds[]={
{cs_iphonemessage1_mp3, sizeof(cs_iphonemessage1_mp3), 5},
{cs_iphonemessage2_mp3, sizeof(cs_iphonemessage2_mp3), 5},
{cs_iphonemessage3_mp3, sizeof(cs_iphonemessage3_mp3), 5},
{cs_iphonemessage4_mp3, sizeof(cs_iphonemessage4_mp3), 5},
{cs_iphonelock_mp3, sizeof(cs_iphonelock_mp3), 5},
{cs01_shutter, sizeof(cs01_shutter), 5},
{cs01_usb_beep_mp3, sizeof(cs01_usb_beep_mp3), 5},
};
注:5对应的是音乐格式
短信音调:
const audio_resource_struct mtk_resource_message_sounds[]={
{cs_iphonemessage1_mp3, sizeof(cs_iphonemessage1_mp3), 5},
{cs_iphonemessage2_mp3, sizeof(cs_iphonemessage2_mp3), 5},
{cs_iphonemessage3_mp3, sizeof(cs_iphonemessage3_mp3), 5},
{cs_iphonemessage4_mp3, sizeof(cs_iphonemessage4_mp3), 5},
{cs_iphonemessage5_mp3, sizeof(cs_iphonemessage5_mp3), 5},
{cs_iphonemessage6_mp3, sizeof(cs_iphonemessage6_mp3), 5},
};
注:5对应的是音乐格式
Custpack_audio.c
来电和弦铃声:
const custpack_audio_header custpack_audio =
{
6,
{{iphone_marimba_mp3, sizeof(iphone_marimba_mp3), 5},
{iphone_duck_mp3, sizeof(iphone_duck_mp3), 5},
{iphone_crickets_mp3, sizeof(iphone_crickets_mp3), 5},
{iphone_harp_mp3, sizeof(iphone_harp_mp3), 5},
{iphone_motorcycle_mp3, sizeof(iphone_motorcycle_mp3), 5},
{iphone_xylophone_mp3, sizeof(iphone_xylophone_mp3), 5}
}
};
注:6对应的是和弦个数,5对应的是音乐格式
客户自定义按键音需打开宏:CUST_KEYPAD_TONE_SUPPORT
mtk_resource_keypad_tones[]
1.4 铃声使用
像添加图片一样,在Customer里创一个文件夹,放入铃声,然后像添加图片一样添加一个ID,并在模块对应的RES文件里绑定把ID和路径绑定。可以使用mdi_audio_play_id播放,或者使用get_audio获得数据,然后调用mdi_audio_snd_play_string_with_vol_path播放