Mercurial > hg > svapp
comparison audio/AudioGenerator.cpp @ 649:284cb118368e single-point
Further updates for new API - but we still need some more support in the API itself
author | Chris Cannam |
---|---|
date | Tue, 19 Mar 2019 13:06:58 +0000 |
parents | 3168deb50199 |
children | ed9cb577eb7c |
comparison
equal
deleted
inserted
replaced
648:eec0c50bb44f | 649:284cb118368e |
---|---|
710 | 710 |
711 for (int c = 0; c < m_targetChannelCount; ++c) { | 711 for (int c = 0; c < m_targetChannelCount; ++c) { |
712 bufferIndexes[c] = buffer[c] + i * m_processingBlockSize; | 712 bufferIndexes[c] = buffer[c] + i * m_processingBlockSize; |
713 } | 713 } |
714 | 714 |
715 SparseTimeValueModel::PointList points = | 715 EventVector points = |
716 stvm->getPoints(reqStart, reqStart + m_processingBlockSize); | 716 stvm->getEventsStartingWithin(reqStart, m_processingBlockSize); |
717 | 717 |
718 // by default, repeat last frequency | 718 // by default, repeat last frequency |
719 float f0 = 0.f; | 719 float f0 = 0.f; |
720 | 720 |
721 // go straight to the last freq that is genuinely in this range | 721 // go straight to the last freq in this range |
722 for (SparseTimeValueModel::PointList::const_iterator itr = points.end(); | 722 if (!points.empty()) { |
723 itr != points.begin(); ) { | 723 f0 = points.rbegin()->getValue(); |
724 --itr; | 724 } |
725 if (itr->frame >= reqStart && | 725 |
726 itr->frame < reqStart + m_processingBlockSize) { | 726 // if there is no such frequency and the next point is further |
727 f0 = itr->value; | |
728 break; | |
729 } | |
730 } | |
731 | |
732 // if we found no such frequency and the next point is further | |
733 // away than twice the model resolution, go silent (same | 727 // away than twice the model resolution, go silent (same |
734 // criterion TimeValueLayer uses for ending a discrete curve | 728 // criterion TimeValueLayer uses for ending a discrete curve |
735 // segment) | 729 // segment) |
730 /*!!! todo: restore | |
736 if (f0 == 0.f) { | 731 if (f0 == 0.f) { |
737 SparseTimeValueModel::PointList nextPoints = | 732 EventVector nextPoints = |
738 stvm->getNextPoints(reqStart + m_processingBlockSize); | 733 stvm->getNextPoints(reqStart + m_processingBlockSize); |
739 if (nextPoints.empty() || | 734 if (nextPoints.empty() || |
740 nextPoints.begin()->frame > reqStart + 2 * stvm->getResolution()) { | 735 nextPoints.begin()->frame > reqStart + 2 * stvm->getResolution()) { |
741 f0 = -1.f; | 736 f0 = -1.f; |
742 } | 737 } |
743 } | 738 } |
744 | 739 */ |
745 // cerr << "f0 = " << f0 << endl; | 740 // cerr << "f0 = " << f0 << endl; |
746 | 741 |
747 synth->mix(bufferIndexes, | 742 synth->mix(bufferIndexes, |
748 gain, | 743 gain, |
749 pan, | 744 pan, |