44b0声音的播放

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

用的UC/OS II ?

  
 楼主| syzhou1314 发表于 2007-1-8 19:59 | 显示全部楼层

对,是用的uc/os!

对,是用的uc/os!<br />哥哥说说
您需要登录后才可以回帖 登录 | 注册

本版积分规则

19

主题

61

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部