From cdb8197c5d144d92e6c6d688172f6e7830d489c9 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 13 Feb 2014 01:14:06 +0100 Subject: [PATCH] AutomatableModel: use nearbyintf() for rounding For some reason roundf() causes an exception on Win32 when calling with negative values. This caused LMMS to crash when turning an external MIDI pitch wheel downwards. Closes #281. --- src/core/AutomatableModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index d8b4023eb..8a1f15d5e 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -280,7 +280,7 @@ float AutomatableModel::fittedValue( float value ) const if( m_step != 0 ) { - value = roundf( value / m_step ) * m_step; + value = nearbyintf( value / m_step ) * m_step; } // correct rounding error at the border