各位dx好: 我正在用三星44b0实验箱做一个语音电子时钟,现需连续播放两段wave声音,一段是欢迎使用(huanying.wav总共404858字节,除去44字节的头文件信息是404814字节),另一段是播报日期的声音(nian.wav总共是156698字节,除去44字节的头文件信息是156654字节),两者总共播放时间不过5秒,在程序中定义的播放buffer缓冲区”int buffer[AUDIO_IN_BUFFERSIZE*20];“大小是1764000字节(>(404814+156654))我的做法是先把huanying.wav读到缓冲区buffer的0~404813中,然后把nian.wav读到404814~561467中,然后在把buffer作为dma的源地址进行播放!单结果只是播放了huanying.wav,后面的没出来,请问是什么原因?错在哪里》》÷?? 一下是程序:
void Main_Task(void *Id) //Main_Test_Task { u32 toubyte; U32 nbyte; FILE *pfile; FILE *pfile1; char filename[]="huanying.wav";//erlingling char filename1[]="nian.wav"; int aa=1; rIISCON=0; //disable; rIISMOD=IISMOD_TX|IISMOD_16BIT|IISMOD_32FS|IISMOD_MCLK_384FS; rIISFCON=IISFCON_TXDMA|IISFCON_TXFIFO; rIISPSR=0x11; rIISCON=IISCON_PRESCALE|IISCON_ENABLE; Init_UDA1341(); pfile=OpenOSFile(filename, FILEMODE_READ); if(!pfile) return ; pfile1=OpenOSFile(filename1, FILEMODE_READ); if(!pfile1) return ; toubyte=ReadOSFile(pfile, (U8*) buffer, 0x16*2);//读取头文件信息 nbyte=ReadOSFile(pfile, (U8*) buffer, 404814);//读取波形数据 Uart_Printf("
huanying file tounbyte=%d nbyte=%d sizeofbuff=%d
",toubyte,nbyte,sizeof(buffer)); toubyte=ReadOSFile(pfile1, (U8*) (buffer+404814), 0x16*2);//读取头文件信息 Uart_Printf("
nian tounbyte=%d
",toubyte); nbyte=ReadOSFile(pfile1, (U8*) (buffer+404814),156654);//读取波形数据 Uart_Printf("
nian file tounbyte=%d nbyte=%d sizeofbuff=%d
",toubyte,nbyte,sizeof(buffer)); for(;;) {//死循环 /****** BDMA0 Initialize ******/ //for Source rBDISRC0=(1<<30)+(1<<28)+(int)buffer; //Half word,inc,Buf //for des rBDIDES0=(1<<30)+(3<<28)+((int)0x1d18010); //M2IO,fix,IISFIF //Size //iis,reserve,done_int,not auto-reload/start,DMA enable,COUNT rBDICNT0=(1<<30)+(1<<26)+(3<<22)+(0<<21)+(0<<20)+(sizeof(buffer)&(~0x3)); rBDICNT0 |= (1<<20);//enable //Enable DMA rBDCON0 = 0x0<<2; //Tx DMA rIISCON|=IISCON_TXDMA; } } 这是超级终端的结果: File huanyingwav have been read! File nian wav have been read! huanying file tounbyte=44 nbyte=404814 sizeofbuff=1764000 nian tounbyte=44 nian file tounbyte=44 nbyte=156654 sizeofbuff=1764000 恳请指教! |