⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audioplayerdisplaylyric.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 3 页
字号:

/*******************************************************************************
 * Filename:
 * ---------
 *	AudioPlayerDisplayLyric.c
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This file is intends for MMI features definition.
 *
 * Author:
 * -------
 *	lrj
 *
 *==============================================================================
 * 				HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * $Log: AudioPlayerDisplayLyric.c,v $
 * Revision 1.4  2007/06/25 11:33:11  wangbei
 * MT118-6
 * Modification Author:wangbei
 * Date: 20070625
 * Content:解决MT118_A仿真编译不过。
 *
 * Revision 1.3  2007/05/25 06:17:18  linzhihua
 * MT158-375
 * Modification Author:NicoLin
 * Date: 2007/05/25
 * Content:歌词同步内存优化,使用动态分配内存方式
 *
 * Revision 1.2  2007/05/21 11:11:13  liuxiannian
 * MT158-370
 * Modification Author:liuxn
 * Date:20070510
 * Content:
 * 纠正注释不规范BUG:
 * MT158-6 添加歌词同步功能
 *
 * Revision 1.1.1.1  2007/05/11 08:53:27  zhouxiang
 * no message
 *
 * Revision 1.2  2007/04/17 02:31:07  wangbei
 * MT158-54
 * Modification Author:wangbei
 * Date: 20070417
 * Content:将歌词显示区的背景透底,修改标题的文字颜色。
 *
 * Revision 1.1  2007/04/09 05:56:12  liuxiannian
 * MT158-6
 * Modification Author:liuxn
 * Date: 20070409
 * Content:增加歌词同步实现文件
 *
 * Revision 1.2.2.8  2007/01/09 07:32:25  diaoyingjun
 * MT180-129
 * Modification Author: dyj
 * Date: 20070109
 * Content:修改播放带歌词的MP3时有新彩信到,无论查看与否返回音乐播音机界面无歌词显示。
 *
 * Revision 1.2.2.7  2006/12/08 08:26:37  diaoyingjun
 * MT160-315
 * Modification Author: dyj
 * Date: 20061208
 * Content:歌词播放时动画显示问题,如果上一首有歌词,下一首没有歌词的时候会有问题,反之也有问题.
 *
 * Revision 1.2.2.6  2006/12/06 08:04:19  diaoyingjun
 * MT160-301
 * Modification Author: dyj
 * Date: 2006/12/6
 * Content: 修改播放器动画显示的问题
 * 1)在没有播放时动画会动.
 * 2)切换时两个不同皮肤对应的动画会一起显示.
 *
 * Revision 1.2.2.5  2006/11/22 04:02:00  liuxiannian
 * ME630-54
 * Modification Author:liuxn
 * Date: 20061122
 * Content:使用宏来包MT160MP3主界面字体颜色
 *
 * Revision 1.2.2.4  2006/11/20 01:47:37  liuxiannian
 * MT160-20
 * Modification Author: liuxn
 * Date: 20061120
 * Content:更改歌词同步背景颜色以及歌曲标题颜色
 *
 * Revision 1.2.2.3  2006/11/10 09:45:31  liuruijin
 * ME630-18
 * Modification Author: lrj
 * Date: 2006/11/10
 * Content:播放"爱人"带歌词的MP3时,手机反应慢且部分字体显示乱码
 *
 * Revision 1.2.2.2  2006/11/07 07:37:42  liuxiannian
 * MT160-20
 *
 * Modification Author:liuxn
 * Date: 20061107
 * Content: 在没有歌词同步的歌曲播放时候播放假音波表
 *
 * Revision 1.2.2.1  2006/09/28 03:40:48  zhouxiang
 * Content: 同步G01_05C_W06_16_V53 zx
 *
 * Revision 1.2  2006/08/30 03:16:02  liuruijin
 * Modification Author:lrj
 * Data: 20060829
 * Content:
 * 修改真音波效果,打开耳机调频宏
 *
 * Revision 1.1  2006/08/17 01:42:04  liuruijin
 * 移植和整理歌词同步
 * 刘瑞金
 *
  *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *==============================================================================
 *******************************************************************************/
 #include "MMI_features.h"
