fix double promotions
Found with -Wdouble-promotion Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -76,9 +76,9 @@ PreparedLameEncoder::PreparedLameEncoder(const ConfigBlock &block)
|
||||
if (value != nullptr) {
|
||||
/* a quality was configured (VBR) */
|
||||
|
||||
quality = ParseDouble(value, &endptr);
|
||||
quality = float(ParseDouble(value, &endptr));
|
||||
|
||||
if (*endptr != '\0' || quality < -1.0 || quality > 10.0)
|
||||
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
|
||||
throw FormatRuntimeError("quality \"%s\" is not a number in the "
|
||||
"range -1 to 10",
|
||||
value);
|
||||
@@ -110,13 +110,13 @@ static void
|
||||
lame_encoder_setup(lame_global_flags *gfp, float quality, int bitrate,
|
||||
const AudioFormat &audio_format)
|
||||
{
|
||||
if (quality >= -1.0) {
|
||||
if (quality >= -1.0f) {
|
||||
/* a quality was configured (VBR) */
|
||||
|
||||
if (0 != lame_set_VBR(gfp, vbr_rh))
|
||||
throw std::runtime_error("error setting lame VBR mode");
|
||||
|
||||
if (0 != lame_set_VBR_q(gfp, quality))
|
||||
if (0 != lame_set_VBR_q(gfp, int(quality)))
|
||||
throw std::runtime_error("error setting lame VBR quality");
|
||||
} else {
|
||||
/* a bit rate was configured */
|
||||
|
@@ -94,9 +94,9 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block)
|
||||
if (value != nullptr) {
|
||||
/* a quality was configured (VBR) */
|
||||
|
||||
quality = ParseDouble(value, &endptr);
|
||||
quality = float(ParseDouble(value, &endptr));
|
||||
|
||||
if (*endptr != '\0' || quality < -1.0 || quality > 10.0)
|
||||
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
|
||||
throw FormatRuntimeError("quality \"%s\" is not a number in the "
|
||||
"range -1 to 10",
|
||||
value);
|
||||
@@ -131,7 +131,7 @@ static void
|
||||
twolame_encoder_setup(twolame_options *options, float quality, int bitrate,
|
||||
const AudioFormat &audio_format)
|
||||
{
|
||||
if (quality >= -1.0) {
|
||||
if (quality >= -1.0f) {
|
||||
/* a quality was configured (VBR) */
|
||||
|
||||
if (0 != twolame_set_VBR(options, true))
|
||||
|
@@ -84,7 +84,7 @@ PreparedVorbisEncoder::PreparedVorbisEncoder(const ConfigBlock &block)
|
||||
char *endptr;
|
||||
quality = ParseDouble(value, &endptr);
|
||||
|
||||
if (*endptr != '\0' || quality < -1.0 || quality > 10.0)
|
||||
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
|
||||
throw FormatRuntimeError("quality \"%s\" is not a number in the "
|
||||
"range -1 to 10",
|
||||
value);
|
||||
@@ -122,13 +122,13 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
|
||||
_audio_format.format = SampleFormat::FLOAT;
|
||||
audio_format = _audio_format;
|
||||
|
||||
if (quality >= -1.0) {
|
||||
if (quality >= -1.0f) {
|
||||
/* a quality was configured (VBR) */
|
||||
|
||||
if (0 != vorbis_encode_init_vbr(&vi,
|
||||
audio_format.channels,
|
||||
audio_format.sample_rate,
|
||||
quality * 0.1)) {
|
||||
quality * 0.1f)) {
|
||||
vorbis_info_clear(&vi);
|
||||
throw std::runtime_error("error initializing vorbis vbr");
|
||||
}
|
||||
@@ -138,7 +138,7 @@ VorbisEncoder::VorbisEncoder(float quality, int bitrate,
|
||||
if (0 != vorbis_encode_init(&vi,
|
||||
audio_format.channels,
|
||||
audio_format.sample_rate, -1.0,
|
||||
bitrate * 1000, -1.0)) {
|
||||
bitrate * 1000, -1.0f)) {
|
||||
vorbis_info_clear(&vi);
|
||||
throw std::runtime_error("error initializing vorbis encoder");
|
||||
}
|
||||
|
Reference in New Issue
Block a user