Skip to content
Permalink
Browse files

Incorrectly assumed SF_FORMAT_* subtypes were flags.

In my patch for #971 I tried to enable clipping for formats that
are not float and not vorbis (which is float by default) but checked
them like they were flags. This caused clipping to never actually
enable for formats whose submask contained at least one bit similar
to either the float or vorbis type.

This patch uses SF_FORMAT_SUBMASK and a straight comparison instead
and should fix this issue.
  • Loading branch information...
hacst committed Feb 25, 2015
1 parent edd5509 commit 1c00533b091b683cfa25b218da69afcb0360284c
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/mumble/VoiceRecorder.cpp
@@ -307,8 +307,8 @@ bool VoiceRecorder::ensureFileIsOpenedFor(SF_INFO& soundFileInfo, boost::shared_
sf_set_string(ri->soundFile, SF_STR_TITLE, qPrintable(ri->userName));

// Enable hard-clipping for non-float formats to prevent wrapping
if (!(soundFileInfo.format & SF_FORMAT_FLOAT) &&
!(soundFileInfo.format & SF_FORMAT_VORBIS)) {
if ((soundFileInfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_FLOAT &&
(soundFileInfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_VORBIS) {

sf_command(ri->soundFile, SFC_SET_CLIPPING, NULL, SF_TRUE);
}

0 comments on commit 1c00533

Please sign in to comment.
You can’t perform that action at this time.