看程序中间红字部分
[mw_shl_code=c,true] while(rval==0)
{
key=KEY_Scan(0);
switch(key)
{
case KEY2_PRES: //STOP&SAVE
if(rec_sta&0X80)//óD¼òô
{
rec_sta=0; //1رÕ¼òô
wavhead->riff.ChunkSize=wavsize+36; //Õû¸öÎļtμÄ′óD¡-8;
wavhead->data.ChunkSize=wavsize; //êy¾Y′óD¡
f_lseek(f_rec,0); //Æ«òÆμ½Îļtí·.
f_write(f_rec,(const void*)wavhead,sizeof(__WaveHeader),&bw);//D′èëí·êy¾Y
f_close(f_rec);
wavsize=0;
}
rec_sta=0;
recsec=0;
LED1=1; //1رÕDS1
LCD_Fill(30,190,lcddev.width,lcddev.height,WHITE);//Çå3yÏÔê¾,Çå3y֮ǰÏÔê¾μļòôÎļtÃû
break;
case KEY0_PRES: //REC/PAUSE
if(rec_sta&0X01)//Ô-à′êÇÔYí£,¼ìDø¼òô
{
rec_sta&=0XFE;//è¡ÏûÔYí£
}else if(rec_sta&0X80)//òѾ-Ôú¼òôáË,ÔYí£// 这里历程里说是如果原先是正在录音就暂停,为什么rec_sta|=0X01以后就可以暂停了?????
{
rec_sta|=0X01; //ÔYí£
}else //»1û¿aê¼Â¼òô
{
recsec=0;
recoder_new_pathname(pname); //μÃμ½DÂμÄÃû×Ö
Show_Str(30,190,lcddev.width,16,"¼ÖÆ:",16,0);
Show_Str(30+40,190,lcddev.width,16,pname+11,16,0);//ÏÔê¾μ±Ç°Â¼òôÎļtÃû×Ö
recoder_wav_init(wavhead); //3õê¼»ˉwavêy¾Y
res=f_open(f_rec,(const TCHAR*)pname, FA_CREATE_ALWAYS | FA_WRITE);
if(res) //Îļt′′½¨ê§°ü
{
rec_sta=0; //′′½¨Îļt꧰ü,2»Äü¼òô
rval=0XFE; //ìáê¾êÇ·ñ′æÔúSD¿¨
}else
{
res=f_write(f_rec,(const void*)wavhead,sizeof(__WaveHeader),&bw);//D′èëí·êy¾Y
recoder_msg_show(0,0);
rec_sta|=0X80; //¿aê¼Â¼òô
}
}
if(rec_sta&0X01)LED1=0; //ìáê¾ÕyÔúÔYí£
else LED1=1;
break;
case WKUP_PRES: //2¥·Å×î½üò»¶Î¼òô
if(rec_sta!=0X80)//ûóDÔú¼òô
{
if(pname[0])//èç1û′¥Ãt°′¼ü±»°′ÏÂ,Çòpname2»Îa¿Õ
{
Show_Str(30,190,lcddev.width,16,"2¥·Å:",16,0);
Show_Str(30+40,190,lcddev.width,16,pname+11,16,0);//ÏÔê¾μ±2¥·ÅμÄÎļtÃû×Ö
recoder_enter_play_mode(); //½øèë2¥·ÅÄ£ê½
audio_play_song(pname); //2¥·Åpname
LCD_Fill(30,190,lcddev.width,lcddev.height,WHITE);//Çå3yÏÔê¾,Çå3y֮ǰÏÔê¾μļòôÎļtÃû
recoder_enter_rec_mode(); //ÖØD½øèë¼òôÄ£ê½
}
}
break;
}
delay_ms(5);
timecnt++;
if((timecnt%20)==0)LED0=!LED0;//DS0éá˸
if(recsec!=(wavsize/wavhead->fmt.ByteRate)) //¼òôê±¼äÏÔê¾
{
LED0=!LED0;//DS0éá˸
recsec=wavsize/wavhead->fmt.ByteRate; //¼òôê±¼ä
recoder_msg_show(recsec,wavhead->fmt.SampleRate*wavhead->fmt.NumOfChannels*wavhead->fmt.BitsPerSample);//ÏÔê¾ÂëÂê
}
}[/mw_shl_code]
一周热门 更多>