資源描述:
《在 dos 下使用windows -.wav 文》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在學術(shù)論文-天天文庫。
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計數(shù)器0初始值*/oldint8h=getvect(0x08);/*保存舊的08H中斷向量*/setvect(0x08,newint8h);/*置新的08H中斷例程*/outportb(0x43,0xB6);/*初始化*/outportb(0x42,1);/*8253計數(shù)器3/outportb(0x42,0);/*初始值*/outportb(0x43
3、,0x36);/*修改8253*/outport(0x40,clkdiv0x00ff);/*計數(shù)器0*/outport(0x40,(clkdiv>>8)0x00ff);/*初始值*/}voidsoundoff(){inti;setvect(0x08,oldint8h);/*恢復(fù)舊的08H中斷向量*/outportb(0x43,0x36);/*恢復(fù)正常*/outport(0x40,0)/*的時鐘中*/outport(0x40,0);/*斷頻率*/i=inportb(0x61);/*關(guān)揚*/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;}}}