From 6ec7e67eba9327095fbc64a0aecb3af55926466b Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Sun, 13 Aug 2006 14:07:40 +0000 Subject: [PATCH] - use fast noise generation - simplified user-wave call, frames must never be 0 git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@320 0778d3d1-df1d-0410-868b-ea421aaaa00d --- include/oscillator.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/oscillator.h b/include/oscillator.h index 3872ace55..42851fe16 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -140,20 +140,16 @@ public: static inline sample_t noiseSample( const float ) { - return( 1.0f - 2.0f * ( ( float )rand() * ( 1.0f / - RAND_MAX ) ) ); + // Precise implementation +// return( 1.0f - rand() * 2.0f / RAND_MAX ); + + // Fast implementation + return( 1.0f - fast_rand() * 2.0f / FAST_RAND_MAX ); } inline sample_t userWaveSample( const float _sample ) { - if( m_userWave->frames() > 0 ) - { - return( m_userWave->userWaveSample( _sample ) ); - } - else - { - return( 0.0f ); - } + return( m_userWave->userWaveSample( _sample ) ); }