欢迎来到天天文库
浏览记录
ID:25391459
大小:55.50 KB
页数:4页
时间:2018-11-20
《在 dos 下使用windows -.wav 文件》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、在DOS下使用Windows*.WAV文件摘要该文介绍了AXSIZE];unsignedclkdiv;intoldclk=0,running=1;voidsoundon();voidsoundoff();voidinterrupt(*oldint8h)();voidinterruptne.unsignedinti;disable();/*屏蔽中断*/running=0;if(vol[counter]>=128){i=inportb(0x61);/*开扬*/i=i
2、0x03;outportb(0x61,i);/*声器*/}else{i=inportb(0x61);/*
3、关扬*/i=i0x00fc;outportb(0x61,i);/*声器*/}counter+=1;enable();/*打开中断*/if(counter>=datasize)counter=0;outportb(0x20,0x20);running=1;}}voidsoundon(){clkdiv=1193180/filehead.samplespersec;/*计算8253计数器0初始值*/oldint8h=getvect(0x08);/*保存旧的08H中断向量*/setvect(0x08,nep;0x00ff);/*计数器0*/outport(0x40,(clk
4、div>>8)0x00ff);/*初始值*/}voidsoundoff(){inti;setvect(0x08,oldint8h);/*恢复旧的08H中断向量*/outportb(0x43,0x36);/*恢复正常*/outport(0x40,0)/*的时钟中*/outport(0x40,0);/*断频率*/i=inportb(0x61);/*关扬*/i=i0x00fc;outportb(0x61,i);/*声器*/}voidmain(intargc,char*argv[]){longj;intkey;char*s;FILE*fp;/if(argc==1){p
5、rintf("%s","AndTheeInmandLine!");exit(0);}else{if((fp=fopen(argv[l],"rb"))==NULL){printf("CannotopentheDatafile%s",argv[1];exit(0);}}if(fread(filehead,sizeof(structp;datasize,4,1,fp);for(j=0;j<datasize;j++)vol[j]=getc(fp);close(fp);printf("%s","No.
此文档下载收益归作者所有