GetWindow() 개인적인 메소드

private GetWindow ( bool prev, bool next ) : float[]
prev bool
next bool
리턴 float[]
예제 #1
0
        int OverlapSamples()
        {
            // window
            var window = _mode.GetWindow(_prevFlag, _nextFlag);
            // this is applied as part of the lapping operation

            // now lap the data into the buffer...

            var sizeW  = _mode.BlockSize;
            var right  = sizeW;
            var center = right >> 1;
            var left   = 0;
            var begin  = -center;
            var end    = center;

            if (_mode.BlockFlag)
            {
                // if the flag is true, it's a long block
                // if the flag is false, it's a short block
                if (!_prevFlag)
                {
                    // previous block was short
                    left   = Block1Size / 4 - Block0Size / 4; // where to start in pcm[][]
                    center = left + Block0Size / 2;           // adjust the center so we're correctly clearing the buffer...
                    begin  = Block0Size / -2 - left;          // where to start in _outputBuffer[,]
                }

                if (!_nextFlag)
                {
                    // next block is short
                    right -= sizeW / 4 - Block0Size / 4;
                    end    = sizeW / 4 + Block0Size / 4;
                }
            }
            // short blocks don't need any adjustments

            var idx = _outputBuffer.Length / _channels + begin;

            for (var c = 0; c < _channels; c++)
            {
                _outputBuffer.Write(c, idx, left, center, right, _residue[c], window);
            }

            var newPrepLen     = _outputBuffer.Length / _channels - end;
            var samplesDecoded = newPrepLen - _preparedLength;

            _preparedLength = newPrepLen;

            return(samplesDecoded);
        }
예제 #2
0
        public int OverlapSamples()
        {
            float[] window    = _mode.GetWindow(_prevFlag, _nextFlag);
            int     blockSize = _mode.BlockSize;
            int     num       = blockSize;
            int     num2      = num >> 1;
            int     num3      = 0;
            int     num4      = -num2;
            int     num5      = num2;

            if (_mode.BlockFlag)
            {
                if (!_prevFlag)
                {
                    num3 = Block1Size / 4 - Block0Size / 4;
                    num2 = num3 + Block0Size / 2;
                    num4 = Block0Size / -2 - num3;
                }
                if (!_nextFlag)
                {
                    num -= blockSize / 4 - Block0Size / 4;
                    num5 = blockSize / 4 + Block0Size / 4;
                }
            }
            int index = _outputBuffer.Length / _channels + num4;

            for (int i = 0; i < _channels; i++)
            {
                _outputBuffer.Write(i, index, num3, num2, num, _residue[i], window);
            }
            int num6   = _outputBuffer.Length / _channels - num5;
            int result = num6 - _preparedLength;

            _preparedLength = num6;
            return(result);
        }