Mercurial > audlegacy-plugins
changeset 2957:77f8f7f1b0d8
Implement silence detection.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Wed, 15 Oct 2008 15:11:34 -0500 |
parents | f2c62b0fc3ba |
children | 6d8892d78ded |
files | src/psf2/peops2/spu.c |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/psf2/peops2/spu.c Wed Oct 15 14:57:48 2008 -0500 +++ b/src/psf2/peops2/spu.c Wed Oct 15 15:11:34 2008 -0500 @@ -773,7 +773,21 @@ } else if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4)) { - psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data); + short *pSilenceIter = (short *)pSpuBuffer; + int iSilenceCount = 0; + + for (; pSilenceIter < pS; pSilenceIter++) + { + if (*pSilenceIter == 0) + iSilenceCount++; + + if (iSilenceCount > 20) + break; + } + + if (iSilenceCount < 20) + psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data); + pS=(short *)pSpuBuffer; } }