From f4f8194dc67deecf24dd30e3caa605a5eb5df725 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 3 Dec 2020 14:58:06 -0500 Subject: [PATCH] Bug2606: Import shouldn't be lossy or narrower than Quality pref --- src/import/ImportFFmpeg.cpp | 2 +- src/import/ImportMP3.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index 24814b193..f5f7177c4 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -516,7 +516,7 @@ ProgressResult FFmpegImportFileHandle::Import(WaveTrackFactory *trackFactory, sc->m_initialchannels = sc->m_stream->codec->channels; stream.resize(sc->m_stream->codec->channels); for (auto &channel : stream) - channel = trackFactory->NewWaveTrack(sc->m_osamplefmt, sc->m_stream->codec->sample_rate); + channel = NewWaveTrack(*trackFactory, sc->m_osamplefmt, sc->m_stream->codec->sample_rate); } // Handles the start_time by creating silence. This may or may not be correct. diff --git a/src/import/ImportMP3.cpp b/src/import/ImportMP3.cpp index 4529247ff..0f66adabf 100644 --- a/src/import/ImportMP3.cpp +++ b/src/import/ImportMP3.cpp @@ -64,7 +64,6 @@ static Importer::RegisteredUnusableImportPlugin registered #include "../Prefs.h" #include "../Tags.h" #include "../WaveTrack.h" -#include "../prefs/QualityPrefs.h" #include "../widgets/AudacityMessageBox.h" #include "../widgets/ProgressDialog.h" @@ -1034,11 +1033,12 @@ enum mad_flow MP3ImportFileHandle::OutputCB(struct mad_header const * WXUNUSED(h mChannels.resize(mNumChannels); - auto format = QualityPrefs::SampleFormatChoice(); - for (auto &channel: mChannels) { - channel = mTrackFactory->NewWaveTrack(format, pcm->samplerate); + // Mad library header explains the 32 bit fixed point format with + // 28 fractional bits. Effective sample format must therefore be + // more than 24, and this is our only choice now. + channel = NewWaveTrack(*mTrackFactory, floatSample, pcm->samplerate); } }