本文整理汇总了C++中keyfinder::AudioData::addToFrameCount方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioData::addToFrameCount方法的具体用法?C++ AudioData::addToFrameCount怎么用?C++ AudioData::addToFrameCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keyfinder::AudioData
的用法示例。
在下文中一共展示了AudioData::addToFrameCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST (AudioDataTest, PrependToInitialised) {
KeyFinder::AudioData a;
KeyFinder::AudioData b;
a.setChannels(1);
a.setFrameRate(1);
ASSERT_THROW(a.prepend(b), KeyFinder::Exception);
b.setChannels(2);
b.setFrameRate(1);
ASSERT_THROW(a.prepend(b), KeyFinder::Exception);
b.setChannels(1);
b.setFrameRate(2);
ASSERT_THROW(a.prepend(b), KeyFinder::Exception);
b.setChannels(1);
b.setFrameRate(1);
ASSERT_NO_THROW(a.prepend(b));
a.addToFrameCount(1);
b.addToFrameCount(1);
a.setSampleByFrame(0, 0, 10.0);
b.setSampleByFrame(0, 0, 20.0);
a.prepend(b);
ASSERT_EQ(2, a.getFrameCount());
ASSERT_FLOAT_EQ(20.0, a.getSampleByFrame(0, 0));
ASSERT_FLOAT_EQ(10.0, a.getSampleByFrame(1, 0));
}
示例2: while
TEST (AudioDataTest, SliceFromBack) {
KeyFinder::AudioData a;
a.setChannels(1);
a.setFrameRate(1);
KeyFinder::AudioData* b = NULL;
KeyFinder::AudioData* nullPtr = NULL;
ASSERT_THROW(b = a.sliceSamplesFromBack(1), KeyFinder::Exception);
ASSERT_EQ(nullPtr, b);
a.addToFrameCount(10);
ASSERT_THROW(b = a.sliceSamplesFromBack(11), KeyFinder::Exception);
ASSERT_EQ(nullPtr, b);
a.resetIterators();
float v = 0;
while (a.writeIteratorWithinUpperBound()) {
a.setSampleAtWriteIterator(v);
a.advanceWriteIterator();
v += 1.0;
}
ASSERT_NO_THROW(b = a.sliceSamplesFromBack(5));
ASSERT_NE(nullPtr, b);
ASSERT_EQ(5, a.getSampleCount());
ASSERT_EQ(5, b->getSampleCount());
ASSERT_FLOAT_EQ(5.0, b->getSample(0));
ASSERT_FLOAT_EQ(9.0, b->getSample(4));
delete b;
}