diff options
Diffstat (limited to 'arts/modules/synth/synth_delay_impl.cc')
-rw-r--r-- | arts/modules/synth/synth_delay_impl.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/arts/modules/synth/synth_delay_impl.cc b/arts/modules/synth/synth_delay_impl.cc index 57285118..92c23fd1 100644 --- a/arts/modules/synth/synth_delay_impl.cc +++ b/arts/modules/synth/synth_delay_impl.cc @@ -56,13 +56,13 @@ class Synth_DELAY_impl : virtual public Synth_DELAY_skel, { protected: unsigned long _buffersize; - unsigned long _bittqmask; + unsigned long _bitmask; float * _buffer; float _maxdelay; unsigned int _writepos; public: - Synth_DELAY_impl() : _buffersize( 0 ), _bittqmask( 0 ), _buffer( 0 ), _maxdelay( 0 ), _writepos( 0 ) + Synth_DELAY_impl() : _buffersize( 0 ), _bitmask( 0 ), _buffer( 0 ), _maxdelay( 0 ), _writepos( 0 ) { maxdelay( 1 ); // take a one second buffer if nothing else is specified } @@ -85,15 +85,15 @@ public: { double int_pos; double error = modf( time[i] * samplingRateFloat, &int_pos ); - unsigned long readpos1 = ( _writepos - (unsigned long)(int_pos) ) & _bittqmask; - unsigned long readpos2 = ( readpos1 - 1 ) & _bittqmask; // Shouldn't this be +1? (mkretz) + unsigned long readpos1 = ( _writepos - (unsigned long)(int_pos) ) & _bitmask; + unsigned long readpos2 = ( readpos1 - 1 ) & _bitmask; // Shouldn't this be +1? (mkretz) // No, it's right this way: // ( 1 - error ) needs to be multiplied with the second // sample; error with the first _buffer[_writepos] = invalue[i]; outvalue[i] = _buffer[readpos1] * ( 1 - error ) + _buffer[readpos2] * error; _writepos++; - _writepos &= _bittqmask; + _writepos &= _bitmask; } } @@ -106,7 +106,7 @@ public: _maxdelay = newmaxdelay; double n = ceil( log( double(_maxdelay * samplingRateFloat) ) / log( 2. ) ); unsigned long newbuffersize = (unsigned long)( pow( 2, n ) ); - unsigned long newbittqmask = newbuffersize - 1; + unsigned long newbitmask = newbuffersize - 1; if( newbuffersize != _buffersize ) { float *newbuffer = new float[newbuffersize]; @@ -114,22 +114,22 @@ public: for( unsigned long i = 0; i < _buffersize; i++ ) { newbuffer[i] = _buffer[_writepos]; _writepos++; - _writepos &= newbittqmask; + _writepos &= newbitmask; } for( unsigned long i = _buffersize; i < newbuffersize; i++ ) newbuffer[i] = 0; } else { _writepos -= newbuffersize; - _writepos &= newbittqmask; + _writepos &= newbitmask; for( unsigned long i = 0; i < newbuffersize; i++ ) { newbuffer[i] = _buffer[_writepos]; _writepos++; - _writepos &= newbittqmask; + _writepos &= newbitmask; } } _buffer = newbuffer; _buffersize = newbuffersize; - _bittqmask = newbittqmask; + _bitmask = newbitmask; } maxdelay_changed( _maxdelay ); } |