comparison src/psf2/peops2/spu.c @ 2957:77f8f7f1b0d8

Implement silence detection.
author William Pitcock <nenolod@atheme.org>
date Wed, 15 Oct 2008 15:11:34 -0500
parents f2c62b0fc3ba
children
comparison
equal deleted inserted replaced
2956:f2c62b0fc3ba 2957:77f8f7f1b0d8
771 { 771 {
772 pS=(short *)pSpuBuffer; 772 pS=(short *)pSpuBuffer;
773 } 773 }
774 else if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4)) 774 else if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4))
775 { 775 {
776 psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data); 776 short *pSilenceIter = (short *)pSpuBuffer;
777 int iSilenceCount = 0;
778
779 for (; pSilenceIter < pS; pSilenceIter++)
780 {
781 if (*pSilenceIter == 0)
782 iSilenceCount++;
783
784 if (iSilenceCount > 20)
785 break;
786 }
787
788 if (iSilenceCount < 20)
789 psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data);
790
777 pS=(short *)pSpuBuffer; 791 pS=(short *)pSpuBuffer;
778 } 792 }
779 } 793 }
780 794
781 // end of big main loop... 795 // end of big main loop...