The current implementation of LinearFilter's lastValue() method causes a runtime exception when the size of the output gains buffer is 0, such as with a Moving Average Filter. In this case, outputs are not added to the buffer, and attempting to get the last value throws an index out-of-bounds exception. This behavior is not documented anywhere.
This fixes this issue by saving the last calculated value to a member variable and returning that when lastValue() is called, in both Java and C++.
The current implementation of LinearFilter's lastValue() method causes a runtime exception when the size of the output gains buffer is 0, such as with a Moving Average Filter. In this case, outputs are not added to the buffer, and attempting to get the last value throws an index out-of-bounds exception. This behavior is not documented anywhere.
This fixes this issue by saving the last calculated value to a member variable and returning that when lastValue() is called, in both Java and C++.