Skip to content
Snippets Groups Projects
Commit 395b3d9d authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Prevent 0 sample sounds while trimming #715

parent 329a6b5f
Branches
No related tags found
No related merge requests found
...@@ -120,8 +120,10 @@ class SoundEditor extends React.Component { ...@@ -120,8 +120,10 @@ class SoundEditor extends React.Component {
const sampleCount = samples.length; const sampleCount = samples.length;
const startIndex = Math.floor(this.state.trimStart * sampleCount); const startIndex = Math.floor(this.state.trimStart * sampleCount);
const endIndex = Math.floor(this.state.trimEnd * sampleCount); const endIndex = Math.floor(this.state.trimEnd * sampleCount);
const clippedSamples = samples.slice(startIndex, endIndex); if (endIndex > startIndex) { // Strictly greater to prevent 0 sample sounds
this.submitNewSamples(clippedSamples, sampleRate); const clippedSamples = samples.slice(startIndex, endIndex);
this.submitNewSamples(clippedSamples, sampleRate);
}
} }
} }
handleUpdateTrimEnd (trimEnd) { handleUpdateTrimEnd (trimEnd) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment