Add getProcessSizeLimit
This commit is contained in:
@@ -805,10 +805,10 @@ public:
|
|||||||
*
|
*
|
||||||
* Despite the existence of this call and its use of a size_t
|
* Despite the existence of this call and its use of a size_t
|
||||||
* argument, there is an internal limit to the maximum process
|
* argument, there is an internal limit to the maximum process
|
||||||
* buffer size that can be requested. This is currently 524288 (or
|
* buffer size that can be requested. Call getProcessSizeLimit()
|
||||||
* 2^19). The Rubber Band API is essentially block-based and is
|
* to query that limit. The Rubber Band API is essentially
|
||||||
* not designed to process an entire signal within a single
|
* block-based and is not designed to process an entire signal
|
||||||
* process cycle.
|
* within a single process cycle.
|
||||||
*
|
*
|
||||||
* Note that the value of "samples" refers to the number of audio
|
* Note that the value of "samples" refers to the number of audio
|
||||||
* sample frames, which may be multi-channel, not the number of
|
* sample frames, which may be multi-channel, not the number of
|
||||||
@@ -818,6 +818,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setMaxProcessSize(size_t samples);
|
void setMaxProcessSize(size_t samples);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the overall maximum supported process buffer size in
|
||||||
|
* sample frames, which is also the maximum acceptable value to
|
||||||
|
* pass to setMaxProcessSize(). This value is fixed across
|
||||||
|
* instances and configurations. As of Rubber Band v3.3 it is
|
||||||
|
* always 524288 (or 2^19), but in principle it may change in
|
||||||
|
* future releases.
|
||||||
|
*/
|
||||||
|
size_t getProcessSizeLimit() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the stretcher how many audio sample frames should be
|
* Ask the stretcher how many audio sample frames should be
|
||||||
* provided as input in order to ensure that some more output
|
* provided as input in order to ensure that some more output
|
||||||
|
|||||||
@@ -226,6 +226,13 @@ public:
|
|||||||
else m_r3->setMaxProcessSize(samples);
|
else m_r3->setMaxProcessSize(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
getProcessSizeLimit() const
|
||||||
|
{
|
||||||
|
if (m_r2) return m_r2->getProcessSizeLimit();
|
||||||
|
else return m_r3->getProcessSizeLimit();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
||||||
{
|
{
|
||||||
@@ -492,6 +499,12 @@ RubberBandStretcher::setMaxProcessSize(size_t samples)
|
|||||||
m_d->setMaxProcessSize(samples);
|
m_d->setMaxProcessSize(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
RubberBandStretcher::getProcessSizeLimit() const
|
||||||
|
{
|
||||||
|
return m_d->getProcessSizeLimit();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RubberBandStretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
RubberBandStretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -316,6 +316,12 @@ R2Stretcher::setMaxProcessSize(size_t samples)
|
|||||||
reconfigure();
|
reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
R2Stretcher::getProcessSizeLimit() const
|
||||||
|
{
|
||||||
|
return 524288;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R2Stretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
R2Stretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public:
|
|||||||
|
|
||||||
void setExpectedInputDuration(size_t samples);
|
void setExpectedInputDuration(size_t samples);
|
||||||
void setMaxProcessSize(size_t samples);
|
void setMaxProcessSize(size_t samples);
|
||||||
|
size_t getProcessSizeLimit() const;
|
||||||
void setKeyFrameMap(const std::map<size_t, size_t> &);
|
void setKeyFrameMap(const std::map<size_t, size_t> &);
|
||||||
|
|
||||||
size_t getSamplesRequired() const;
|
size_t getSamplesRequired() const;
|
||||||
|
|||||||
@@ -652,6 +652,12 @@ R3Stretcher::setMaxProcessSize(size_t requested)
|
|||||||
ensureOutbuf(n * 8, false);
|
ensureOutbuf(n * 8, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
R3Stretcher::getProcessSizeLimit() const
|
||||||
|
{
|
||||||
|
return m_limits.overallMaxProcessSize;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R3Stretcher::ensureInbuf(int required, bool warn)
|
R3Stretcher::ensureInbuf(int required, bool warn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public:
|
|||||||
|
|
||||||
void setExpectedInputDuration(size_t samples);
|
void setExpectedInputDuration(size_t samples);
|
||||||
void setMaxProcessSize(size_t samples);
|
void setMaxProcessSize(size_t samples);
|
||||||
|
size_t getProcessSizeLimit() const;
|
||||||
|
|
||||||
void setDebugLevel(int level) {
|
void setDebugLevel(int level) {
|
||||||
m_log.setDebugLevel(level);
|
m_log.setDebugLevel(level);
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ BOOST_AUTO_TEST_CASE(engine_version)
|
|||||||
{
|
{
|
||||||
RubberBandStretcher s2(44100, 1, RubberBandStretcher::OptionEngineFaster);
|
RubberBandStretcher s2(44100, 1, RubberBandStretcher::OptionEngineFaster);
|
||||||
BOOST_TEST(s2.getEngineVersion() == 2);
|
BOOST_TEST(s2.getEngineVersion() == 2);
|
||||||
|
BOOST_TEST(s2.getProcessSizeLimit() == 524288);
|
||||||
RubberBandStretcher s3(44100, 1, RubberBandStretcher::OptionEngineFiner);
|
RubberBandStretcher s3(44100, 1, RubberBandStretcher::OptionEngineFiner);
|
||||||
BOOST_TEST(s3.getEngineVersion() == 3);
|
BOOST_TEST(s3.getEngineVersion() == 3);
|
||||||
|
BOOST_TEST(s3.getProcessSizeLimit() == 524288);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(sinusoid_unchanged_offline_faster)
|
BOOST_AUTO_TEST_CASE(sinusoid_unchanged_offline_faster)
|
||||||
|
|||||||
Reference in New Issue
Block a user