音乐播放器程序源代码及注释
关于C语言播放音乐的源代码

关于C语⾔播放⾳乐的源代码我们不得不说C语⾔是⼀种还算得上强⼤的语⾔,今天就来展⽰⼀下如何通过C语⾔去播放⾳乐:⽹上有很多这⽅⾯的资料,我只是稍加整理了⼀下,随便玩⼀下。
先来看第⼀个例程,这是⽐较简单的:#include<stdio.h>#include<dos.h>#include<bios.h>#include<time.h>#include<graphics.h>#define N1 32 /*⼀拍*/#define N2 16#define N4 8#define N8 4#define N16 2#define END 0/*其中:N1,N2,N4,N6,N8,N16分别代表⼀拍,⼆分之⼀拍,四分之⼀拍,⼋分之⼀拍,⼗六分之⼀拍。
*//*声明⼀个图形显⽰*/void printtext(unsigned char *temp[],int i, int color); /* ⽤于在屏幕上显⽰字符串 */enum NOTES{C10=131,D10=147,E10=165,F10=175,G10=196,A10=220,B10=247,/*低度⾳调分别是:1,2,3,4,5,6,7*/C0=262, D0=286, E0=330, F0=349, G0=440, A0=440, B0=494,/*中度⾳调分别是:1,2,3,4,5,6,7*/C1=523, D1=158, E1=659, F1=698, G1=784, A1=880, B1=998,/*⾼度⾳调分别是:1,2,3,4,5,6,7*/C2=1047,D2=1175,E2=1319,F2=1397,G2=1568,A2=1760,B2=1976/*⾼⼋度⾳调分别是:1,2,3,4,5,6,7*/}song1[]={G0,N16,G0,N8,A0,N8,G0,N8,C1,N8,B0,N4,G0,N16,G0,N8,A0,N8,G0,N8,D1,N8,C1,N4,G0,N16,G0,N8,G1,N8,E1,N8,C1,N8,B0,N16,B0,N8,A0,N4,F1,N16,F1,N8,E1,N8,C1,N8,D1,N8,C1,N4,END,END/*以上是曲⼦代码,你可以嵌⼊⾃⼰喜欢的歌曲代码*//*注意:数组中的偶数元素代表⾳符奇数元素代表拍长.*/};song2[]={C10,N1,D10,N1,E10,N1,F10,N1,G10,N1,A10,N1,B10,N1,C10,N2,D10,N2,E10,N2,F10,N2,G10,N2,A10,N2,B10,N2,C10,N4,D10,N4,E10,N4,F10,N4,G10,N4,A10,N4,B10,N4,C10,N8,D10,N8,E10,N8,F10,N8,G10,N8,A10,N8,B10,N8,C10,N16,D10,N16,E10,N16,F10,N16,G10,N16,A10,N16,B10,N16,C0,N1,D0,N1,E0,N1,F0,N1,G0,N1,A0,N1,B0,N1,C0,N2,D0,N2,E0,N2,F0,N2,G0,N2,A0,N2,B0,N2,C0,N4,D0,N4,E0,N4,F0,N4,G0,N4,A0,N4,B0,N4,C0,N8,D0,N8,E0,N8,F0,N8,G0,N8,A0,N8,B0,N8,C0,N16,D0,N16,E0,N16,F0,N16,G0,N16,A0,N16,B0,N16,C1,N1,D1,N1,E1,N1,F1,N1,G1,N1,A1,N1,B1,N1,C1,N2,D1,N2,E1,N2,F1,N2,G1,N2,A1,N2,B1,N2,C1,N4,D1,N4,E1,N4,F1,N4,G1,N4,A1,N4,B1,N4,C1,N8,D1,N8,E1,N8,F1,N8,G1,N8,A1,N8,B1,N8,C1,N16,D1,N16,E1,N16,F1,N16,G1,N16,A1,N16,B1,N16,C2,N1,D2,N1,E2,N1,F2,N1,G2,N1,A2,N1,B2,N1,C2,N2,D2,N2,E2,N2,F2,N2,G2,N2,A2,N2,B2,N2,C2,N4,D2,N4,E2,N4,F2,N4,G2,N4,A2,N4,B2,N4,C2,N8,D2,N8,E2,N8,F2,N8,G2,N8,A2,N8,B2,N8,C2,N16,D2,N16,E2,N16,F2,N16,G2,N16,A2,N16,B2,N16,END/*以上是⾳符测试代码,你可以通过系统发出的⾳调选择你需要的⾳符*//*注意:数组中的偶数元素代表⾳符奇数元素代表拍长.*/};song3[]= {C0,N8,C0,N8,G0,N8,G0,N8,A0,N8,A0,N8,G0,N4,F0,N8,F0,N8,E0,N8,E0,N8,D0,N8,D0,N8,C0,N4,G0,N8,G0,N8,F0,N4,E0,N8,E0,N8,D0,N4,G0,N8,G0,N8,F0,N8,F0,N8,E0,N8,E0,N8,D0,N4,C0,N8,E0,N8,G0,N4,A0,N8,C1,N8,G0,N4,F0,N8,F0,N8,E0,N8,E0,N4,D0,N8,D0,N8,C0,N4,C0,N8,C0,N8,G0,N8,G0,N8,A0,N8,A0,N8,G0,N4,F0,N8,F0,N8,E0,N8,E0,N8,D0,N8,D0,N8,C0,N4,G0,N8,G0,N8,F0,N4,E0,N8,E0,N8,D0,N4,G0,N8,G0,N8,F0,N8,F0,N8,E0,N8,E0,N8,D0,N4,C0,N8,E0,N8,G0,N4,A0,N8,C1,N8,G0,N4,F0,N8,F0,N8,E0,N8,E0,N4,D0,N8,D0,N8,C0,N4,END/*以上是曲⼦代码,你可以嵌⼊⾃⼰喜欢的歌曲代码*//*注意:数组中的偶数元素代表⾳符奇数元素代表拍长.*/};song4[]= {C10,N4,B0,N4,G0,N8,A0,N4,E0,N16,D0,N8,C0,N8,D0,N8,G0,N8,E0,N8,E0,N4,E0,N8,G0,N8,E0,N8,D0,N8,D0,N4,A0,N8,A0,N8,G0,N8,A0,N8,B0,N8,G0,N8,G0,N8,E0,N4,C10,N8,B0,N8,G0,N8,A0,N4,E0,N8,D0,N8,C0,N8,D0,N8,G0,N8,E0,N4,C0,N8,D0,N8,E0,N4,G0,N8,E0,N8,D0,N4,C0,N8,B10,N8,C0,N8,B10,N8,A10,N4,A0,N8,A0,N8,A0,N8,C1,N8,D1,N8, E1,N8,E1,N8,C1,N8,A0,N8,A0,N8,B0,N16,A0,N16,G0,N8,E0,N8,A0,N8,A0,N8,C1,N8,D1,N8,E1,N8,E1,N8,C1,N8,A0,N8,A0,N8,B0,N8,A0,N8,B0,N16,A0,N16,G0,N8,E0,N8,D1,N16,D1,N16,D1,N8, D1,N8,A0,N16,B0,N16,A0,N8,G0,N8,E0,N8,D1,N16,D1,N16,D1,N8, A0,N16,B0,N16,A0,N8,G0,N8,E0,N8,A0,N8,A0,N8,A0,N4,A0,N8,A0,N8,A0,N4,C10,N8,B0,N8,G0,N8,A0,N4,E0,N16,D0,N16,C0,N8, D0,N8,G0,N8,E0,N4,E0,N4,E0,N16,G0,N16,E0,N16,D0,N16,D0,N4,A0,N16,A0,N16,G0,N8,A0,N8,B0,N8,G0,N16,G0,N16,E0,N4,C10,N8,B0,N8,G0,N8,A0,N4,E0,N16,D0,N16,C0,N8,D0,N8,G0,N8,E0,N4,C0,N16,D0,N16,E0,N4,G0,N8,E0,N8,D0,N4,C0,N8,B10,N8,C0,N16,B10,N16,A10,N4,END};union {unsigned fre;unsigned char c[2];}tone;/*以下是播放程序代码*/void MusicPlay(int *song){int note=0,dur,control;clock_t goal;while(song[note]!=0){tone.fre=song[note];dur=song[note+1]; /*节拍*/if(kbhit())break;/*int kbhit()函数返回最近所敲的按键*/if(tone.fre){outportb(0x43,0xB6);/*函数void outportb(int port,char byte)将字节byte写⼊指定的输出端⼝port*/tone.fre=(unsigned)(1193180L/tone.fre);outportb(0x42,tone.c[0]);outportb(0x42,tone.c[1]);control=inportb(0x61);/*函数int inportb(int port)从指定的输⼊端⼝读⼊⼀个字节,并返回这个字节*/outportb(0x61,(control)|0x3);}goal=(clock_t)dur+clock();while(goal>clock());if(tone.fre)outportb(0x61,control);goal=(clock_t)0;note=note+2;}}/*以下是主函数其中包括异常处理*/void main(void){ int n;int graphdriver,graphmode;unsigned char *text[7] ;text[0]=" ";text[1]="start music........";text[2]="play the one music";text[3]="play the two music";text[4]="play the three music";text[5]="play the four music";text[6]="good_bye............";graphdriver=DETECT;graphmode=0;initgraph(&graphdriver,&graphmode,""); /*系统初始化 */cleardevice(); /* 清除屏幕 */settextjustify(LEFT_TEXT,CENTER_TEXT); /*设置字符排列⽅式*/printtext(text ,1, 1);getch();printtext(text ,2, 62);MusicPlay(song1);getch();printtext(text ,3,4);MusicPlay(song2);getch();printtext(text ,4, 58);MusicPlay(song3);getch();printtext(text ,5, 61);MusicPlay(song4);getch();printtext(text ,6, 63);getch();closegraph();}void printtext(unsigned char *temp[] , int i , int color){setcolor(color);settextstyle(TRIPLEX_FONT , HORIZ_DIR, 3);outtextxy(100, 40+i*50 , temp[i]); /* 显⽰字符串 temp[i]是具体的指针*/ }。
音乐播放器代码

