这是我程序中用来播放wav文件的部分,和网上的许多程序都一样,程序运行很正常,但就是没有声音放出来,请教各位高手帮我分析一下,我用的是 arm 44b0的板子,想播放44.1KHz,单声道的wav文件:
void Play_SmallWave(U32 addr) { unsigned char *pWave; U32 i; unsigned short *pSteroWave; U32 samplesize,start;
rPLLCON = (0x69 << 12) | (0x17 << 4) | 0; Uart_Init(45200000,115200);
pWave=(unsigned char *)addr; pWave+=0x28; samplesize=*(pWave+0) | *(pWave+1)<<8 | *(pWave+2)<<16 | *(pWave+3)<<24; pWave+=4; start=(U32)(unsigned char *)pWave; pSteroWave=(U16 *)start; samplesize=(samplesize>>1)<<1; Uart_Printf("\r\nsample start:0x%x",pWave); Uart_Printf("\r\nsample size:%d\r\n",samplesize); /****** IIS Initialize ******/ rIISCON=0x02; rIISMOD=0x89; rIISPSR=0x33; rIISFCON=0x200;
Uart_Printf("\r\nNow play the wave file ..."); Uart_Printf("\r\nPush any key to exit!!!"); /****** IIS Tx Start ******/ rIISCON |=0x1; while(!Uart_GetKey()) { if(IIS_FIFOREADY) { for(i=0;i<8;i++) { *rIISFIF = *pSteroWave++; } if( ((U32)pSteroWave-start) > samplesize ) { pSteroWave=(U16 *)start; WrUTXH0('#'); } } }
/****** IIS Tx Stop ******/ rIISCON=0x0; //IIS stop ChangePllValue(0x48,0x3,0x2); Uart_Init(0,115200); Uart_Printf("\r\nIIS IS OK!!!"); }
|