欢迎来到天天文库
浏览记录
ID:24359319
大小:53.50 KB
页数:3页
时间:2018-11-14
《在 dos 下使用windows -.wav 文》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、在DOS下使用Windows*.WAV文摘要该文介绍了AXSIZE];unsignedclkdiv;intoldclk=0,running=1;voidsoundon();voidsoundoff();voidinterrupt(*oldint8h)();voidinterruptnep;0x00fc;outportb(0x61,i);/*声器*/}counter+=1;enable();/*打开中断*/if(counter>=datasize)counter=0;outportb(0x20,0
2、x20);running=1;}}voidsoundon(){clkdiv=1193180/filehead.samplespersec;/*计算8253计数器0初始值*/oldint8h=getvect(0x08);/*保存旧的08H中断向量*/setvect(0x08,newint8h);/*置新的08H中断例程*/outportb(0x43,0xB6);/*初始化*/outportb(0x42,1);/*8253计数器3/outportb(0x42,0);/*初始值*/outportb(0x43
3、,0x36);/*修改8253*/outport(0x40,clkdiv0x00ff);/*计数器0*/outport(0x40,(clkdiv>>8)0x00ff);/*初始值*/}voidsoundoff(){inti;setvect(0x08,oldint8h);/*恢复旧的08H中断向量*/outportb(0x43,0x36);/*恢复正常*/outport(0x40,0)/*的时钟中*/outport(0x40,0);/*断频率*/i=inportb(0x61);/*关扬*/i
4、=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",argv[1];exit(0);}}if(fread(fi
5、lehead,sizeof(structp;datasize,4,1,fp);for(j=0;j<datasize;j++)vol[j]=getc(fp);close(fp);printf("%s","NowSoundOn,PressESCtoStop!");soundon();for(;;){key=getch();if(key==27){soundoff();printf("%s","Soundoff!");break;}}}
此文档下载收益归作者所有