Merge from default branch

This commit is contained in:
Chris Cannam
2023-10-26 15:09:36 +01:00
14 changed files with 79 additions and 17 deletions

View File

@@ -226,6 +226,13 @@ public:
else m_r3->setMaxProcessSize(samples);
}
size_t
getProcessSizeLimit() const
{
if (m_r2) return m_r2->getProcessSizeLimit();
else return m_r3->getProcessSizeLimit();
}
void
setKeyFrameMap(const std::map<size_t, size_t> &mapping)
{
@@ -492,6 +499,12 @@ RubberBandStretcher::setMaxProcessSize(size_t samples)
m_d->setMaxProcessSize(samples);
}
size_t
RubberBandStretcher::getProcessSizeLimit() const
{
return m_d->getProcessSizeLimit();
}
void
RubberBandStretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
{

View File

@@ -316,6 +316,12 @@ R2Stretcher::setMaxProcessSize(size_t samples)
reconfigure();
}
size_t
R2Stretcher::getProcessSizeLimit() const
{
return 524288;
}
void
R2Stretcher::setKeyFrameMap(const std::map<size_t, size_t> &mapping)
{

View File

@@ -73,6 +73,7 @@ public:
void setExpectedInputDuration(size_t samples);
void setMaxProcessSize(size_t samples);
size_t getProcessSizeLimit() const;
void setKeyFrameMap(const std::map<size_t, size_t> &);
size_t getSamplesRequired() const;

View File

@@ -652,6 +652,12 @@ R3Stretcher::setMaxProcessSize(size_t requested)
ensureOutbuf(n * 8, false);
}
size_t
R3Stretcher::getProcessSizeLimit() const
{
return m_limits.overallMaxProcessSize;
}
void
R3Stretcher::ensureInbuf(int required, bool warn)
{

View File

@@ -93,6 +93,7 @@ public:
void setExpectedInputDuration(size_t samples);
void setMaxProcessSize(size_t samples);
size_t getProcessSizeLimit() const;
void setDebugLevel(int level) {
m_log.setDebugLevel(level);

View File

@@ -143,6 +143,11 @@ void rubberband_set_max_process_size(RubberBandState state, unsigned int samples
state->m_s->setMaxProcessSize(samples);
}
unsigned int rubberband_get_process_size_limit(RubberBandState state)
{
return state->m_s->getProcessSizeLimit();
}
void rubberband_set_key_frame_map(RubberBandState state, unsigned int keyframecount, unsigned int *from, unsigned int *to)
{
std::map<size_t, size_t> kfm;

View File

@@ -46,8 +46,10 @@ BOOST_AUTO_TEST_CASE(engine_version)
{
RubberBandStretcher s2(44100, 1, RubberBandStretcher::OptionEngineFaster);
BOOST_TEST(s2.getEngineVersion() == 2);
BOOST_TEST(s2.getProcessSizeLimit() == 524288);
RubberBandStretcher s3(44100, 1, RubberBandStretcher::OptionEngineFiner);
BOOST_TEST(s3.getEngineVersion() == 3);
BOOST_TEST(s3.getProcessSizeLimit() == 524288);
}
BOOST_AUTO_TEST_CASE(sinusoid_unchanged_offline_faster)
@@ -1006,7 +1008,7 @@ static void impulses_realtime(RubberBandStretcher::Options options,
BOOST_TEST(peak1 > int(ceil(4640 * timeRatio)));
BOOST_TEST(peak2 < int(ceil(9970 * timeRatio)));
BOOST_TEST(peak2 > int(ceil(9770 * timeRatio)));
BOOST_TEST(peak2 > int(ceil(9670 * timeRatio)));
if (printDebug) {
std::cout << "#sample\tV" << std::endl;