音频播放器代码(1)<EMBED SRC="音乐文件地址">属性有:SRC="FILENAME" 设定音乐文件的路径AUTOSTART=TRUE/FALSE 是否要音乐文件传送完就自动播放,TRUE是要,FALSE是不要,默认为FALSELOOP=TRUE/FALSE 设定播放重复次数,LOOP=6表示重复6次,TRUE表示无限次播放,FALSE播放一次即停止。
STARTIME="分:秒" 设定乐曲的开始播放时间,如20秒后播放写为STARTIME=00:20VOLUME=0-100 设定音量的大小。
如果没设定的话,就用系统的音量。
WIDTH HEIGHT 设定控制面板的大小HIDDEN=TRUE 隐藏控制面板CONTROLS=CONSOLE/SMALLCONSOLE 设定控制面板样子例子:*************************************<html><head><title>播放音乐</title></head><body><EMBED SRC="midi.mid" autostart=true hidden=trueloop=true>作为背景音乐来播放。
</body></html>(2)wma格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=wma格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="-1" PlayCount="0" clicktoplay="-1"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=wma格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="0" PlayCount="0" clicktoplay="-1"></P></EMBED>(3)mp3格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34pluginspage=/windows/mediapla yer/download/default.asp 格式的src=mp3歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="-1" PlayCount="0" clicktoplay="-1"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=mp3格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="0" PlayCount="0" clicktoplay="-1"></P></EMBED>(4)rm格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34 src=rm格式的歌曲地址width=200 height=50 type=application/octet-stream controls="StatusBar,ControlPanel" AutoStart="-1" numloop="0" loop="-1" clicktoplay="-1" nolabels="0" prefetch="0" shuffle="0" _extenty="847" _extentx="9657"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 src=rm格式的歌曲地址width=200 height=50 type=application/octet-stream controls="StatusBar,ControlPanel" AutoStart="0" numloop="0" loop="-1" clicktoplay="-1" nolabels="0" prefetch="0" shuffle="0" _extenty="847" _extentx="9657"></P></EMBED><html><head><meta name="generator" content="microsoft frontpage 6.0"> <meta name="progid" content="frontpage.editor.document"> <meta http-equiv="content-type" content="text/html; charset=gb2312"><title>插入音乐播放器</title></head>//只需要注意rows="*,21"这句就可以,21表示播放器占的高度为21个象素。
音乐播放器代码

