本文整理汇总了C++中keyfinder::AudioData::advanceReadIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioData::advanceReadIterator方法的具体用法?C++ AudioData::advanceReadIterator怎么用?C++ AudioData::advanceReadIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keyfinder::AudioData
的用法示例。
在下文中一共展示了AudioData::advanceReadIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST (AudioDataTest, Iterators) {
KeyFinder::AudioData a;
a.setChannels(1);
a.setFrameRate(1);
a.addToSampleCount(10);
a.setSample(0, 10.0);
a.setSample(1, 20.0);
a.setSample(3, 50.0);
a.resetIterators(); // this is required before each use
ASSERT_FLOAT_EQ(10.0, a.getSampleAtReadIterator());
a.setSampleAtWriteIterator(15.0);
ASSERT_FLOAT_EQ(15.0, a.getSampleAtReadIterator());
a.advanceReadIterator();
a.advanceWriteIterator();
ASSERT_FLOAT_EQ(20.0, a.getSampleAtReadIterator());
a.setSampleAtWriteIterator(25.0);
ASSERT_FLOAT_EQ(25.0, a.getSampleAtReadIterator());
a.advanceReadIterator(2);
a.advanceWriteIterator(2);
ASSERT_FLOAT_EQ(50.0, a.getSampleAtReadIterator());
a.setSampleAtWriteIterator(55.0);
ASSERT_FLOAT_EQ(55.0, a.getSampleAtReadIterator());
a.resetIterators();
ASSERT_FLOAT_EQ(15.0, a.getSampleAtReadIterator());
a.setSampleAtWriteIterator(150.0);
ASSERT_FLOAT_EQ(150.0, a.getSampleAtReadIterator());
ASSERT_TRUE(a.readIteratorWithinUpperBound());
ASSERT_TRUE(a.writeIteratorWithinUpperBound());
a.advanceReadIterator(10);
a.advanceWriteIterator(10);
ASSERT_FALSE(a.readIteratorWithinUpperBound());
ASSERT_FALSE(a.writeIteratorWithinUpperBound());
}