#ifdef  _LYRIC_SYNCHRONIZE_DISPLAY_
#define __NEWSIMULATOR
#include "GlobalDefs.h"
#include "EventsGprot.h"
#include "HistoryGprot.h"
#include "TimerEvents.h"
#include "SettingProfile.h"
#include "HardwareEvents.h"
#include "wgui_categories.h"

#include "IdleAppDef.h"
#include "CommonScreens.h"


#include "gui_data_types.h"
#include "FrameworkStruct.h"
#include "GlobalConstants.h"
#include "mdi_datatype.h"
#include "kal_release.h"
#include "Conversions.h"
#include "FileMgr.h"
#include "fat_fs.h"
#include "FileSystemDef.h"

#include "vObjectsEnum.h"
#include "AudioPlayerDef.h"
#include "vObjects.h"
#include "kal_trace.h"

#include "mdi_audio.h"
#include "AudioPlayerDef.h"
#include "AudioPlayerType.h"
#include "AudioPlayerProt.h"
#include "AudioPlayerPlayList.h"

#include "CallManagementGprot.h"
#include "IdleAppProt.h"

#include "wgui_categories.h"
#include "gui_windows.h"

// dependent headers for AudioPlayerXXX.h"
#include "gdi_include.h"

#include "AudioPlayerDef.h"
#include "AudioPlayerType.h"
#include "AudioPlayerProt.h"
#include "AudioPlayerMainScreen.h"




#include "AudioPlayerDisplayLyric.h"

//NicoLin add for lyric synchronize display use app based  memory 20070525
#ifdef __LYRIC_USE_APP_ASM__
#include "DebugInitDef.h"
#include "app_mem.h"
#include "AppMemMgrGprot.h"
#include "med_smalloc.h"
#include "med_utility.h"
#endif
//NicoLin add end

// For single play
extern U8 single_play_state;
extern U32 single_play_duration;
extern kal_uint32 single_play_time;
extern BOOL in_single_play_screen;
extern U8 single_volume;


extern audply_struct            g_audply;  
extern audply_main_title_struct	audply_main_title;
extern BOOL g_mmi_audply_play_completed_after_button_down; // defined in AudioPlayerSrc.c
extern BOOL g_mmi_audply_init_done; // defined in AudioPlayerSrc.c
extern UI_character_type root_dir_phone[4]; // defined in AudioPlayerSrc.c
extern UI_character_type root_dir_card[4]; // defined in AudioPlayerSrc.c
extern UI_character_type phone_list_name[FMGR_MAX_FILE_LEN+4]; // defined in AudioPlayerSrc.c
extern UI_character_type card_list_name[FMGR_MAX_FILE_LEN+4]; // defined in AudioPlayerSrc.c
extern BOOL g_mmi_audply_init_done;

extern void (*RedrawCategoryFunction)(void); // defined in wgui_categories.c

extern audply_struct g_audply; // defined in AudioPlayerSrc.c
extern signed char g_audply_main_selected_button; // defined in AudioPlayerMainScreen.c
extern BOOL g_audply_main_selected_button_down; // defined in AudioPlayerMainScreen.c
/*      //lrj del 20060829
#ifdef __MMI_AUDIO_PLAYER_ANIMATION__
extern audply_main_animation_struct	audply_main_animation;
#endif
*/
extern  BOOL                init_scrolling_done ;
extern  scrolling_text	audply_main_scrolling_title;
extern  color 		      text_fg_color;
extern  color		     text_bg_color;
extern BOOL              r2lMMIFlag; // definedi n gui_inputs.c
extern  void mmi_audply_scroll_main_title_handler( void );
extern  void mmi_audply_redraw_main_title_background( S32 x1, S32 y1, S32 x2, S32 y2 );
extern  void mmi_audply_redraw_main_title( void );


