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.
This commit is contained in:
Andrew Kelley
2009-07-15 08:53:10 -07:00
parent 0390d4aadb
commit 1eb7490185
2 changed files with 2 additions and 2 deletions

2
TODO
View File

@@ -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:

View File

@@ -276,7 +276,7 @@ bool AudioFileMp3::startEncoding( void )
short int AudioFileMp3::rescale(float sample) {
return (sample / 1) * std::numeric_limits<short int>::max();
return (qMin<float>(sample, 1) / 1) * std::numeric_limits<short int>::max();
}
// encode data and write to file