ref: 691d717ba6d2bee9c477e971f157f57bf051ed8b
parent: bbee7ab76b3e04fa2ae1cff8a23f9a61e214c6bf
author: Chris Moeller <[email protected]>
date: Mon Jan 11 04:00:08 EST 2010
{6/13/2006 4:52:18 AM}2006-06-10 18:10 UTC - kode54 - Fixed volume ramping. git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C107
--- a/dumb/src/helpers/resamp2.inc
+++ b/dumb/src/helpers/resamp2.inc
@@ -106,10 +106,10 @@
#define VOLUME_VARIABLES lvol, lvolr, lvold, lvolt, lvolm, rvol, rvolr, rvold, rvolt, rvolm
#define SET_VOLUME_VARIABLES { \
if ( volume_left ) { \
- lvolr = (int)floor(volume_left->volume * 65536.0 + 0.5); \
- lvold = (int)floor(volume_left->delta * 65536.0 + 0.5); \
- lvolt = (int)floor(volume_left->target * 65536.0 + 0.5); \
- lvolm = (int)floor(volume_left->mix * 65536.0 + 0.5); \
+ lvolr = (int)(volume_left->volume * 65536.0); \
+ lvold = (int)(volume_left->delta * 65536.0); \
+ lvolt = (int)(volume_left->target * 65536.0); \
+ lvolm = (int)(volume_left->mix * 65536.0); \
lvol = MULSC( lvolr, lvolm ); \
if ( lvolr == lvolt ) volume_left = NULL; \
} else { \
@@ -117,12 +117,12 @@
lvolt = 0; \
} \
if ( volume_right ) { \
- rvolr = (int)floor(volume_right->volume * 65536.0 + 0.5); \
- rvold = (int)floor(volume_right->delta * 65536.0 + 0.5); \
- rvolt = (int)floor(volume_right->target * 65536.0 + 0.5); \
- rvolm = (int)floor(volume_right->mix * 65536.0 + 0.5); \
+ rvolr = (int)(volume_right->volume * 65536.0); \
+ rvold = (int)(volume_right->delta * 65536.0); \
+ rvolt = (int)(volume_right->target * 65536.0); \
+ rvolm = (int)(volume_right->mix * 65536.0); \
rvol = MULSC( rvolr, rvolm ); \
- if ( rvolr == rvolt ) volume_left = NULL; \
+ if ( rvolr == rvolt ) volume_right = NULL; \
} else { \
rvol = 0; \
rvolt = 0; \
--- a/dumb/src/helpers/resamp3.inc
+++ b/dumb/src/helpers/resamp3.inc
@@ -199,7 +199,7 @@
LONG_LONG new_subpos = subpos + (LONG_LONG)dt * todo;
pos += (long)(new_subpos >> 16);
subpos = (long)new_subpos & 65535;
- } else if (dumb_resampling_quality <= DUMB_RQ_ALIASING) {
+ } else if (quality <= DUMB_RQ_ALIASING) {
/* Aliasing, forwards */
SRCTYPE xbuf[2*SRC_CHANNELS];
SRCTYPE *x = &xbuf[0];
@@ -223,7 +223,7 @@
subpos &= 65535;
);
pos += DIVIDE_BY_SRC_CHANNELS(x - xstart);
- } else if (dumb_resampling_quality <= DUMB_RQ_LINEAR) {
+ } else if (quality <= DUMB_RQ_LINEAR) {
/* Linear interpolation, forwards */
SRCTYPE xbuf[3*SRC_CHANNELS];
SRCTYPE *x = &xbuf[1*SRC_CHANNELS];
--- a/dumb/src/helpers/resample.inc
+++ b/dumb/src/helpers/resample.inc
@@ -120,10 +120,10 @@
#define MONO_DEST_VOLUME_ZEROS 0
#define SET_MONO_DEST_VOLUME_VARIABLES { \
if ( volume ) { \
- volr = (int)floor(volume->volume * 65536.0 + 0.5); \
- vold = (int)floor(volume->delta * 65536.0 + 0.5); \
- volt = (int)floor(volume->target * 65536.0 + 0.5); \
- volm = (int)floor(volume->mix * 65536.0 + 0.5); \
+ volr = (int)(volume->volume * 65536.0); \
+ vold = (int)(volume->delta * 65536.0); \
+ volt = (int)(volume->target * 65536.0); \
+ volm = (int)(volume->mix * 65536.0); \
vol = MULSC( volr, volm ); \
if ( volr == volt ) volume = NULL; \
} else { \
@@ -191,10 +191,10 @@
#define MONO_DEST_VOLUME_ZEROS 0, 0
#define SET_MONO_DEST_VOLUME_VARIABLES { \
if ( volume_left ) { \
- lvolr = (int)floor(volume_left->volume * 65536.0 + 0.5); \
- lvold = (int)floor(volume_left->delta * 65536.0 + 0.5); \
- lvolt = (int)floor(volume_left->target * 65536.0 + 0.5); \
- lvolm = (int)floor(volume_left->mix * 65536.0 + 0.5); \
+ lvolr = (int)(volume_left->volume * 65536.0); \
+ lvold = (int)(volume_left->delta * 65536.0); \
+ lvolt = (int)(volume_left->target * 65536.0); \
+ lvolm = (int)(volume_left->mix * 65536.0); \
lvol = MULSC( lvolr, lvolm ); \
if ( lvolr == lvolt ) volume_left = NULL; \
} else { \
@@ -202,10 +202,10 @@
lvolt = 0; \
} \
if ( volume_right ) { \
- rvolr = (int)floor(volume_right->volume * 65536.0 + 0.5); \
- rvold = (int)floor(volume_right->delta * 65536.0 + 0.5); \
- rvolt = (int)floor(volume_right->target * 65536.0 + 0.5); \
- rvolm = (int)floor(volume_right->mix * 65536.0 + 0.5); \
+ rvolr = (int)(volume_right->volume * 65536.0); \
+ rvold = (int)(volume_right->delta * 65536.0); \
+ rvolt = (int)(volume_right->target * 65536.0); \
+ rvolm = (int)(volume_right->mix * 65536.0); \
rvol = MULSC( rvolr, rvolm ); \
if ( rvolr == rvolt ) volume_right = NULL; \
} else { \