Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/effects/builtin/balanceeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace {
const double kMaxCornerHz = 500;
const double kMinCornerHz = 16;
const unsigned int kStartupSamplerate = 44100;
} // anonymous namespace

// static
Expand Down
1 change: 0 additions & 1 deletion src/effects/builtin/moogladder4filtereffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

static const double kMinCorner = 0.0003; // 13 Hz @ 44100
static const double kMaxCorner = 0.5; // 22050 Hz @ 44100
static const unsigned int kStartupSamplerate = 44100;

// static
QString MoogLadder4FilterEffect::getId() {
Expand Down
40 changes: 28 additions & 12 deletions src/sources/soundsourcemp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,20 @@ SoundSource::OpenResult SoundSourceMp3::tryOpen(
}

const ChannelCount madChannelCount(MAD_NCHANNELS(&madHeader));
if (maxChannelCount.valid() && (madChannelCount != maxChannelCount)) {
kLogger.warning() << "Differing number of channels"
<< madChannelCount << "<>" << maxChannelCount
<< "in some MP3 frame headers:"
if (madChannelCount.valid()) {
if (maxChannelCount.valid() && (madChannelCount != maxChannelCount)) {
kLogger.warning()
<< "Differing number of channels"
<< madChannelCount << "<>" << maxChannelCount
<< "in MP3 frame headers:"
<< m_file.fileName();
}
maxChannelCount = math_max(madChannelCount, maxChannelCount);
} else {
kLogger.warning()
<< "Missing number of channels in MP3 frame header:"
<< m_file.fileName();
}
maxChannelCount = math_max(madChannelCount, maxChannelCount);

const int sampleRateIndex = getIndexBySampleRate(SampleRate(madSampleRate));
if (sampleRateIndex >= kSampleRateCount) {
Expand Down Expand Up @@ -321,7 +328,7 @@ SoundSource::OpenResult SoundSourceMp3::tryOpen(

if (m_seekFrameList.empty()) {
// This is not a working MP3 file.
kLogger.warning() << "SSMP3: This is not a working MP3 file:"
kLogger.warning() << "This is not a working MP3 file:"
<< m_file.fileName();
// Abort
return OpenResult::Failed;
Expand Down Expand Up @@ -354,15 +361,24 @@ SoundSource::OpenResult SoundSourceMp3::tryOpen(
kLogger.warning() << "Mixxx tries to plays it with the most common sample rate for this file";
}

if (mostCommonSampleRateIndex < kSampleRateCount) {
setSampleRate(getSampleRateByIndex(mostCommonSampleRateIndex));
} else {
kLogger.warning() << "No single valid sample rate in header";
// Initialize the AudioSource
if (mostCommonSampleRateIndex > kSampleRateCount) {
kLogger.warning()
<< "Unknown sample rate in MP3 file:"
<< m_file.fileName();
// Abort
return OpenResult::Failed;
}
setSampleRate(getSampleRateByIndex(mostCommonSampleRateIndex));
if (!maxChannelCount.valid() || (maxChannelCount > kChannelCountMax)) {
kLogger.warning()
<< "Invalid number of channels"
<< maxChannelCount
<< "in MP3 file:"
<< m_file.fileName();
// Abort
return OpenResult::Failed;
}

// Initialize the AudioSource
setChannelCount(maxChannelCount);
initFrameIndexRangeOnce(IndexRange::forward(0, m_curFrameIndex));

Expand Down
16 changes: 12 additions & 4 deletions src/util/denormalsarezero.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

#ifndef DENORMALSAREZERO_H
#define DENORMALSAREZERO_H
#pragma once

// This was copied from the gcc header pmmintrin.h which requires SSE3
// According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21408
Expand All @@ -12,18 +11,29 @@
// See: https://software.intel.com/en-us/articles/x87-and-sse-floating-point-assists-in-ia-32-flush-to-zero-ftz-and-denormals-are-zero-daz

/* Additional bits in the MXCSR. */
#if !defined(_MM_DENORMALS_ZERO_MASK)
#define _MM_DENORMALS_ZERO_MASK 0x0040
#endif
#if !defined(_MM_DENORMALS_ZERO_ON)
#define _MM_DENORMALS_ZERO_ON 0x0040
#endif
#if !defined(_MM_DENORMALS_ZERO_OFF)
#define _MM_DENORMALS_ZERO_OFF 0x0000
#endif

#ifdef __SSE__

#include <xmmintrin.h>

#if !defined(_MM_SET_DENORMALS_ZERO_MODE)
#define _MM_SET_DENORMALS_ZERO_MODE(mode) \
_mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode))
#endif

#if !defined(_MM_GET_DENORMALS_ZERO_MODE)
#define _MM_GET_DENORMALS_ZERO_MODE() \
(_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
#endif

#else

Expand All @@ -35,5 +45,3 @@
#define _MM_GET_DENORMALS_ZERO_MODE()

#endif

#endif /* DENORMALSAREZERO_H */