MT2503D开关机铃声

铃声播放位置

开关机铃声都在开关机动画函数中播放,其中:

  • 1、开机铃声播放位于mcu\plutommi\mmi\Bootup\BootupSrc\BootupAnimation.cmmi_bootup_play_animation函数中;
  • 2、关机铃声播放位于mcu\plutommi\mmi\Shutdown\ShutdownSrc\ShutdownAni.cmmi_shutdown_play_animation函数中;
    这两个函数都先调用srv_prof_get_current_profile_value获取铃声资源,再调用mmi_ani_show显示动画并播放铃声。真正播放是在mmi_ani_entry_animation中使用srv_prof_play_tone播放。

获取铃声资源和播放铃声都用了 __MMI_POWER_ON_OFF_MUTE__ 进行开关配置,而__MMI_POWER_ON_OFF_MUTE__的定义由CFG_MMI_POWER_ON_OFF_MUTE进行开关

#if defined(CFG_MMI_POWER_ON_OFF_MUTE) && ((CFG_MMI_POWER_ON_OFF_MUTE == __ON__)||(CFG_MMI_POWER_ON_OFF_MUTE == __AUTO__))
    #ifndef __MMI_POWER_ON_OFF_MUTE__
    #define __MMI_POWER_ON_OFF_MUTE__
    #endif
#endif

CFG_MMI_POWER_ON_OFF_MUTE在多个文件中都有定义,我的工程是在mcu\plutommi\Customer\CustResource\ULTRA2503D_11C_MMI\MMI_features_switchULTRA2503D_11C.h中定义,将值改为__ON__关闭开关机铃声,为__OFF__打开开关机铃声。如果只想要开机铃声或关机铃声,那只能屏蔽代码了。

更换铃声文件
  • 1、在mcu\plutommi\Customer\Audio\PLUTO\UserProfiles\Tone目录下准备好新的铃声文件;
  • 2、在mcu\plutommi\Service\ProfilesSrv\ProfilesSrvRes\ProfilesSrv.res文件中找到当前的铃声文件,比如poon.mp3pooff.mp3
    

    
    
    
    
    

#ifndef __LOW_COST_SUPPORT_COMMON__
    
    
    
    
    
#endif /* __LOW_COST_SUPPORT_COMMON__*/

    
  • 3、将poon.mp3pooff.mp3替换为新的铃声文件名,打完收工!
深究一下

前面替换铃声直接替换就完事了,但是为什么audio ID AUD_ID_PROF_TONE1AUD_ID_PROF_TONE2 分别是开机、关机铃声呢?为什么不是关机、开机铃声?为什么不是AUD_ID_PROF_TONE3AUD_ID_PROF_TONE4