//NicoLin add for lyric synchronize display use app based  memory 20070525
/***************************************************************************** 
* Local Vairable 
*****************************************************************************/
#ifdef __LYRIC_USE_APP_ASM__
 Lyric *  MyLyric=NULL;
 LyricInfo * Lyric_Info=NULL;	
 Type_Lyric_List  Lyric_List=NULL; 
#else 
  Lyric   MyLyric[LYRIC_MaxRealNum]; 
  LyricInfo   Lyric_Info[LYRIC_MaxDisplayLine+3];
  S8           Lyric_List[LYRIC_MaxLyricNum][LYRIC_MaxLen];
#endif /* __LYRIC_USE_APP_ASM__*/
//NicoLin add end

audply_main_music_wave_struct  audply_main_music_wave; 
BOOL              lyric_chang_color=FALSE; 
color               text_fg_color_current[4];
int                  text_fg_color_from=0;
int                  text_fg_color_to=0;

   /*declear function begin */
//NicoLin modify for lyric synchronize display use app based  memory 20070525
  //BOOL lyric_mmi_reader_lyric(void);
  void lyric_mmi_reader_lyric(void);
//NicoLin modify end
  void  lyric_DisplayLyric(void);
  void  lyric_Lyric_Scrolling_Display(void);  
  void  lyric_mmi_audply_redraw_main_title( void );
  void  lyric_mmi_audply_redraw_lyric_title(void);
  S32  lyric_mmi_audply_get_play_miliSeconds(void); 
  void  lyric_mmi_audply_lyric_timer(void);  
  void lyric_mmi_audply_redraw_main_lrc_background( void);
  void  lyric_start_display_lyric(void);
  void  lyric_mmi_audply_play_next_pre(void) ;   
  
//NicoLin add for lyric synchronize display use app based  memory 20070525
#ifdef __LYRIC_USE_APP_ASM__
static U8 mmi_lyric_del_scr_callback(void* ptr);
#endif
//NicoLin add end


   /*declear function end*/
    /*根据时间的先后和时间信息的数目进行由小到大的排序*/
 void  lyric_InsertMyLyric(Lyric  TempLyric)
 {
    S32 nTimer;
     S16 First=0;
     S16 Last=0;
     S16 Middle=0;
 	     
      nTimer=TempLyric.Timer;
             
     /*第一条记录*/    
    if(nTimersNum==1)
    {
         MyLyric[0].Timer=nTimer;
         MyLyric[0].LyricIndex=TempLyric.LyricIndex;
    }

    /*加进来的第二条记录*/
   if(nTimersNum==2)
   {
        if (nTimer>MyLyric[0].Timer)
        {
              MyLyric[1].Timer=nTimer;
              MyLyric[1].LyricIndex=TempLyric.LyricIndex;
        }
        else
        {
              MyLyric[1].Timer=MyLyric[0].Timer;
              MyLyric[1].LyricIndex=MyLyric[0].LyricIndex;
              MyLyric[0].Timer=nTimer;
              MyLyric[0].LyricIndex=TempLyric.LyricIndex;
         }
    }

    /*第三条记录,原数组有两条排序好的记录*/
    if(nTimersNum==3)
    {
         if(nTimer<MyLyric[0].Timer)
         {
               MyLyric[2].Timer=MyLyric[1].Timer;
               MyLyric[2].LyricIndex=MyLyric[1].LyricIndex;
               MyLyric[1].Timer=MyLyric[0].Timer;
               MyLyric[1].LyricIndex=MyLyric[0].LyricIndex;
               MyLyric[0].Timer=nTimer;
               MyLyric[0].LyricIndex=TempLyric.LyricIndex;
         }
         if(nTimer>MyLyric[1].Timer)
         {
               MyLyric[2].Timer=nTimer;
               MyLyric[2].LyricIndex=TempLyric.LyricIndex;
         }
         if((nTimer>MyLyric[0].Timer)&&(nTimer<MyLyric[1].Timer))
         {
               MyLyric[2].Timer=MyLyric[1].Timer;
               MyLyric[2].LyricIndex=MyLyric[1].LyricIndex;   
               MyLyric[1].Timer=nTimer;
               MyLyric[1].LyricIndex=TempLyric.LyricIndex;
          }
     }
 	       
     /*二分法查找插入的位置*/
     if(nTimersNum>=4)
     {
 	 First=0;
 	 Last=nTimersNum-2;
 	    
         while((Last-First)>1)
         {
             Middle=(First+Last)/2;
             if(nTimer<MyLyric[Middle].Timer)
             {
             	    Last=Middle;
             }
             else
             {
                  First=Middle;
             }
         }

        if(nTimer<MyLyric[0].Timer)     
        {
            memmove(&MyLyric[1],&MyLyric[0],(nTimersNum-1)*sizeof(Lyric));
            MyLyric[0].Timer=nTimer;
            MyLyric[0].LyricIndex=TempLyric.LyricIndex;
        }
        else if(nTimer>MyLyric[nTimersNum-2].Timer)
        {
           MyLyric[nTimersNum-1].Timer=nTimer;
           MyLyric[nTimersNum-1].LyricIndex=TempLyric.LyricIndex;
        
        }
        else
        {
           memmove(&MyLyric[Last+1],&MyLyric[Last],(nTimersNum-Last-1)*sizeof(Lyric));
           MyLyric[Last].Timer=nTimer;
           MyLyric[Last].LyricIndex=TempLyric.LyricIndex;
        }
    }
 }
  /*读取一行歌词*/
