diff options
Diffstat (limited to '')
-rw-r--r-- | src/pcm_utils.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pcm_utils.c b/src/pcm_utils.c index 3bb900508..a51fb8870 100644 --- a/src/pcm_utils.c +++ b/src/pcm_utils.c @@ -47,7 +47,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format, mpd_sint8 * buffer8 = (mpd_sint8 *)buffer; mpd_sint16 * buffer16 = (mpd_sint16 *)buffer; - if(volume>=100) return; + if(volume>=1000) return; if(volume<=0) { memset(buffer,0,bufferSize); @@ -59,7 +59,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format, while(bufferSize>0) { temp32 = *buffer16; temp32*= volume; - temp32/=100; + temp32/=1000; *buffer16 = temp32>32767 ? 32767 : (temp32<-32768 ? -32768 : temp32); buffer16++; @@ -70,7 +70,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format, while(bufferSize>0) { temp32 = *buffer8; temp32*= volume; - temp32/=100; + temp32/=1000; *buffer8 = temp32>127 ? 127 : (temp32<-128 ? -128 : temp32); buffer8++; @@ -96,7 +96,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1, switch(format->bits) { case 16: while(bufferSize1>0 && bufferSize2>0) { - temp32 = (vol1*(*buffer16_1)+vol2*(*buffer16_2))/100; + temp32 = (vol1*(*buffer16_1)+vol2*(*buffer16_2))/1000; *buffer16_1 = temp32>32767 ? 32767 : (temp32<-32768 ? -32768 : temp32); buffer16_1++; @@ -108,7 +108,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1, break; case 8: while(bufferSize1>0 && bufferSize2>0) { - temp32 = (vol1*(*buffer8_1)+vol2*(*buffer8_2))/100; + temp32 = (vol1*(*buffer8_1)+vol2*(*buffer8_2))/1000; *buffer8_1 = temp32>127 ? 127 : (temp32<-128 ? -128 : temp32); buffer8_1++; @@ -131,8 +131,8 @@ void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1, float s = sin(M_PI_2*portion1); s*=s; - vol1 = s*100+0.5; - vol1 = vol1>100 ? 100 : ( vol1<0 ? 0 : vol1 ); + vol1 = s*1000+0.5; + vol1 = vol1>1000 ? 1000 : ( vol1<0 ? 0 : vol1 ); - pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,vol1,100-vol1,format); + pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,vol1,1000-vol1,format); } |