Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1382:2df1af7ac752 spectrogramparam
Add oversampling option to spectrum as well
author | Chris Cannam |
---|---|
date | Wed, 07 Nov 2018 11:37:51 +0000 |
parents | b6cca362bbf4 |
children | ba1f0234efa7 |
comparison
equal
deleted
inserted
replaced
1381:2f4476993ae6 | 1382:2df1af7ac752 |
---|---|
739 | 739 |
740 void | 740 void |
741 SpectrogramLayer::setWindowSize(int ws) | 741 SpectrogramLayer::setWindowSize(int ws) |
742 { | 742 { |
743 if (m_windowSize == ws) return; | 743 if (m_windowSize == ws) return; |
744 | |
745 invalidateRenderers(); | 744 invalidateRenderers(); |
746 | |
747 m_windowSize = ws; | 745 m_windowSize = ws; |
748 | |
749 recreateFFTModel(); | 746 recreateFFTModel(); |
750 | |
751 emit layerParametersChanged(); | 747 emit layerParametersChanged(); |
752 } | 748 } |
753 | 749 |
754 int | 750 int |
755 SpectrogramLayer::getWindowSize() const | 751 SpectrogramLayer::getWindowSize() const |
759 | 755 |
760 void | 756 void |
761 SpectrogramLayer::setWindowHopLevel(int v) | 757 SpectrogramLayer::setWindowHopLevel(int v) |
762 { | 758 { |
763 if (m_windowHopLevel == v) return; | 759 if (m_windowHopLevel == v) return; |
764 | |
765 invalidateRenderers(); | 760 invalidateRenderers(); |
766 | |
767 m_windowHopLevel = v; | 761 m_windowHopLevel = v; |
768 | |
769 recreateFFTModel(); | 762 recreateFFTModel(); |
770 | |
771 emit layerParametersChanged(); | 763 emit layerParametersChanged(); |
772 } | 764 } |
773 | 765 |
774 int | 766 int |
775 SpectrogramLayer::getWindowHopLevel() const | 767 SpectrogramLayer::getWindowHopLevel() const |
2536 QString s; | 2528 QString s; |
2537 | 2529 |
2538 s += QString("channel=\"%1\" " | 2530 s += QString("channel=\"%1\" " |
2539 "windowSize=\"%2\" " | 2531 "windowSize=\"%2\" " |
2540 "windowHopLevel=\"%3\" " | 2532 "windowHopLevel=\"%3\" " |
2541 "gain=\"%4\" " | 2533 "oversampling=\"%4\" " |
2542 "threshold=\"%5\" ") | 2534 "gain=\"%5\" " |
2535 "threshold=\"%6\" ") | |
2543 .arg(m_channel) | 2536 .arg(m_channel) |
2544 .arg(m_windowSize) | 2537 .arg(m_windowSize) |
2545 .arg(m_windowHopLevel) | 2538 .arg(m_windowHopLevel) |
2539 .arg(m_oversampling) | |
2546 .arg(m_gain) | 2540 .arg(m_gain) |
2547 .arg(m_threshold); | 2541 .arg(m_threshold); |
2548 | 2542 |
2549 s += QString("minFrequency=\"%1\" " | 2543 s += QString("minFrequency=\"%1\" " |
2550 "maxFrequency=\"%2\" " | 2544 "maxFrequency=\"%2\" " |
2619 else if (windowOverlap == 75) setWindowHopLevel(3); | 2613 else if (windowOverlap == 75) setWindowHopLevel(3); |
2620 else if (windowOverlap == 90) setWindowHopLevel(4); | 2614 else if (windowOverlap == 90) setWindowHopLevel(4); |
2621 } | 2615 } |
2622 } | 2616 } |
2623 | 2617 |
2618 int oversampling = attributes.value("oversampling").toUInt(&ok); | |
2619 if (ok) setOversampling(oversampling); | |
2620 | |
2624 float gain = attributes.value("gain").toFloat(&ok); | 2621 float gain = attributes.value("gain").toFloat(&ok); |
2625 if (ok) setGain(gain); | 2622 if (ok) setGain(gain); |
2626 | 2623 |
2627 float threshold = attributes.value("threshold").toFloat(&ok); | 2624 float threshold = attributes.value("threshold").toFloat(&ok); |
2628 if (ok) setThreshold(threshold); | 2625 if (ok) setThreshold(threshold); |