From 1eb74901855aac8cf8eb5366516c103d3225f020 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 15 Jul 2009 08:53:10 -0700 Subject: [PATCH] AudioFileMp3 - handle clipping better Fixed bug - when a sample clipped it was causing an overflow, making random noise where clipping happened. Now it clips properly. --- TODO | 2 +- src/core/audio/audio_file_mp3.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index c88ef1954..bc718fe63 100644 --- a/TODO +++ b/TODO @@ -55,7 +55,7 @@ Andrew Kelley's todo: * when you press down or up while browsing the resource browser, it should play the sample * select the output file format based on what you selected in file->save as -* segfault when you export an mp3 and press cancel +* ability to read mp3 samples - automation recording: diff --git a/src/core/audio/audio_file_mp3.cpp b/src/core/audio/audio_file_mp3.cpp index bc6bf4a22..a6519d99f 100644 --- a/src/core/audio/audio_file_mp3.cpp +++ b/src/core/audio/audio_file_mp3.cpp @@ -276,7 +276,7 @@ bool AudioFileMp3::startEncoding( void ) short int AudioFileMp3::rescale(float sample) { - return (sample / 1) * std::numeric_limits::max(); + return (qMin(sample, 1) / 1) * std::numeric_limits::max(); } // encode data and write to file