# HG changeset patch # User Chris Cannam # Date 1539096926 -3600 # Node ID 7eafe977a1fc8ae71030d1744d9c6e8559a92066 # Parent 5bc9f91445053a363c5555239c5e44d4f8ea2bd8# Parent 51ecc3e2d71c7c7f6c35384dd2f7c3eaa3989085 Merge from default branch diff -r 5bc9f9144505 -r 7eafe977a1fc framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Tue Oct 09 12:53:23 2018 +0100 +++ b/framework/MainWindowBase.cpp Tue Oct 09 15:55:26 2018 +0100 @@ -1452,7 +1452,8 @@ } MainWindowBase::FileOpenStatus -MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, +MainWindowBase::openAudio(FileSource source, + AudioFileOpenMode mode, QString templateName) { SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ") with mode " << mode << " and template " << templateName << endl; @@ -1478,14 +1479,27 @@ sv_samplerate_t rate = 0; + SVDEBUG << "Checking whether to preserve incoming audio file's sample rate" + << endl; + if (Preferences::getInstance()->getFixedSampleRate() != 0) { rate = Preferences::getInstance()->getFixedSampleRate(); + SVDEBUG << "No: preferences specify fixed rate of " << rate << endl; } else if (Preferences::getInstance()->getResampleOnLoad()) { if (getMainModel()) { - rate = getMainModel()->getSampleRate(); + if (mode == ReplaceSession || mode == ReplaceMainModel) { + SVDEBUG << "Preferences specify resampling additional models to match main model, but we are opening this file to replace the main model according to the open mode: therefore..." << endl; + } else { + rate = getMainModel()->getSampleRate(); + SVDEBUG << "No: preferences specify resampling to match main model, whose rate is currently " << rate << endl; + } } } + if (rate == 0) { + SVDEBUG << "Yes, preserving incoming file rate" << endl; + } + ReadOnlyWaveFileModel *newModel = new ReadOnlyWaveFileModel(source, rate); if (!newModel->isOK()) {