From becd3518e24535df29ef925f3524dca89367e868 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 21 Apr 2014 17:24:22 +0200 Subject: Fix fadeout. Fix export crashbug. --- dgedit/audioextractor.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dgedit/audioextractor.cc b/dgedit/audioextractor.cc index 8cb4ed0..881bfb2 100644 --- a/dgedit/audioextractor.cc +++ b/dgedit/audioextractor.cc @@ -106,8 +106,11 @@ void AudioExtractor::exportSelections() // Apply fadeout for(size_t fo = 0; fo < fadeout; fo++) { - float val = ((float)fo / (float)fadeout); - if(size >= fo) data[size - fo] *= val; + float val = 1.0 - ((float)fo / (float)fadeout); + if( (((size - fadeout) + fo) < size) && + (((size - fadeout) + fo) >= 0) ) { + data[(size - fadeout) + fo] *= val; + } } audiodata[i].data = data; -- cgit v1.2.3