comparison data/model/ReadOnlyWaveFileModel.cpp @ 1313:ff9697592bef 3.0-integration

Add gapless preference to prefs dialog; much work on audio read tests
author Chris Cannam
date Thu, 01 Dec 2016 17:45:40 +0000
parents c97a28a3baeb
children d4a28d1479a8 54af1e21705c
comparison
equal deleted inserted replaced
1312:079e553dc16e 1313:ff9697592bef
51 m_exiting(false), 51 m_exiting(false),
52 m_lastDirectReadStart(0), 52 m_lastDirectReadStart(0),
53 m_lastDirectReadCount(0) 53 m_lastDirectReadCount(0)
54 { 54 {
55 m_source.waitForData(); 55 m_source.waitForData();
56
56 if (m_source.isOK()) { 57 if (m_source.isOK()) {
57 bool normalise = Preferences::getInstance()->getNormaliseAudio(); 58
58 m_reader = AudioFileReaderFactory::createThreadingReader 59 Preferences *prefs = Preferences::getInstance();
59 (m_source, targetRate, normalise); 60
61 AudioFileReaderFactory::Parameters params;
62 params.targetRate = targetRate;
63
64 params.normalisation = prefs->getNormaliseAudio() ?
65 AudioFileReaderFactory::Normalisation::Peak :
66 AudioFileReaderFactory::Normalisation::None;
67
68 params.gaplessMode = prefs->getUseGaplessMode() ?
69 AudioFileReaderFactory::GaplessMode::Gapless :
70 AudioFileReaderFactory::GaplessMode::Gappy;
71
72 params.threadingMode = AudioFileReaderFactory::ThreadingMode::Threaded;
73
74 m_reader = AudioFileReaderFactory::createReader(m_source, params);
60 if (m_reader) { 75 if (m_reader) {
61 SVDEBUG << "ReadOnlyWaveFileModel::ReadOnlyWaveFileModel: reader rate: " 76 SVDEBUG << "ReadOnlyWaveFileModel::ReadOnlyWaveFileModel: reader rate: "
62 << m_reader->getSampleRate() << endl; 77 << m_reader->getSampleRate() << endl;
63 } 78 }
64 } 79 }
80
65 if (m_reader) setObjectName(m_reader->getTitle()); 81 if (m_reader) setObjectName(m_reader->getTitle());
66 if (objectName() == "") setObjectName(QFileInfo(m_path).fileName()); 82 if (objectName() == "") setObjectName(QFileInfo(m_path).fileName());
67 if (isOK()) fillCache(); 83 if (isOK()) fillCache();
68 } 84 }
69 85