From 631d1126ec59b650e660ca6cb26a1ce2077ecd19 Mon Sep 17 00:00:00 2001 From: Danny McRae Date: Tue, 23 May 2006 19:48:05 +0000 Subject: [PATCH] Fixed segfault associated with negative times when using user defined waves in tripleOscillator Modified Files: include/oscillator.h git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@137 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 8 ++++++++ include/oscillator.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c0ce0777c..44d458b01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-5-23 Danny McRae + * include/oscillator.h: + FM mixing sometimes calculates a negative "time" for the sampling + which causes bad things to happen when pulling the data out of + a user defined wave. Changed userWaveSample to use the absolute + value of the sample, which fixes the segfaulting problem. Not + sure whether I should care about the negative times elsewhere. + 2006-05-22 Danny McRae * plugins/audio_file_processor/audio_file_processor.h: diff --git a/include/oscillator.h b/include/oscillator.h index 18227922c..fd91f9767 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -196,7 +196,7 @@ public: const sampleFrame * _user_wave, const f_cnt_t _user_wave_frames ) { - const float frame = fraction( _sample ) * _user_wave_frames; + const float frame = fraction( fabs( _sample ) ) * _user_wave_frames; const f_cnt_t f1 = static_cast( frame ); const f_cnt_t f2 = ( f1 + 1 ) % _user_wave_frames; return( linearInterpolate( _user_wave[f1][0],