以下为一款音乐播放器代码,长度(width="960")及高度(height="620")可调,自由切换百度随心听,贝瓦电台,豆瓣电台,音悦TV等多款音乐台。
代码一:<iframe id=TV name=TV frameborder=0 scrolling=no src=/yyzb width=960 height=550></iframe>代码二:<div><embed height="620" allownetworking="internal" width="960" allowscriptaccess="never" loop="-1" invokeurls="false" src="/yyzb" type="audio/mpeg" wmode="transparent"><br/></div>以下为已嵌入音乐播放器代码的网页代码,复制以下代码创建index.html文件上传空间即可播放音乐,友情链接可自己修改。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><link rel="shortcut icon" href="favicon.ico"><link rel="Bookmark" href="favicon.ico"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="keywords" content="音乐网"><meta name="description" content="音乐网"><title>音乐网_电视直播网</title><style type="text/css">BODY {SCROLLBAR-FACE-COLOR: #009ace; FONT-SIZE: 12px; SCROLLBAR-HIGHLIGHT-COLOR: #b8e9fa; SCROLLBAR-SHADOW-COLOR: #009aaa; COLOR: #a9c8e4; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #cccccc; FONT-FAMIL Y: 宋体,Arial,Verdana ; BACKGROUND-COLOR: #8FC8D6; background-repeat: repeat-x}TD {FONT-SIZE: 12px; COLOR: #a9c8e4; LINE-HEIGHT: 140%}A:link {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:visited {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:active {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:hover {COLOR: #00FF00; TEXT-DECORATION: underline}</style><META HTTP-EQUIV="pragma" CONTENT="no-cache"><META http-equiv="Cache-Control" content="no-cache"><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"></HEAD><BODY class=bg leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" background="tv/bg.jpg"><TABLE cellSpacing=0 cellPadding=0 width=960 align=center border=0><TBODY><tr><td colspan="2" height=10></td></tr><tr><TD width=120 align=center ><a href=""><img border="0" src="/images/logo.gif" width="180" height="50" alt="电视直播网"></a></TD><TD width=840 align=right><script language="javascript" src="/vcp/getJScode/getJScode.asp?ReferenceID=684929&No=640x60"> </script></TD></TR><tr><td colspan="3" height=10></td></tr><tr><td colspan="2"><div><iframe id=TV name=TV frameborder=0 scrolling=no src=/yyzb width=960 height=550></iframe></div><TABLE cellSpacing=0 cellPadding=0 width=900 align=center border=0><TR><td align=center height=10></td></tr><TR><td align=center height=5></TD></TR><TR><td align=center><font color="#777777">©<br><div class="bottomx"><a><font color=slategray size=4>本站网址/zb 感谢转发微博、空间的朋友!谢谢你们!</a><div><p></p><font color="#777777"><a>友情连接: <a href="/c?s=a485395f&w=616248&c=17666&i=41910&l=0&e=&t=/cps/land/list/ 0" target="_blank"><font color=slategray size=2>蘑菇街</a> <ahref="/" target="_blank"><font color=slategray size=2>4399游戏</a> <a href="/rd/rd.aspx?e=181&adtype=1&unionid=liancaiping&subunionid=&other=&url=http%3A%2F%2Ftopic.moon %2Farticle%2Farticle_show%2F3816%3Ftype%3D0%26cn%3D13960%26other%3Dunionid%3Aliancaiping%7Cadtype%3A1%7Cadid%3A181%26adsiteid%3D10000007" target="_blank"><font color=slategray size=2>梦芭莎</a> <ahref="/?pid=mm_34029538_3439848_11149737" target="_blank"><font color=slategray size=2>爱淘宝</a> <ahref="/?pid=mm_34029538_3439848_11149737&tb_lm_id=l_sczl_sogou_cyg j" target="_blank"><font color=slategray size=2>一淘专享</a> <ahref="/go/act/taoke/ai_crown.php?pid=mm_34029538_3439848_1114973 7&unid=" target="_blank"><font color=slategraysize=2>TOP10店铺</a> <a href="/" target="_blank"><font color=slategray size=2>时光网址导航</a> <ahref="/?tracker_u=1787&uid=91520851657&website_id=521945"target="_blank"><font color=slategray size=2>一号店超市</a></a></font></div><div class="link">本站所有链接均收集自网络免费公开资源,非本站服务器资源,相关权责不由本站负责,若有侵权,请来信告知,本站会尽快删除!<br>Copyright © 2013 /tv/ Email:liancaiping@苏ICP备14004292号-1</font> <a href="/" target="_black" ><fontcolor=red size=2>返回</font></a> <a href="/" target="_black"><font color=red size=2>主页</a> 西部数码<ahref="/index.asp?ReferenceID=684929"target="_blank"><font color=slategray size=2>虚拟主机</a> </a><a href="/jtyy/" target="_blank"><font color=slategray size=2>家庭影院</a><b></TABLE></body></html>。
android音乐播放器---源代码

strings.xml<?xml version="1.0" encoding="utf-8"?><resources><string name="hello">Hello World, MainActivity!</string><string name="app_name">音乐播放器</string><string name="no_files">该目录为空</string><string name="to_top">[...]</string></resources>dimen.xml<?xml version="1.0" encoding="utf-8"?><resources><dimen name="music_title">20px</dimen><dimen name="music_list_title">20px</dimen><dimen name="widget_title_size">20px</dimen><dimen name="news_detail">16px</dimen><dimen name="text_size">18px</dimen><dimen name="news_item_title">19px</dimen><dimen name="text_size1">20px</dimen><dimen name="title">22px</dimen><dimen name="button_size">40px</dimen></resources>color.xml<?xml version="1.0" encoding="utf-8"?><resources><color name="white">#ffffff</color><color name="black">#000000</color><color name="widget_title">#b22222</color><color name="x_black">#292421</color><color name="blue">#3d59ab</color><color name="hui_black">#808a87</color></resources>setting.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="/apk/res/android"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent" android:background="@drawable/bg"><LinearLayout android:layout_width="fill_parent"android:gravity="center" android:layout_height="wrap_content"android:background="@drawable/footer_bar"><TextView android:text="设定" android:id="@+id/setting"android:textSize="@dimen/music_list_title" android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView></LinearLayout><LinearLayout android:orientation="horizontal"android:layout_width="wrap_content" android:gravity="center_vertical"android:layout_height="wrap_content"><TextView android:text="播放模式" android:id="@+id/setting"android:textSize="@dimen/text_size" android:layout_width="fill_parent"android:layout_height="wrap_content"></TextView><RadioGroup android:id="@+id/RadioGroup"android:layout_width="wrap_content" android:layout_height="wrap_content"><RadioButton android:text="单曲循环" android:id="@+id/sigle_play"android:layout_width="wrap_content"android:layout_height="wrap_content"></RadioButton><RadioButton android:text="顺序播放" android:id="@+id/order_play"android:layout_width="wrap_content"android:layout_height="wrap_content"></RadioButton><RadioButton android:text="随机播放" android:id="@+id/random_play"android:checked="true" android:layout_width="wrap_content"android:layout_height="wrap_content"></RadioButton></RadioGroup></LinearLayout><LinearLayout android:orientation="horizontal"android:layout_width="wrap_content" android:gravity="center_vertical"android:layout_height="wrap_content"><TextView android:text="歌词显示" android:id="@+id/setting"android:textSize="@dimen/text_size" android:layout_width="wrap_content"android:layout_height="wrap_content" /><ToggleButton android:text="" android:id="@+id/ly_lrc"android:checked="false" android:layout_width="wrap_content"android:layout_height="wrap_content" /></LinearLayout><TextView android:layout_width="fill_parent"android:layout_height="150px"></TextView><AbsoluteLayout android:background="@drawable/footer_bar"android:layout_width="fill_parent" android:layout_height="wrap_content"><ImageButton android:id="@+id/make" android:background="@drawable/share"android:layout_x="270px" android:layout_width="wrap_content"android:layout_height="wrap_content" /><ImageButton android:id="@+id/cancel" android:layout_x="5px"android:background="@drawable/back" android:layout_width="wrap_content"android:layout_height="wrap_content" /></AbsoluteLayout></LinearLayout>play_rack.xml<?xml version="1.0" encoding="utf-8"?><AbsoluteLayout xmlns:android="/apk/res/android"android:layout_width="fill_parent" android:layout_height="fill_parent"android:background="@drawable/bg1"><TextView android:layout_x="93px" android:layout_height="wrap_content"android:text="音乐播放器" android:layout_y="15px" android:id="@+id/title_music"android:textSize="@dimen/music_title"android:layout_width="wrap_content"></TextView><TextView android:layout_x="145px" android:layout_height="wrap_content"android:text="" android:layout_y="65px" android:id="@+id/current_music"android:textSize="18px" android:textColor="#C0FF3E"android:layout_width="wrap_content" android:textStyle="bold"></TextView><TextView android:layout_x="65px" android:layout_height="wrap_content"android:textSize="18px" android:textStyle="bold" android:text="正在播放:"android:layout_y="65px" android:textColor="#ff00ffff"android:layout_width="wrap_content"></TextView><LinearLayout android:layout_x="60px" android:layout_y="310px"android:gravity="center" android:layout_height="wrap_content"android:layout_width="wrap_content"><ImageButton android:layout_width="wrap_content"android:id="@+id/up_bt" android:layout_height="wrap_content"android:background="@drawable/up"></ImageButton><ImageButton android:layout_width="wrap_content"android:id="@+id/play_bt" android:layout_height="wrap_content"android:background="@drawable/play"></ImageButton><ImageButton android:layout_width="wrap_content"android:id="@+id/stop_bt" android:layout_height="wrap_content"android:background="@drawable/stop"></ImageButton><ImageButton android:layout_width="wrap_content"android:id="@+id/down_bt" android:layout_height="wrap_content"android:background="@drawable/down"></ImageButton><ImageButton android:layout_width="wrap_content"android:id="@+id/sound_bt" android:layout_height="wrap_content"android:background="@drawable/sound"></ImageButton></LinearLayout><SeekBar android:id="@+id/seekbar" android:layout_width="245px"android:layout_height="20px" android:layout_x="40px" android:layout_y="260px"android:progressDrawable="@drawable/seekbar_style"android:thumb="@drawable/thumb"android:paddingLeft="18px" android:paddingRight="15px"android:paddingTop="5px" android:paddingBottom="5px" android:progress="0"android:max="100" android:secondaryProgress="0"></SeekBar><TextView android:layout_x="60px" android:layout_height="wrap_content"android:text="00:00" android:layout_y="280px" android:id="@+id/current_time_text"android:layout_width="wrap_content"></TextView><TextView android:layout_x="230px" android:layout_height="wrap_content"android:text="00:00" android:layout_y="280px" android:id="@+id/end_Time_Text"android:layout_width="wrap_content"></TextView><ImageButton android:layout_width="wrap_content"android:layout_x="5px" android:layout_y="390px" android:id="@+id/list_bt"android:layout_height="wrap_content"android:background="@drawable/share"></ImageButton><ImageButton android:layout_x="270px"android:layout_height="wrap_content" android:layout_y="390px"android:id="@+id/back_bt" android:background="@drawable/back"android:layout_width="wrap_content"></ImageButton><LinearLayout android:orientation="horizontal"android:gravity="center" android:layout_y="370px"android:layout_height="wrap_content" android:layout_width="fill_parent"><TextView android:layout_height="wrap_content"android:textColor="#8deeee" android:id="@+id/lrcText"android:layout_width="wrap_content"></TextView></LinearLayout></AbsoluteLayout>play_list.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="/apk/res/android"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent" android:background="@drawable/list_bg"><LinearLayout android:layout_width="fill_parent"android:gravity="center" android:layout_height="wrap_content"android:background="@drawable/footer_bar"><TextView android:text="歌曲列表" android:id="@+id/music_list"android:textSize="@dimen/music_list_title" android:textStyle="bold"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView></LinearLayout><ListView android:id="@+id/show_play_list"android:layout_width="fill_parent" android:layout_height="337px"></ListView><LinearLayout android:layout_width="fill_parent"android:gravity="right" android:layout_height="wrap_content"android:background="@drawable/footer_bar"><ImageButton android:id="@+id/back" android:background="@drawable/back"android:layout_width="wrap_content"android:layout_height="wrap_content"></ImageButton></LinearLayout></LinearLayout>menu.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="/apk/res/android"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent" android:background="@drawable/list_bg"><LinearLayout android:layout_width="fill_parent"android:gravity="center" android:layout_height="wrap_content"android:background="@drawable/footer_bar"><TextView android:text="选项" android:id="@+id/select_item"android:textSize="@dimen/music_list_title" android:textStyle="bold"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView></LinearLayout><ListView android:id="@+id/menu" android:layout_width="wrap_content"android:background="@drawable/list_item_bg"android:layout_height="wrap_content"></ListView><TextView android:layout_width="wrap_content"android:layout_height="50px"></TextView><LinearLayout android:layout_width="fill_parent" android:gravity="right"android:layout_height="wrap_content" android:background="@drawable/footer_bar"><ImageButton android:id="@+id/back"android:background="@drawable/back"android:layout_width="wrap_content"android:layout_height="wrap_content"></ImageButton></LinearLayout></LinearLayout>file_row.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="/apk/res/android"android:orientation="horizontal" android:layout_width="fill_parent" android:background="@drawable/list_item_xml"android:layout_height="wrap_content" android:gravity="center_vertical"><ImageView android:id="@+id/image_Icon" android:layout_width="30px"android:layout_height="30px" android:background="@drawable/icon"></ImageView><TextView android:layout_width="10px"android:layout_height="wrap_content" /><TextView android:text="" android:id="@+id/text"android:layout_width="wrap_content" android:layout_height="wrap_content"android:textColor="@color/x_black"android:textSize="@dimen/text_size"></TextView></LinearLayout>directory_list.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="/apk/res/android"android:orientation="vertical" android:layout_width="fill_parent"android:layout_height="fill_parent" android:background="@drawable/list_bg"><LinearLayout android:layout_width="fill_parent"android:gravity="center" android:layout_height="wrap_content"android:background="@drawable/footer_bar"><TextView android:text="SD卡" android:id="@+id/store_card" android:textStyle="bold"android:layout_width="wrap_content" android:layout_height="wrap_content"android:textSize="@dimen/music_list_title"></TextView></LinearLayout><ListView android:id="@id/android:list" android:layout_width="wrap_content"android:layout_height="wrap_content" /><TextView android:layout_width="10px"android:layout_height="wrap_content" /><TextView android:id="@id/android:empty" android:layout_width="wrap_content"android:layout_height="wrap_content" android:text="@string/no_files" /></LinearLayout>StringHelper.javapackage com.Rain.music.util;import java.util.ArrayList;import java.util.List;public class StringHelper {public static List<String> spiltString(String str) {List<String> music_List = new ArrayList<String>();String[] musics = str.split(";");for (int i = 0; i < musics.length; i++) {music_List.add(musics[i]);}return music_List;}public static String toStringAll(List<String> music_List) {StringBuffer buffer = new StringBuffer();if (music_List.size() > 0) {for (int i = 0; i < music_List.size(); i++) {buffer.append(music_List.get(i));if (i < music_List.size() - 1)buffer.append(";");}return buffer.toString();}}MusicHelp.javapackage com.Rain.music.util;import android.media.MediaPlayer;import android.os.Handler;public class MusicHelp {private static MediaPlayer player = null;private static Handler objHandler = null; public static MediaPlayer getMediaPlayer() { if (player == null)player = new MediaPlayer();return player;}public static Handler getHandler(){if (objHandler == null)objHandler = new Handler(); return objHandler;}}MusicAdapter.javapackage com.Rain.music.util;import java.io.File;import java.util.List;import com.Rain.music.activity.R;import com.Rain.music.dao.DBProvider; import android.content.ContentResolver; import android.content.Context;import android.database.Cursor;import android.graphics.Bitmap;import android.graphics.BitmapFactory; import .Uri;import youtInflater;import android.view.View;import android.view.ViewGroup;import android.widget.BaseAdapter;import android.widget.ImageView;import android.widget.TextView;public class MusicAdapter extends BaseAdapter { private Bitmap down_Icon;public Bitmap getDown_Icon() {return down_Icon;}public void setDown_Icon(Bitmap downIcon) {down_Icon = downIcon;}public Bitmap getUp_Icon() {return up_Icon;}public void setUp_Icon(Bitmap upIcon) {up_Icon = upIcon;}public Bitmap getSuspend_Icon() {return suspend_Icon;}public void setSuspend_Icon(Bitmap suspendIcon) {suspend_Icon = suspendIcon;}public Bitmap getPlay_Icon() {return play_Icon;}public void setPlay_Icon(Bitmap playIcon) {play_Icon = playIcon;}LayoutInflater inflater;private Bitmap up_Icon;private Bitmap suspend_Icon;private Bitmap play_Icon;private Bitmap music_File;private Bitmap father_File;// 父目录private Bitmap folder_File;// 目录//private Bitmap docm_File;private List<String> list;Context context;public MusicAdapter(Context context, List<String> list) { this.list = list;this.context = context;inflater = LayoutInflater.from(context);//位图工厂play_Icon = BitmapFactory.decodeResource(context.getResources(),R.drawable.play);up_Icon = BitmapFactory.decodeResource(context.getResources(),R.drawable.up);suspend_Icon = BitmapFactory.decodeResource(context.getResources(),R.drawable.suspend);down_Icon = BitmapFactory.decodeResource(context.getResources(),R.drawable.down);music_File = BitmapFactory.decodeResource(context.getResources(),R.drawable.music_file);father_File = BitmapFactory.decodeResource(context.getResources(),R.drawable.father_file);folder_File = BitmapFactory.decodeResource(context.getResources(),R.drawable.folder_file);/*docm_File = BitmapFactory.decodeResource(context.getResources(),R.drawable.doc_file);*/}@Overridepublic int getCount() {return list.size();}@Overridepublic Object getItem(int position) {return list.get(position);}@Overridepublic long getItemId(int position) {return position;}@Overridepublic View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder;if (convertView == null) {holder = new ViewHolder();convertView = inflater.inflate(yout.file_row, null);holder.text = (TextView) convertView.findViewById(R.id.text);holder.icon = (ImageView) convertView.findViewById(R.id.image_Icon);convertView.setTag(holder);} else {holder = (ViewHolder) convertView.getTag();}//holder.text.setTextColor(Color.WHITE);//holder.text.setTextSize(22);if (list.get(position).toString().equals("[...]")) {// 如果是父目录holder.text.setText("[Back]");holder.icon.setImageBitmap(father_File);}if (list.get(position).toString().equals("/sdcard")|| list.get(position).toString().equals("/system")) { holder.text.setText(list.get(position));holder.icon.setImageBitmap(folder_File);}else {String path = null;if (!"[...]".equals(list.get(position).toString())) {path = query(list.get(position).toString());}if (path != null) {File f = new File(path);holder.text.setText(list.get(position));if (f.isDirectory()) {holder.icon.setImageBitmap(folder_File);}else {if (path.indexOf(".mp3") != -1) {holder.text.setText(list.get(position));holder.icon.setImageBitmap(music_File);}}}else {if ((list.get(position).indexOf(".mp3") != -1)){holder.text.setText(list.get(position));holder.icon.setImageBitmap(music_File);}else {holder.text.setText(list.get(position));holder.icon.setImageBitmap(folder_File);if (list.get(position).equals("[...]")) {holder.icon.setImageBitmap(father_File);}}}}return convertView;}public String query(String fileName) {// 查询歌曲路径ContentResolver cr = context.getContentResolver();Uri uri = DBProvider.CONTENT_URI;String[] projection = { "path" };String selection = "fileName=?";String[] selectionArgs = { fileName };Cursor c = cr.query(uri, projection, selection, selectionArgs, null);if (c.moveToFirst()) {String path = c.getString(0);return path;}return null;}private class ViewHolder {private TextView text;private ImageView icon;}}LrcShow.javapackage com.Rain.music.util;import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.io.IOException;import android.content.Context;import android.content.SharedPreferences;public class LrcShow {@SuppressWarnings("static-access")public static void showLrc(String musicName, Context context) { BufferedReader file;String s = null;StringBuffer lrc_time = new StringBuffer();StringBuffer lrc_word = new StringBuffer();try {SharedPreferences sp = context.getSharedPreferences("LRC_SHOW",context.MODE_WORLD_WRITEABLE); SharedPreferences.Editor editor = sp.edit();file = new BufferedReader(new FileReader(new File("/sdcard/"+ musicName + ".lrc")));while ((s = file.readLine()) != null) {if (s.split("]").length == 2) {lrc_time.append(s.split("]")[0] + ";");lrc_word.append(s.split("]")[1] + ";");}}editor.putString("MUSIC_TITLE", musicName);editor.putString("LRC_TIME", lrc_time.toString());editor.putString("LRC_WORD", lrc_word.toString());mit();}catch (IOException e) {e.printStackTrace();SharedPreferences sp = context.getSharedPreferences("LRC_SHOW",context.MODE_WORLD_WRITEABLE); SharedPreferences.Editor editor = sp.edit();editor.putString("MUSIC_TITLE", musicName);editor.putString("LRC_TIME", null);editor.putString("LRC_WORD", null);mit();}}}FileColumn.javapackage com.Rain.music.util;public class FileColumn {//音乐属性类//表明public static final String TABLE="File_Table";//列名public static final String ID="fileId";public static final String NAME="fileName";public static final String PA TH="path";public static final String TYPE="type";public static final String SORT="sortPId";public static final int ID_COLUMN = 0;public static final int NAME_COLUMN = 1;public static final int PA TH_COLUMN = 2;public static final int TYPE_COLUMN = 3;public static final int SORT_COlUMN = 4;public static String[] getColumArray(){return new String[]{ID,NAME,PATH,TYPE,SORT};}}SystemProvider.javapackage com.Rain.music.dao;import android.content.ContentResolver;import android.content.Context;import android.database.Cursor;import android.os.RemoteException;import android.provider.MediaStore;public class SystemProvider {private Context context;private Cursor cursor;public SystemProvider(Context context) {this.context = context;}public Cursor allSongs() {if (cursor != null)return cursor;ContentResolver resolver = context.getContentResolver();cursor = resolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER);return cursor;}public String getArtist() {return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST));}public String getTitle() {String title = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));/*try {title=EncodingUtils.getString(title.getBytes(), "UTF-8");} catch (Exception e) {e.printStackTrace();}*/return title;}public String getAlbum() throws RemoteException {// 读取正在播放歌曲的专辑return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM));}/*public int getDuration() throws RemoteException {// 获得当前歌曲的时长return player.getDuration();}public int getTime() throws RemoteException {// 获得当前的媒体时间return player.getCurrentPosition();}*/}DBProvider.javapackage com.Rain.music.dao;import com.Rain.music.util.FileColumn;import android.content.ContentProvider;import android.content.ContentValues;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import .Uri;import android.util.Log;public class DBProvider extends ContentProvider {private DBHelper dbOpenHelper;public static final String AUTHORITY = "MUSIC";public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + FileColumn.TABLE);@Overridepublic int delete(Uri arg0, String arg1, String[] arg2) {SQLiteDatabase db = dbOpenHelper.getWritableDatabase();try {db.delete(FileColumn.TABLE, arg1, arg2);Log.i("info", "delete");} catch (Exception ex) {ex.printStackTrace();Log.e("error", "delete");}return 1;}@Overridepublic String getType(Uri uri) {return null;}@Overridepublic Uri insert(Uri uri, ContentValues values) {SQLiteDatabase db = dbOpenHelper.getWritableDatabase();long count = 0;try {count = db.insert(FileColumn.TABLE, null, values);} catch (Exception ex) {ex.printStackTrace();Log.e("error", "insert");}if (count > 0)return uri;elsereturn null;}@Overridepublic boolean onCreate() {dbOpenHelper = new DBHelper(getContext());return true;}@Overridepublic Cursor query(Uri uri, String[] projection, String selection,String[] selectionArgs, String sortOrder) {SQLiteDatabase db = dbOpenHelper.getWritableDatabase();// 依次参数为:表明,查询字段,where语句,占位符替换,group by(分组),having(分组条件),order by(排序)Cursor cur = db.query(FileColumn.TABLE, projection, selection,selectionArgs, null, null, sortOrder);return cur;}@Overridepublic int update(Uri uri, ContentValues values, String selection,String[] selectionArgs) {SQLiteDatabase db = dbOpenHelper.getWritableDatabase();int i = 0;try {i = db.update(FileColumn.TABLE, values, selection, null);return i;} catch (Exception ex) {Log.e("error", "update");}return 0;}}DBHelper.javapackage com.Rain.music.dao;import com.Rain.music.util.FileColumn;。
音乐播放器源代码

P align=center><TABLE borderColor=#4f3256 align=centerbackground=/zh_cn/home4u/sucai/gifanimation/line/0022.gifborder=1><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"> <P align=center><EMBED src=width=369 height=39type=audio/mpeg loop="-1" autostart="ture"volume="0"></P></TD></TR></TBODY></TABLE></P>autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)=======================================================隐藏(hidden=true)播放器(不循环)<EMBED src=音乐网址hidden=true type=audio/x-ms-wma AUTOSTART="1">-----------------------------------------------------------隐藏(hidden=true)播放器(循环)<EMBED src=音乐网址hidden=true type=audio/mpeg AUTOSTART="1" loop="-1"> ---------------------------------------------------------------黑色[style="FILTER: xray()"]循环[loop="-1"]播放器<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30type=audio/mpeg volume="0" autostart="true" loop="-1">--------------------------------------------------------------------------------浅兰色循环(loop="-1")播放器<EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1"autostart="true" volume="0">--------------------------------------------------------------------------掩饰自动播放器<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH: 200px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=音乐网址width=200 height=40 type=audio/mpeg panel="0" autostart="true" loop="true"></TD></TR></TBODY></TABLE>-------------------------------------连播放时选择曲目的播放器<EMBEDpluginspage=/windows/mediaplayer/download/default.as p width=400 height=172 type=application/x-mplay er2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1" AUTOSTART="true" PlayCount="1">----------------------------------------------------------------------------------------------显示曲名的黑色带彩自动播放器<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45type=audio/x-ms-wma ShowStatusBar="1" loop="true" autostart="true">-------------------------------------------------------------------------显示曲名的灰白色面板<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>------------------------------------------灰白面板<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>---------------------------------------------------------------(带显示文件播放信息)<EMBED src="链接地址" width=300 height=69 type=application/x-mplay er2loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1"autostart="1"></EMBED>-----------------------------------------------黑色带彩棕色面板<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>---------------------------------------------------------------------浅紫播放器<TABLE borderColor=#4F3256background=/DownloadImg/2010/09/0718/5119955_3.jpg border=1><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg loop="-1" autostart="false" volume="0"></P></TD></TR></TBODY></TABLE>----------------------------------------------------------------------------------------------粉色<TABLE borderColor=navybackground=/UploadFile/2005-9/200592522275884778.jpg border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1" autostart="0" volume="0"></P></TD></TR></TBODY></TABLE>------------------------------------------------------------------------------------黄色闪光<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=navybackground=/s-helpSite/domName/nxm/20041114123131568.gi f border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=400 height=35 type=audio/mpeg loop="-1" autostart="0" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>--------------------------------------------------------------------------------蓝色闪光<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0background=/UploadFile/2004-12/2004123023101352.gif border=2><TBODY><TR><TD><TABLE align=center border=0><TBODY><TR><TD style="FILTER: alpha(opacity=60,style=3)"><P align=center><EMBED style="FILTER: Gray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-------------------------------------------------------------------------花边黑色<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=#000000 align=center border=1><TBODY><TR><TD><P align=center><EMBED style="FILTER: Xray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-----------------------------------------------------------------------------------------------------粉色花边<TABLE style="BORDER-RIGHT: #ff69b4 3px dotted; BORDER-TOP: #ff69b4 3px dotted; BORDER-LEFT: #ff69b4 3px dotted; BORDER-BOTTOM: #ff69b4 3px dotted" cellSpacing=0 cellPadding=0 align=center bgColor=white><TBODY><TR><TD><TABLE borderColor=#ff69b4 align=center bgColor=#ffccf5 border=2><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"><P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-------------------------------------------------------------------------------------------禁右键播放器<EMBED style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; BORDER-LEFT: silver 1px solid; BORDER-BOTTOM: silver 1px solid" src=音乐网址width=200 height=40 type=audio/x-mplayer2 console="video" showstatusbar="0" EnableContextMenu="0" volume="0" autostart="0" loop="-1">---------------------------------------------------------------------------------上下移动<MARQUEE style="LEFT: 230px; ; TOP: 300px" scrollAmount=1 scrollDelay=200 direction=up behavior=alternate width=300 height=400><br><MARQUEE scrollAmount=1 scrollDelay=100 behavior=alternate><br><TABLE style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#7ec0ee ,direction:145,strengt h:20)" cellSpacing=0 cellPadding=0 border=1><br><TBODY><br><TR><br><TD><EMBED style="FILTER: gray()" src=音乐网址width=200 height=20type=audio/mpeg showstatusbar="1" volume="0" loop="-1" autostart="1"></TD></TR></TBODY></TABLE></MARQUEE></MARQUEE>-------------------------------------------------------------------(显示文件标签信息)蓝色<DIV><EMBED src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true" transparentatstart="true"></EMBED></div>--------------------------------------------------(显示文件标签信息)灰白<DIV><EMBED style="FILTER: Gray()" src="链接地址" loop="-1" width=300height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>----------------------------------------------------(显示文件标签信息)黑彩<DIV><EMBED style="FILTER: invert()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true"showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>-----------------------------------------------------------(显示文件标签信息)黑<DIV><EMBED style="FILTER: xray()" src="链接地址" loop="-1" width=300height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>===================================================连放<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel" border="0" autostart="1" playcount="0" showtracker="1" volume="0"></EMBED>=========================================================图片播放器!<TABLE style="FILTER: alpha(opacity=100 Style=0 FinishOpacity=100)" borderColor=#000000 height=249 cellSpacing=0 cellPadding=0 width=314 background=/DownloadImg/2010/09/0718/5119955_4.gif border=0><TBODY><TR><TD width=314 height=180 cellpadding="0" cellspacing="0"></TD></TR><TR><TD align=left><P align=center><EMBED style="FILTER: alpha(opacity=100 Style=3 FinishOpacity=0)black(); style: " src=音乐网址width=310 height=28 type=video/x-ms-asf loop="-1" autostart="1" volume="0"></P></TD></TR></TBODY></TABLE>=================================================以上效果分见如下::为免各效果同时播放,以下autostart=0autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)=======================================================隐藏(hidden=true)播放器(不循环)src="/LIU/all_about_you.wma" hidden="true"type="audio/x-ms-wma" allowscriptaccess="never" autostart="0">-----------------------------------------------------------隐藏(hidden=true)播放器(循环)src="/LIU/all_about_you.wma" hidden="true"type="audio/mpeg" allowscriptaccess="never" autostart="0" loop="-1">---------------------------------------------------------------黑色[style="FILTER: xray()"]循环[loop="-1"]播放器style="FILTER: xray()" src="/LIU/all_about_you.wma" width="360" height="30" type="audio/mpeg" allowscriptaccess="never"volume="0" autostart="0" loop="-1">--------------------------------------------------------------------------------浅兰色循环(loop="-1")播放器src="/LIU/all_about_you.wma" width="300" heigh t="45" type="audio/mpeg" allowscriptaccess="never" loop="-1" autostart="0"volume="0">--------------------------------------------------------------------------掩饰自动播放器src="/LIU/all_about_you.wma"width="200" height="40" type="audio/mpeg"allowscriptaccess="never" panel="0" autostart="0"loop="true">-------------------------------------连播放时选择曲目的播放器pluginspage="/windows/mediaplayer/download/default.a sp" width="400" height="172" type="application/x-mplayer2"allowscriptaccess="never"filename="/LIU/all_about_you.wma" showcontrols="1" showstatusbar="1" showdisplay="1" showgotobar="1" autostart="0"playcount="1">----------------------------------------------------------------------------------------------显示曲名的黑色带彩自动播放器style="FILTER: invert()" src="/LIU/all_about_you.wma" width="320" height="45" type="audio/x-ms-wma" allowscriptaccess="never" showstatusbar="1" loop="0" autostart="0">-------------------------------------------------------------------------显示曲名的灰白色面板style="FILTER: Gray()" src="/LIU/all_about_you.wma" width="300" height="69" type="application/x-mplay er2" allowscriptaccess="never" loop="-1" showcontrols="1" showdisplay="0" showstatusbar="1" autostart="0"> ------------------------------------------灰白面板style="FILTER: Gray()" src="/LIU/all_about_you.wma" width="300" height="45" type="audio/x-ms-wma" allowscriptaccess="never"loop="-1" autostart="0">---------------------------------------------------------------(带显示文件播放信息)src="/LIU/all_about_you.wma" width="300" height="69" type="application/x-mplay er2" allowscriptaccess="never" loop="-1"showcontrols="1" showdisplay="0" showstatusbar="1" autostart="0">-----------------------------------------------黑色带彩棕色面板style="FILTER: invert()" src="/LIU/all_about_you.wma" width="300" height="45" type="audio/x-ms-wma" allowscriptaccess="never"loop="-1" autostart="0"><CENTER><TABLE style="BORDER-RIGHT: #f1dda1 2px ridge; BORDER-TOP: #bdb76b 2px ridge; BORDER-LEFT: #f1dda1 2px ridge; BORDER-BOTTOM: #bdb76b 2px ridge; BACKGROUND-COLOR: white" borderColor=#ffffff cellPadding=0width=300 align=centerbackground=/fileuploaddir/4B2686448.4.gifborder=0><TBODY><TR><TD width=300 height=20 cellPadding="0"cellSpacing="0"><TABLE align=center border=0><TBODY><TR><TDstyle="FILTER: alpha(opacity=60,style=3)"><P align=center><EMBED style="FILTER: invert(); WIDTH: 290px; HEIGHT: 28px" src=/Q/.Wma type=audio/x-ms-wma autostart="true"loop="-1"volume="0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER一、音乐播放器源代码(神采飞扬版)P align=center><TABLE borderColor=#4f3256 align=center background=http://tech.china.com/zh_cn/home4u/sucai/gifanimation/line/0022.gif border=1><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"><P align=center><EMBED src=width=369 height=39type=audio/mpeg loop="-1" autostart="ture" volume="0"></P></TD></TR> </TBODY></TABLE></P>二、具体操作步骤1、在“BLOG发表文章”网页里,也即是写文章的网页里,写好文字后,选中文字上方的“查看HTML源代码”项(选项前的方框内出现√则为选中),这时我们看见原来的文字成了汉字、英文字母和一些诸如<、/、=等符号组成的乱码。
视频音乐播放器代码大全

视频音乐播放器代码大全(珍藏限量版)autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)1隐藏播放器(不循环)代码:<EMBED src=音乐网址hidden=true type=audio/x-ms-wmaAUTOSTART="1">2.隐藏播放器(循环播放)代码:<EMBED src=音乐网址hidden=true type=audio/mpegAUTOSTART="1" loop="-1">3.黑色皮肤播放器代码:<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30 type=audio/mpeg volume="0" autostart="true" loop="-1">4.淡蓝色播放器代码:<EMBED src=播放地址 width=300 height=45 type=audio/mpegloop="-1" autostart="1" volume="0">5.迷幻播放器代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH:400px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=播放地址 width=400 height=40 type=audio/mpeg panel="0" autostart="0" loop="true"></TD></TR></TBODY></TABLE>6.带菜单的播放器代码:<EMBEDpluginspage=/windows/mediaplayer/downlo ad/default.asp width=400 height=172 type=application/x-mplayer2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1"AUTOSTART="true" PlayCount="1">7.深黄色带菜单播放器代码:<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45 type=audio/x-ms-wma ShowStatusBar="1" loop="true"autostart="true">8.灰色播放器代码:<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1"ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>9.灰白色播放器代码:<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>10.带菜单的蓝色播放器代码:<EMBED src="链接地址" width=300 height=69type=application/x-mplayer2 loop="-1" showcontrols="1"ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>11.棕色播放器代码:<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>12.带边框背景的播放器代码:<TABLE borderColor=#4F3256 background=背景图片地址 border=1><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"> <P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg loop="-1" autostart="false" volume="0"></P></TD></TR></TBODY></TABLE>13.带背景图片的播放器代码:<TABLE borderColor=navy background=图片地址border=0><TBODY><TR><TD style="FILTER: alpha(opacity=80,style=3)"> <P align=center><EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1" autostart="0" volume="0"></P></TD></TR></TBODY></TABLE>12 13综合属性分析background=图片地址可以更换图片地址来实现改变播放器背景14.黄色闪光播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=navybackground=/s-helpSite/domName/nxm/20041114123131568.gif border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"> <P align=center><EMBED src=音乐网址width=400 height=35 type=audio/mpeg loop="-1" autostart="0" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>15.蓝色闪光播放器代码:<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0 background=/UploadFile/2004-12/2004123023 101352.gif border=2><TBODY><TR><TD><TABLE align=centerborder=0><TBODY><TR><TD style="FILTER: alpha(opacity=60,style=3)"> <P align=center><EMBED style="FILTER: Gray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false"loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>16.带花边的播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=#000000 align=center border=1><TBODY><TR><TD><P align=center><EMBED style="FILTER: Xray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false"loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>17.粉色花边播放器代码:<TABLE style="BORDER-RIGHT: #ff69b4 3px dotted; BORDER-TOP: #ff69b4 3px dotted; BORDER-LEFT: #ff69b4 3px dotted;BORDER-BOTTOM: #ff69b4 3px dotted" cellSpacing=0cellPadding=0 align=center bgColor=white><TBODY><TR><TD><TABLE borderColor=#ff69b4 align=center bgColor=#ffccf5border=2><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"> <P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>18.显示文件标签灰色播放器代码:<DIV><EMBED style="FILTER: Gray()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true"showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>19显示文件标签棕色播放器代码:<DIV><EMBED style="FILTER: invert()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true"showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>20.显示文件标签黑色播放器代码:<DIV><EMBED style="FILTER: xray()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true"showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>21.连放播放器代码:<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35 type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel"border="0" autostart="1" playcount="0" showtracker="1"volume="0"></EMBED>22.彩色播放器代码:<TABLE style="FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: 00CCFF; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana; FONT-VARIANT: normal" cellSpacing=0 cellPadding=0 width=140border=0><TBODY><TR><TD style="BACKGROUND-COLOR:00CCFF"><EMBED style="FILTER: invert alpha(opacity=50) WIDTH: 140px; HEIGHT: 45px" src=音乐链接地址type=video/x-ms-asf autostart="FALSE" loop="-1"volume="0"></EMBED></TD></TR></TBODY></TABLE>本代码属性分析BACKGROUND-COLOR: 00CCFF播放器颜色代码可以更换以变换播放器颜色23.透明播放器代码代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)xray(); WIDTH:200px; HEIGHT: 40px"><TBODY><TR><TD><EMBED style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; BORDER-LEFT: silver 1px solid; BORDER-BOTTOM: silver 1px solid" src=音乐链接地址width=200 height=30 type=audio/x-mplayer2 loop="-1" autostart="0" volume="0"EnableContextMenu="0" showstatusbar="0"console="video"></TD></TR></TBODY></TABLE><p><span style="font-family:楷体;font-size:small;color:#156200;"><strong> <a href="">茶艺茗国际商城</a></strong>直供<strong><a href="/Product.aspx?BigId=1&SmallId=7">正品铁观音</a></strong>、西湖龙井、<strong><a href="/Product.aspx?BigId=3&SmallId=15">云南普洱</a></strong>、红茶等中国各大<strong><a href="/61/">品牌茗茶</a></strong>,及其它<strong><a href="/Product.aspx?BigId=5&SmallId=0">保健茶</a></strong>、茶食品、茶具等相关产品。
C WIN32音乐播放器源代码(主要代码).cpp

BOOL Main_Dialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
//*******************************************************************************************************************
BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
M_MUSIC(hwnd,TEXT("close"),numberup);
--number;
M_UPDOWN(hwnd);
M_MUSIC(hwnd,TEXT("play"),number);
}
break;
case IDC_PAUSE:
{
//*******************************************************************************************************************// 其它情况
default:
break;
}
#include "stdafx.h"
#include <windows.h>
#include <windowsx.h>
音乐播放器代码大全

音乐播放器代码大全单曲音乐代码大全:autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度 =0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)1隐藏播放器(不循环)代码:<EMBED src=音乐网址hidden=true type=audio/x-ms-wma AUTOSTART="1">2.隐藏播放器(循环播放)代码:<EMBED src=音乐网址hidden=true type=audio/mpeg AUTOSTART="1" loop="-1">3.黑色皮肤播放器代码:<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30 type=audio/mpeg volume="0" autostart="true" loop="-1">4.淡蓝色播放器代码:<EMBED src=播放地址width=300 height=45 type=audio/mpeg loop="-1" autostart="1" volume="0">5.迷幻播放器代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH: 400px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=播放地址width=400 height=40 type=audio/mpeg panel="0" autostart="0" loop="true"> </TD></TR></TBODY></TABLE>6.带菜单的播放器代码:<EMBED pluginspage= width=400 height=172 type=application/x-mplayer2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1" AUTOSTART="true" PlayCount="1">7.深黄色带菜单播放器代码:<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45 type=audio/x-ms-wma ShowStatusBar="1" loop="true" autostart="true">8.灰色播放器代码:<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>9.灰白色播放器代码:<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>10.带菜单的蓝色播放器代码:<EMBED src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>11.棕色播放器代码:<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>12.带边框背景的播放器代码:<TABLE borderColor=#4F3256 background=背景图片地址border=1><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg loop="-1" autostart="false" volume="0"></P></TD></TR></TBODY></TABLE>13.带背景图片的播放器代码:<TABLE borderColor=navy background=图片地址border=0> <TBODY><TR><TD style="FILTER: alpha(opacity=80,style=3)"><P align=center><EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1" autostart="0" volume="0"></P></TD></TR></TBODY></TABLE>12 13综合属性分析background=图片地址可以更换图片地址来实现改变播放器背景14.黄色闪光播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=navy background= border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=400 height=35 type=audio/mpeg loop="-1" autostart="0" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>15.蓝色闪光播放器代码:<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0 background= border=2><TBODY><TR><TD><TABLE align=center border=0><TBODY><TR><TD style="FILTER: alpha(opacity=60,style=3)"><P align=center><EMBED style="FILTER: Gray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBO DY></TABLE>16.带花边的播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed;BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=#000000 align=center border=1><TBODY><TR><TD><P align=center><EMBED style="FILTER: Xray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>17.粉色花边播放器代码:<TABLE style="BORDER-RIGHT: #ff69b4 3px dotted; BORDER-TOP: #ff69b4 3px dotted; BORDER-LEFT: #ff69b4 3px dotted; BORDER-BOTTOM: #ff69b4 3px dotted" cellSpacing=0 cellPadding=0 align=center bgColor=white><TBODY><TR><TD><TABLE borderColor=#ff69b4 align=center bgColor=#ffccf5 border=2><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"><P align=center><EMBED src=音乐网址width=300height=25 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>18.显示文件标签灰色播放器代码:<DIV><EMBED style="FILTER: Gray()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>19显示文件标签棕色播放器代码:<DIV><EMBED style="FILTER: invert()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>20.显示文件标签黑色播放器代码:<DIV><EMBED style="FILTER: xray()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>21.连放播放器代码:<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35 type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel" border="0" autostart="1" playcount="0" showtracker="1" volume="0"></EMBED>22.彩色播放器代码:<TABLE style="FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: 00CCFF; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana; FONT-VARIANT: normal" cellSpacing=0 cellPadding=0 width=140 border=0><TBODY><TR><TD style="BACKGROUND-COLOR: 00CCFF"><EMBED style="FILTER: invert alpha(opacity=50) WIDTH: 140px; HEIGHT: 45px" src=音乐链接地址 type=video/x-ms-asf autostart="FALSE" loop="-1"volume="0"></EMBED></TD></TR></TBODY></TABLE>本代码属性分析BACKGROUND-COLOR: 00CCFF 播放器颜色代码可以更换以变换播放器颜色23.透明播放器代码代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)xray(); WIDTH: 200px; HEIGHT: 40px"><TBODY><TR><TD><EMBED style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; BORDER-LEFT: silver 1px solid; BORDER-BOTTOM: silver 1px solid" src=音乐链接地址 width=200 height=30 type=audio/x-mplayer2 loop="-1" autostart="0" volume="0" EnableContextMenu="0" showstatusbar="0" console="video"></TD></TR></TBODY></TABLE>。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
音乐播放器程序源代码及注释:#include <reg52.h>#define uchar unsigned char#define uint unsigned intsbit duan=P2^6;sbit key1=P3^2;//按key1可切换花样sbit key2=P3^3;//按key2可切换歌曲sbit fm=P2^4;//蜂鸣器连续的IO口sbit P30=P3^0;//矩阵键盘的一列uchar code huayang1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf};//花样1uchar code huayang2[]={0x7f,0xfe,0xbf,0xfd,0xdf,0xfb,0xef,0xf7,0xef,0xfb,0xdf,0xfd,0xbf,0xfe};//花样2uchar code huayang3[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; char code huayang4[]={ 0x55,0xaa,0xcc,0x33,0x99,0x66,0x0f,0xf0}; uchar count1;//花样标志uchar count2;//歌曲标志uchar timeh,timel,i;//编程规则:字节高位是简谱,低位是持续时间,//代表多少个十六分音符//1-7代表中央C调,8-E代表高八度,0代表停顿//最后的0是结束标志uchar code qnzl[]={ //千年之恋0x12,0x22,0x34,0x84,0x74,0x54,0x38,0x42,0x32,0x22,0x42,0x34,0x84,0 x72,0x82,0x94,0xA8,0x08,//前奏0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,//竹林的灯火到过的沙漠0x32,0x31,0x21,0x32,0x82,0x71,0x81,0x71,0x51,0x32,0x22,//七色的国度不断飘逸风中0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,//有一种神秘灰色的旋涡0x32,0x31,0x21,0x32,0x83,0x82,0x71,0x72,0x02,//将我卷入了迷雾中0x63,0xA1,0xA2,0x62,0x92,0x82,0x52,//看不清的双手0x31,0x51,0x63,0x51,0x63,0x51,0x63,0x51,0x62,0x82,0x7C,0x02,//一朵花传来谁经过的温柔0x61,0x71,0x82,0x71,0x62,0xA2,0x71,0x76,//穿越千年的伤痛0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,//只为求一个结果0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,//你留下的轮廓指引我0x42,0x63,0x83,0x83,0x91,0x91,//黑夜中不寂寞0x61,0x71,0x82,0x71,0x62,0x0A2,0x71,0x76,//穿越千年的哀愁0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,//是你在尽头等我0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,//最美丽的感动会值得0x42,0x82,0x88,0x02,0x74,0x93,0x89,0xff//结束标志//用一生守候};uchar code jmszl[]={ //寂寞沙洲冷0x12,0x12,0x22,0x32,0x31,0x22,0x21,0x22,//自你走后心憔悴0x21,0x31,0x51,0x52,0x31,0x52,0x61,0x15,0x14,//白色油桐风中纷飞0x51,0x52,0x31,0x52,0x62,0x13,0x11,0x13,0x32,0x28,0x08,0x28, //落花似人有情这个季节0x31,0x32,0x31,0x32,0x11,0x21,0x51,0x52,0x51,0x52,//河畔的风放肆拼命地吹0x51,0x51,0x31,0x32,0x31,0x32,0x81,0x72,0x63,//不断拨弄离人的眼泪0x62,0x71,0x81,0x72,0x61,0x61,0x52,0x31,0x21,0x32,0x51,0x54,//那样浓烈的爱再也无法给0x22,0x12,0x11,0x12,0x11,0x12,0x12,0x14,0x26,0x32,0x26,//伤感一夜一夜0x32,0x61,0x51,0x51,0x31,0x31,0x21,0x31,0x51,0x61,0x51,0x31,0x51,//当记忆的线缠绕过往支离破碎0x02,0x32,0x81,0x81,0x81,0x81,0x62,0x52,0x34,//是慌乱占据了心扉0x31,0x81,0x81,0x81,0x61,0x91,0x82,//有花儿伴着蝴蝶0x51,0x51,0x51,0x51,0x31,0x61,0x53,//孤雁可以双飞0x21,0x11,0x21,0x11,0x22,0x11,0x21,0x26,//夜深人静独徘徊0x32,0x61,0x51,0x51,0x31,0x31,0x21,0x31,0x51,0x61,0x51,0x31,0x51,0x52, //当幸福恋人寄来红色分享喜悦0x31,0x31,0x81,0x81,0x81,0x61,0x91,0x81,0x61,0x31,0x56,//闭上双眼难过头也不敢回0x32,0x32,0x81,0x81,0x81,0x81,0x91,0x81,0x61,0x81,0x61,0x51,0x31,0x51, 0x34,//仍然捡尽寒枝不肯安歇微带着后悔0x21,0x31,0x51,0x31,0x21,0x11,0x61,0x21,0x16,//寂寞沙洲我该思念谁0xff};uchar code cuzhi[]={0xff,0xff,//占位0xFC,0x8E,//中央C调1-70xFC,0xED,0xFD,0x43,0xFD,0x6A,0xFD,0xB3,0xFD,0xF3,0xFE,0x2D,0xFE,0x47, //高八度1-70xFE,0x76,0xFE,0xA1,0xFE,0xC7,0xFE,0xD9,0xFE,0xF9,0xFF,0x16};uchar yinyue[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x0,0x0};//将音调转化为对应的LED样式void delay1(uint z); //延时1MSvoid delay(uint z); //延时165MS,即十六分音符void song();void beep();//蜂鸣器叫一声main(){ uchar x;count1=0;//流水灯无花样count2=1;//唱第一首歌P30=0;//选取矩阵键盘的一列EA=1;//开总中断EX0=1;//开外部中断0IT0=1;//外部中断0下降沿触发方式EX1=1;//开外部中断1IT1=1;//外部中断1下降沿触发方式TMOD=0x01;//定时器0工作在方式1TH0=0;TL0=0;ET0=1;while(1){if(count1!=0){switch(count1){case 1:for(x=0;x<14;x++){duan=1;P1=huayang1[x];beep();delay1(300);duan=0;if(count1!=1)break;}break;case 2:for(x=0;x<14;x++){duan=1;P1=huayang2[x];beep();delay1(300);duan=0;if(count1!=2)break;}break;case 3:for(x=0;x<16;x++){duan=1;P1=huayang3[x];beep();delay1(300);duan=0;if(count1!=3)break;}break;case 4:for(x=0;x<8;x++){duan=1;P1=huayang4[x];beep();delay1(300);duan=0;if(count1!=4)break;}break;}}else{song();delay1(1000);}}}void int0() interrupt 0{EA=0;//关总中断delay1(1);//去抖if(key1==0){count2=0;//不让蜂鸣器唱歌TR0=0;count1++;if(count1==5)count1=1;}EA=1;//开总中断}void int1() interrupt 2{EA=0;//关总中断delay1(1);//去抖if(key2==0){count1=0;//流水灯无花样TR0=1;i=0;//从头开始唱count2++;if(count2==3)count2=1;}EA=1;//开总中断}void timer0() interrupt 1 //用于产生各种音调{TH0=timeh;TL0=timel;fm=~fm;}void song(){uint temp;uchar jp;//jp是简谱i=0;while(1){ if(count2==0){break;}if(count2==1) //选曲temp=qnzl[i];if(count2==2)temp=jmszl[i];if(temp==0xff)break;jp=temp/16; //取数的高4位duan=1;P1=yinyue[jp];duan=0;if(jp!=0){timeh=cuzhi[jp*2];timel=cuzhi[jp*2+1];}else{TR0=0;fm=1;//关蜂鸣器}delay(temp%16); //取数的低4位TR0=0; //唱完一个音停10MS fm=1;delay1(10);TR0=1;i++;}TR0=0;fm=1;}void delay(uint z) //延时165MS,即十六分音符{ uint x,y;for(x=z;x>0;x--)for(y=19000;y>0;y--);}void delay1(uint z) //延时1MS{ uint x,y;for(x=z;x>0;x--)for(y=112;y>0;y--);}void beep() //蜂鸣器叫一声{ uchar i;for(i=0;i<50;i++){ fm=~fm;delay1(1);}fm=1; }。