音乐播放器程序源代码及注释文档格式.docx
《音乐播放器程序源代码及注释文档格式.docx》由会员分享,可在线阅读,更多相关《音乐播放器程序源代码及注释文档格式.docx(10页珍藏版)》请在冰豆网上搜索。
0*80,0*c0,0*e0,0*f0,0*f8,0*fc,0*fe,0*ff};
charcodehuayang4[]={0*55,0*aa,0*cc,0*33,0*99,0*66,0*0f,0*f0};
ucharcount1;
//把戏标志
ucharcount2;
//歌曲标志
uchartimeh,timel,i;
//编程规则:
字节高位是简谱,低位是持续时间,
//代表多少个十六分音符
//1-7代表中央C调,8-E代表高八度,0代表停顿
//最后的0是完毕标志
ucharcodeqnzl[]={//千年之恋
0*12,0*22,0*34,0*84,0*74,0*54,0*38,0*42,0*32,0*22,0*42,0*34,0*84,0*72,0*82,0*94,0*A8,0*08,
//前奏
0*32,0*31,0*21,0*32,0*52,0*32,0*31,0*21,0*32,0*62,
//竹林的灯火到过的沙漠
0*32,0*31,0*21,0*32,0*82,0*71,0*81,0*71,0*51,0*32,0*22,
//七色的国度不断飘逸风中
//有一种神秘灰色的旋涡
0*32,0*31,0*21,0*32,0*83,0*82,0*71,0*72,0*02,
//将我卷入了迷雾中
0*63,0*A1,0*A2,0*62,0*92,0*82,0*52,
//看不清的双手
0*31,0*51,0*63,0*51,0*63,0*51,0*63,0*51,0*62,0*82,0*7C,0*02,
//一朵花传来谁经过的温柔
0*61,0*71,0*82,0*71,0*62,0*A2,0*71,0*76,
//穿越千年的伤痛
0*61,0*71,0*82,0*71,0*62,0*52,0*31,0*36,
//只为求一个结果
0*61,0*71,0*82,0*71,0*62,0*A3,0*73,0*62,0*53,
//你留下的轮廓指引我
0*42,0*63,0*83,0*83,0*91,0*91,
//黑夜中不寂寞
0*61,0*71,0*82,0*71,0*62,0*0A2,0*71,0*76,
//穿越千年的哀愁
//是你在尽头等我
//最美丽的感动会值得
0*42,0*82,0*88,0*02,0*74,0*93,0*89,0*ff//完毕标志
//用一生守候
};
ucharcodejmszl[]={//寂寞沙洲冷
0*12,0*12,0*22,0*32,0*31,0*22,0*21,0*22,
//自你走后心憔悴
0*21,0*31,0*51,0*52,0*31,0*52,0*61,0*15,0*14,
//白色油桐风中纷飞
0*51,0*52,0*31,0*52,0*62,0*13,0*11,0*13,0*32,0*28,0*08,0*28,
//落花似人有情这个季节
0*31,0*32,0*31,0*32,0*11,0*21,0*51,0*52,0*51,0*52,
//河畔的风放肆拼命地吹
0*51,0*51,0*31,0*32,0*31,0*32,0*81,0*72,0*63,
//不断拨弄离人的眼泪
0*62,0*71,0*81,0*72,0*61,0*61,0*52,0*31,0*21,0*32,0*51,0*54,
//那样浓烈的爱再也无法给
0*22,0*12,0*11,0*12,0*11,0*12,0*12,0*14,0*26,0*32,0*26,
//伤感一夜一夜
0*32,0*61,0*51,0*51,0*31,0*31,0*21,0*31,0*51,0*61,0*51,0*31,0*51,
//当记忆的线缠绕过往支离破碎
0*02,0*32,0*81,0*81,0*81,0*81,0*62,0*52,0*34,
//是慌乱占据了心扉
0*31,0*81,0*81,0*81,0*61,0*91,0*82,
//有花儿伴着蝴蝶
0*51,0*51,0*51,0*51,0*31,0*61,0*53,
//孤雁可以双飞
0*21,0*11,0*21,0*11,0*22,0*11,0*21,0*26,
//夜深人静独徘徊
0*32,0*61,0*51,0*51,0*31,0*31,0*21,0*31,0*51,0*61,0*51,0*31,0*51,0*52,
//当幸福恋人寄来红色分享喜悦
0*31,0*31,0*81,0*81,0*81,0*61,0*91,0*81,0*61,0*31,0*56,
//闭上双眼难过头也不敢回
0*32,0*32,0*81,0*81,0*81,0*81,0*91,0*81,0*61,0*81,0*61,0*51,0*31,0*51,0*34,
//仍然捡尽寒枝不肯安歇微带着懊悔
0*21,0*31,0*51,0*31,0*21,0*11,0*61,0*21,0*16,
//寂寞沙洲我该思念谁
0*ff};
ucharcodecuzhi[]={
0*ff,0*ff,//占位
0*FC,0*8E,//中央C调1-7
0*FC,0*ED,
0*FD,0*43,
0*FD,0*6A,
0*FD,0*B3,
0*FD,0*F3,
0*FE,0*2D,
0*FE,0*47,//高八度1-7
0*FE,0*76,
0*FE,0*A1,
0*FE,0*C7,
0*FE,0*D9,
0*FE,0*F9,
0*FF,0*16
};
ucharyinyue[]={0*ff,0*fe,0*fd,0*fb,0*f7,0*ef,0*df,0*bf,0*7f,0*0,0*0};
//将音调转化为对应的LED样式
voiddelay1(uintz);
//延时1MS
voiddelay(uintz);
//延时165MS,即十六分音符
voidsong();
voidbeep();
//蜂鸣器叫一声
main()
{uchar*;
count1=0;
//流水灯无把戏
count2=1;
//唱第一首歌
P30=0;
//选取矩阵键盘的一列
EA=1;
//开总中断
E*0=1;
//开外部中断0
IT0=1;
//外部中断0下降沿触发方式
E*1=1;
//开外部中断1
IT1=1;
//外部中断1下降沿触发方式
TMOD=0*01;
//定时器0工作在方式1
TH0=0;
TL0=0;
ET0=1;
while
(1)
{
if(count1!
=0)
{
switch(count1)
{
case1:
for(*=0;
*<
14;
*++)
{
duan=1;
P1=huayang1[*];
beep();
delay1(300);
duan=0;
if(count1!
=1)
break;
}
break;
case2:
P1=huayang2[*];
=2)
case3:
16;
P1=huayang3[*];
=3)
case4:
8;
P1=huayang4[*];
=4)
}
}
else
song();
delay1(1000);
}
}
voidint0()interrupt0
{
EA=0;
//关总中断
delay1
(1);
//去抖
if(key1==0)
count2=0;
//不让蜂鸣器唱歌
TR0=0;
count1++;
if(count1==5)
count1=1;
}
voidint1()interrupt2
if(key2==0)
count1=0;
TR0=1;
i=0;
//从头开场唱
count2++;
if(count2==3)
count2=1;
voidtimer0()interrupt1//用于产生各种音调
TH0=timeh;
TL0=timel;
fm=~fm;
voidsong()
uinttemp;
ucharjp;
//jp是简谱
i=0;
{if(count2==0)
{
break;
if(count2==1)//选曲
temp=qn