comparison audio/AudioCallbackPlaySource.cpp @ 542:167d37937436 3.0-integration

Remove resampler quality option (#1760)
author Chris Cannam
date Mon, 05 Dec 2016 16:39:03 +0000
parents 0d5c3abc9658
children 699db455a3e1 c4391f6c7484
comparison
equal deleted inserted replaced
540:0d5c3abc9658 542:167d37937436
76 m_stretchMono(false), 76 m_stretchMono(false),
77 m_stretcherInputCount(0), 77 m_stretcherInputCount(0),
78 m_stretcherInputs(0), 78 m_stretcherInputs(0),
79 m_stretcherInputSizes(0), 79 m_stretcherInputSizes(0),
80 m_fillThread(0), 80 m_fillThread(0),
81 m_converter(0), 81 m_converter(0)
82 m_resampleQuality(Preferences::getInstance()->getResampleQuality())
83 { 82 {
84 m_viewManager->setAudioPlaySource(this); 83 m_viewManager->setAudioPlaySource(this);
85 84
86 connect(m_viewManager, SIGNAL(selectionChanged()), 85 connect(m_viewManager, SIGNAL(selectionChanged()),
87 this, SLOT(selectionChanged())); 86 this, SLOT(selectionChanged()));
557 } 556 }
558 557
559 void 558 void
560 AudioCallbackPlaySource::preferenceChanged(PropertyContainer::PropertyName n) 559 AudioCallbackPlaySource::preferenceChanged(PropertyContainer::PropertyName n)
561 { 560 {
562 if (n == "Resample Quality") {
563 setResampleQuality(Preferences::getInstance()->getResampleQuality());
564 }
565 } 561 }
566 562
567 void 563 void
568 AudioCallbackPlaySource::audioProcessingOverload() 564 AudioCallbackPlaySource::audioProcessingOverload()
569 { 565 {
975 971
976 if (getSourceSampleRate() != getTargetSampleRate()) { 972 if (getSourceSampleRate() != getTargetSampleRate()) {
977 973
978 int err = 0; 974 int err = 0;
979 975
980 m_converter = src_new(m_resampleQuality == 2 ? SRC_SINC_BEST_QUALITY : 976 m_converter = src_new(SRC_SINC_FASTEST, getTargetChannelCount(), &err);
981 m_resampleQuality == 1 ? SRC_SINC_MEDIUM_QUALITY :
982 m_resampleQuality == 0 ? SRC_SINC_FASTEST :
983 SRC_SINC_MEDIUM_QUALITY,
984 getTargetChannelCount(), &err);
985 977
986 if (!m_converter) { 978 if (!m_converter) {
987 cerr << "AudioCallbackPlaySource::setModel: ERROR in creating samplerate converter: " 979 cerr << "AudioCallbackPlaySource::setModel: ERROR in creating samplerate converter: "
988 << src_strerror(err) << endl; 980 << src_strerror(err) << endl;
989 981
1001 true); 993 true);
1002 } 994 }
1003 } else { 995 } else {
1004 m_mutex.unlock(); 996 m_mutex.unlock();
1005 } 997 }
1006 }
1007
1008 void
1009 AudioCallbackPlaySource::setResampleQuality(int q)
1010 {
1011 if (q == m_resampleQuality) return;
1012 m_resampleQuality = q;
1013
1014 #ifdef DEBUG_AUDIO_PLAY_SOURCE
1015 SVDEBUG << "AudioCallbackPlaySource::setResampleQuality: setting to "
1016 << m_resampleQuality << endl;
1017 #endif
1018
1019 initialiseConverter();
1020 } 998 }
1021 999
1022 void 1000 void
1023 AudioCallbackPlaySource::setAuditioningEffect(Auditionable *a) 1001 AudioCallbackPlaySource::setAuditioningEffect(Auditionable *a)
1024 { 1002 {