Skip to content

Commit

Permalink
CMS: Do proper clipping of the sound data on generation.
Browse files Browse the repository at this point in the history
This fixes some overflows/underflows which resulted in crackling.
  • Loading branch information
Johannes Schickel committed Aug 9, 2011
1 parent 7456027 commit b95bbb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions audio/softsynth/cms.cpp
Expand Up @@ -244,8 +244,8 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) {
}
}
/* write sound data to the buffer */
buffer[j*2] += output_l / 6;
buffer[j*2+1] += output_r / 6;
buffer[j*2+0] = CLIP<int>(buffer[j*2+0] + output_l / 6, -32768, 32767);
buffer[j*2+1] = CLIP<int>(buffer[j*2+1] + output_r / 6, -32768, 32767);
}
}

Expand Down

0 comments on commit b95bbb2

Please sign in to comment.