欢迎来到天天文库
浏览记录
ID:25017635
大小:58.50 KB
页数:5页
时间:2018-11-17
《在 dos 下使用windows -.wav 文件毕业论文》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、在DOS下使用Windows*.WAV文件毕业论文摘要该文介绍了AXSIZE];unsignedclkdiv;intoldclk=0,running=1;voidsoundon();voidsoundoff();voidinterrupt(*oldint8h)();voidinterruptnewint8h(){/*用户中断例程*/if(running){unsignedinti;disable();/*屏蔽中断*/running=0;if(vol[counter]>=128){i=inport
2、b(0x61);/*开扬*/i=i
3、0x03;outportb(0x61,i);/*声器*/}else{i=inportb(0x61);/*关扬*/i=i0x00fc;outportb(0x61,i);/*声器*/}counter+=1;enable();/*打开中断*/if(counter>=datasize)counter=0;outportb(0x20,0x20);running=1;}}voidsoundon(){clkdiv=1193180/filehead.samplespersec
4、;/*计算8253计数器0初始值*/oldint8h=getvect(0x08);/*保存旧的08H中断向量*/setvect(0x08,nep;0x00ff);/*计数器0*/outport(0x40,(clkdiv>>8)0x00ff);/*初始值*/}voidsoundoff(){inti;setvect(0x08,oldint8h);/*恢复旧的08H中断向量*/outportb(0x43,0x36);/*恢复正常*/outport(0x40,0)/*的时钟中*/outport(0
5、x40,0);/*断频率*/i=inportb(0x61);/*关扬*/i=i0x00fc;outportb(0x61,i);/*声器*/}voidmain(intargc,char*argv[]){longj;intkey;char*s;FILE*fp;/if(argc==1){printf(%s,AndTheeInmandLine!);exit(0);}else{if((fp=fopen(argv[l],rb))==NULL){printf(CannotopentheDatafile%s,
6、argv[1];exit(0);}}if(fread(filehead,sizeof(structp;datasize,4,1,fp);for(j=0;jclose(fp);printf(%s,NowSoundOn,PressESCtoStop!);soundon();for(;;){key=getch();if(key==27){soundoff();printf(%s,Soundoff!);(作文网zw.ΝsΕac.编辑)break;}}}
此文档下载收益归作者所有