S32 lyric_mmi_get_one_line_lyric(S8* strOutput, FS_HANDLE fh)
{
	S32 nBytes = 0;
	S8 str[2];
	S8* currCursor;
	S32 strLen = 0;
       sprintf(str,"%c", VOBJ_LF_CHAR);
	pfread(strOutput, 1, LYRIC_MaxLen, fh, &nBytes);
	strOutput[nBytes] = VOBJ_NULL;

	if(!nBytes)
		return 0;

	if ((currCursor = strstr(strOutput, str)) != NULL)
	{
		strLen = (S32)(currCursor +1- strOutput);
		strOutput[strLen] = VOBJ_NULL;
              #ifdef MMI_ON_HARDWARE_P 
		pfseek(fh,(S32)(strLen-nBytes), SEEK_CUR);
              #endif
		nBytes = strLen;
	}
	//lrj modify  beign 20061110
	/*针对有些歌词没有VOBJ_LF_CHAR,只有VOBJ_CR_CHAR的情况*/
	else 
	{
                      sprintf(str,"%c", VOBJ_CR_CHAR);
              	 if ((currCursor = strstr(strOutput, str)) != NULL)
              	{
              		strLen = (S32)(currCursor +1- strOutput);
		              strOutput[strLen] = VOBJ_NULL;
                           #ifdef MMI_ON_HARDWARE_P 
		             pfseek(fh,(S32)(strLen-nBytes), SEEK_CUR);
                           #endif
		             nBytes = strLen;
              	}	
	else	/* CRLF not found, read until CRLF */
	{
		strOutput[nBytes] = VOBJ_NULL;
	}
	}
	//lrj modify end
	return nBytes;
}
  void  lyric_mmi_audply_redraw_main_lrc_background( void)  
 {
     S32 x1 = audply_main_music_wave.x;
	S32 y1 = audply_main_music_wave.y;
	S32 x2 = audply_main_music_wave.x + audply_main_music_wave.w - 1;
	S32 y2 = audply_main_music_wave.y + audply_main_music_wave.h - 1;
#if(UI_DOUBLE_BUFFER_SUPPORT)
	gui_lock_double_buffer();
#endif	
	gui_push_clip();
	gui_set_clip(x1, y1, x2, y2);	
       //gui_fill_rectangle(x1, y1, x2, y2,gui_color(0,71,114));  //delete by liuxn 20070510
       gdi_draw_solid_rect(x1,y1,x2,y2,GDI_COLOR_TRANSPARENT);// wangbei add 20070416
       // wangbei del start 20070416
       #if 0
       #ifdef __MT160_MP3PLAYER_FONT_COLOR__   //add by liuxn 20070510

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -