資源描述:
《在 dos 下使用windows -.wav 文件》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫。
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);/*開揚(yáng)*/i=i
2、0x03;outportb(0x61,i);/*聲器*/}else{i=inportb(0x61);/*
3、關(guān)揚(yáng)*/i=i0x00fc;outportb(0x61,i);/*聲器*/}counter+=1;enable();/*打開中斷*/if(counter>=datasize)counter=0;outportb(0x20,0x20);running=1;}}voidsoundon(){clkdiv=1193180/filehead.samplespersec;/*計(jì)算8253計(jì)數(shù)器0初始值*/oldint8h=getvect(0x08);/*保存舊的08H中斷向量*/setvect(0x08,nep;0x00ff);/*計(jì)數(shù)器0*/outport(0x40,(clk
4、div>>8)0x00ff);/*初始值*/}voidsoundoff(){inti;setvect(0x08,oldint8h);/*恢復(fù)舊的08H中斷向量*/outportb(0x43,0x36);/*恢復(fù)正常*/outport(0x40,0)/*的時(shí)鐘中*/outport(0x40,0);/*斷頻率*/i=inportb(0x61);/*關(guān)揚(yáng)*/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.