猜想一下,开机、关机铃声是哪个,这个属于配置,那应该是存在NVRAM里的。顺着这个思路在mcu\custom\common\userprofile_nvram_def.c文件中找到了这么一张表(表有点长,直接跳到后面看吧

#ifndef EXTERNAL_MMI
nvram_srv_prof_setting_struct const NVRAM_PROFILES_DEFAULT [NVRAM_SRV_PROF_PROFILES_TOTAL_NUM] =
{
#ifdef CUSTOM_USER_PROFILE_CONTENT_DEFAULT
    CUSTOM_USER_PROFILE_CONTENT_DEFAULT
#else
    {
        SRV_PROF_VOL_LEVEL_7, SRV_PROF_VOL_LEVEL_7, SRV_PROF_VOL_LEVEL_7, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_0, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VOL_LEVEL_0, SRV_PROF_MEDIA_VOL_LEVEL_0, SRV_PROF_ALERT_TYPE_SILENT,KAL_FALSE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_FALSE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_SILENT, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        0, 0, KAL_FALSE, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0
    },
    {
        SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_2, SRV_PROF_MEDIA_VOL_LEVEL_4, SRV_PROF_ALERT_TYPE_VIB_ONLY,KAL_FALSE,KAL_TRUE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_FALSE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        0, 0, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_6, SRV_PROF_VOL_LEVEL_6, SRV_PROF_VOL_LEVEL_6, SRV_PROF_MEDIA_VOL_LEVEL_13, SRV_PROF_ALERT_TYPE_VIB_AND_RING,KAL_TRUE,KAL_TRUE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
#ifndef __MMI_PROF_ADD_DEL_PROF_SUPPORT__
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    }
#else
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    },
    {
        SRV_PROF_VOL_LEVEL_4, SRV_PROF_VOL_LEVEL_2, SRV_PROF_VOL_LEVEL_4, SRV_PROF_MEDIA_VOL_LEVEL_8, SRV_PROF_ALERT_TYPE_RING,KAL_TRUE,KAL_FALSE,SRV_PROF_RING_TYPE_REPEAT,
        KAL_FALSE, KAL_TRUE, SRV_PROF_LED_PATTERN_1, SRV_PROF_KEYPAD_TONE, SRV_PROF_VOL_LEVEL_0, SRV_PROF_VIB_LEVEL_0,
        SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, KAL_TRUE, SRV_PROF_AUD_TONE1, SRV_PROF_AUD_TONE2, 
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_TONE3, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4, SRV_PROF_AUD_TONE4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4,
        SRV_PROF_AUD_RING1, SRV_PROF_AUD_RING2, SRV_PROF_AUD_RING3, SRV_PROF_AUD_RING4
    }
#endif //__MMI_PROF_ADD_DEL_PROF_SUPPORT__

表的结构是下面这样的,看到power_on_tonepower_off_tone就知道没找错!!!好激动!!!

/* Profile Service Structure*/
typedef struct
{
    kal_uint8 ring_vol;                 /* ring volume level */
    kal_uint8 keypad_vol;               /* keypad volume level */
    kal_uint8 msg_vol;                  /* message volume level */
    kal_uint8 media_vol;                /* message volume level */

    kal_uint8 alert_type;               /* alert type */
    kal_bool noti_sound;                /* notification sound */
    kal_bool vibrate;                   /* if can vibrate */
    kal_uint8 ring_type;                /* ring type */
    kal_bool intelligent_call_alert;    /* intelligent call alert */
    kal_bool system_alert;              /* system alert */
    kal_uint8 led_pattern;              /* led color pattern */
    kal_uint8 keypad_tone_type;         /* keypad tone type */
    kal_uint8 touch_vol;                /* touch feddback volume level */
    kal_uint8 touch_vib;                /* touch feedback vibration level */

    kal_uint16 power_on_tone;            /* power on tone */
    kal_uint16 power_off_tone;           /* power off tone */
    kal_bool power_on_off_tone;          /* powr on/off tone switcher */
    kal_uint16 cover_open_tone;          /* cover open tone */
    kal_uint16 cover_close_tone;         /* cover close tone */

    kal_uint16 sms_tone[4];             /* sms tone */
    kal_uint16 mms_tone[4];             /* mms tone */
    kal_uint16 email_tone[4];           /* email tone */
    kal_uint16 voice_tone[4];           /* voice tone */
    kal_uint16 mt_call_tone[4];         /* mt call tone */
    kal_uint16 vt_call_tone[4];         /* vt call tone */
} nvram_srv_prof_setting_struct;

表中有N组数据,具体是哪一组就得根据具体情况看了,我这里是第一组。可以看到power_on_tonepower_off_tone分别是SRV_PROF_AUD_TONE1SRV_PROF_AUD_TONE2。but,为什么不是AUD_ID_PROF_TONE1AUD_ID_PROF_TONE2,前面添加的资源文件id就是这个啊………………

再继续找了一下,发现了下面这个变换audio id的函数。这下就明白了,NVRAM里的id在保存前进行了转换。所以SRV_PROF_AUD_TONE1就是AUD_ID_PROF_TONE1SRV_PROF_AUD_TONE2就是AUD_ID_PROF_TONE2

/*****************************************************************************
 * FUNCTION
 *  srv_prof_transform_audio_id_for_write_nvram
 * DESCRIPTION
 *  This function is to transform audio id
 *  
 * PARAMETERS
 *  srv_prof_audio_id  [IN]
 * RETURNS
 *  kal_uint16
 *****************************************************************************/
kal_uint16 srv_prof_transform_audio_id_for_write_nvram(srv_prof_audio_id audio_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    MMI_TRACE(MMI_MEDIA_TRC_G3_APP_DETAIL,MMI_PROF_SRV_TRC_TRANSFORM_ID,audio_id);

    if(audio_id > AUD_ID_PROF_TONE_BEGIN && audio_id < AUD_ID_PROF_TONE_END)
    {
        return (kal_uint16)(audio_id - AUD_ID_PROF_TONE1 + SRV_PROF_AUD_TONE1);
    }

    if(audio_id > AUD_ID_PROF_RING_BEGIN && audio_id < AUD_ID_PROF_RING_END)
    {
        return (kal_uint16)(audio_id - AUD_ID_PROF_RING1 + SRV_PROF_AUD_RING1);
    }

    return (kal_uint16)audio_id;
}

咳咳,问题又来了。

最开始说,mmi_bootup_play_animation函数中调用srv_prof_get_current_profile_value获取铃声资源再播放。调用时的参数是SRV_PROF_SETTINGS_POWER_ON_TONE,这既不是SRV_PROF_AUD_TONE1也不是AUD_ID_PROF_TONE1,怎么就播放正确了?

注意看srv_prof_get_current_profile_value中的这部分,很明显资源id应该是存到了g_srv_prof.cur_setting全局变量里边。

      #ifndef __MMI_POWER_ON_OFF_MUTE__
        /* Power on tone : srv_prof_audio_id */
        case SRV_PROF_SETTINGS_POWER_ON_TONE:
        {
            *((srv_prof_audio_id*)value) = g_srv_prof.cur_setting.power_on_tone;
            break;
        }

        /* Power off tone : srv_prof_audio_id */
        case SRV_PROF_SETTINGS_POWER_OFF_TONE:
        {
            *((srv_prof_audio_id*)value) = g_srv_prof.cur_setting.power_off_tone;
            break;
        }

        /* Power on/off tone switcher : MMI_BOOL */
        case SRV_PROF_SETTINGS_POWER_ON_OFF_TONE:
        {
            *((MMI_BOOL*)value) = g_srv_prof.cur_setting.power_on_off_tone;
            break;
        }

      #endif

顺藤摸瓜就找到了srv_prof_ret srv_prof_set_current_profile_value(srv_prof_settings_enum setting,void* value),里面的这部分跟上面的刚好对应

    #ifndef __MMI_POWER_ON_OFF_MUTE__
        /* Power on tone : srv_prof_audio_id */
        case SRV_PROF_SETTINGS_POWER_ON_TONE:
        {
            g_srv_prof.cur_setting.power_on_tone = *((srv_prof_audio_id*)value);
            break;
        }

        /* Power off tone : srv_prof_audio_id */
        case SRV_PROF_SETTINGS_POWER_OFF_TONE:
        {
            g_srv_prof.cur_setting.power_off_tone = *((srv_prof_audio_id*)value);
            break;
        }

        /* Power on/off tone switcher : MMI_BOOL */
        case SRV_PROF_SETTINGS_POWER_ON_OFF_TONE:
        {
            g_srv_prof.cur_setting.power_on_off_tone = *((MMI_BOOL*)value);
            break;
        }
    #endif

到此结束!!

你可能感兴趣的:(MT2503D开关机铃声)