mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Fix Sequence test
This commit is contained in:
parent
d17f58e531
commit
454df30ae5
2 changed files with 17 additions and 16 deletions
|
|
@ -95,10 +95,6 @@ SequenceTest::controlInterpolationTest ()
|
||||||
{
|
{
|
||||||
seq->clear();
|
seq->clear();
|
||||||
|
|
||||||
for (Notes::const_iterator i = test_notes.begin(); i != test_notes.end(); ++i) {
|
|
||||||
seq->notes().insert(*i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const uint64_t delay = 1000;
|
static const uint64_t delay = 1000;
|
||||||
static const uint32_t cc_type = 1;
|
static const uint32_t cc_type = 1;
|
||||||
|
|
||||||
|
|
@ -120,22 +116,22 @@ SequenceTest::controlInterpolationTest ()
|
||||||
for (MySequence<Time>::const_iterator i = seq->begin(); i != seq->end(); ++i) {
|
for (MySequence<Time>::const_iterator i = seq->begin(); i != seq->end(); ++i) {
|
||||||
sink.write(i->time(), i->event_type(), i->size(), i->buffer());
|
sink.write(i->time(), i->event_type(), i->size(), i->buffer());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(sink.events.size() == 3);
|
CPPUNIT_ASSERT_EQUAL((size_t)3, sink.events.size());
|
||||||
CPPUNIT_ASSERT(sink.events[0].first == 0);
|
CPPUNIT_ASSERT_EQUAL(Evoral::Beats(0), sink.events[0].first);
|
||||||
CPPUNIT_ASSERT(sink.events[0].second == 0);
|
CPPUNIT_ASSERT_EQUAL((uint8_t)0, sink.events[0].second);
|
||||||
CPPUNIT_ASSERT(sink.events[1].first == 1000);
|
CPPUNIT_ASSERT_EQUAL(Evoral::Beats(1000), sink.events[1].first);
|
||||||
CPPUNIT_ASSERT(sink.events[1].second == 127);
|
CPPUNIT_ASSERT_EQUAL((uint8_t)127, sink.events[1].second);
|
||||||
CPPUNIT_ASSERT(sink.events[2].first == 2000);
|
CPPUNIT_ASSERT_EQUAL(Evoral::Beats(2000), sink.events[2].first);
|
||||||
CPPUNIT_ASSERT(sink.events[2].second == 0);
|
CPPUNIT_ASSERT_EQUAL((uint8_t)0, sink.events[2].second);
|
||||||
sink.events.clear();
|
sink.events.clear();
|
||||||
CPPUNIT_ASSERT(sink.events.size() == 0);
|
CPPUNIT_ASSERT_EQUAL((size_t)0, sink.events.size());
|
||||||
|
|
||||||
// Test linear interpolation
|
// Test linear interpolation
|
||||||
c->list()->set_interpolation(ControlList::Linear);
|
c->list()->set_interpolation(ControlList::Linear);
|
||||||
for (MySequence<Time>::const_iterator i = seq->begin(); i != seq->end(); ++i) {
|
for (MySequence<Time>::const_iterator i = seq->begin(); i != seq->end(); ++i) {
|
||||||
sink.write(i->time(), i->event_type(), i->size(), i->buffer());
|
sink.write(i->time(), i->event_type(), i->size(), i->buffer());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(sink.events.size() == 128 * 2 - 1);
|
CPPUNIT_ASSERT_EQUAL((size_t)(128 * 2 - 1), sink.events.size());
|
||||||
Time last_time(0);
|
Time last_time(0);
|
||||||
int16_t last_value = -1;
|
int16_t last_value = -1;
|
||||||
bool ascending = true;
|
bool ascending = true;
|
||||||
|
|
@ -146,11 +142,16 @@ SequenceTest::controlInterpolationTest ()
|
||||||
ascending = false;
|
ascending = false;
|
||||||
}
|
}
|
||||||
if (ascending) {
|
if (ascending) {
|
||||||
CPPUNIT_ASSERT(i->second == last_value + 1);
|
CPPUNIT_ASSERT_EQUAL((int)i->second, last_value + 1);
|
||||||
} else {
|
} else {
|
||||||
CPPUNIT_ASSERT(i->second == last_value - 1);
|
CPPUNIT_ASSERT_EQUAL((int)i->second, last_value - 1);
|
||||||
}
|
}
|
||||||
last_time = i->first;
|
last_time = i->first;
|
||||||
last_value = i->second;
|
last_value = i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add some notes
|
||||||
|
for (Notes::const_iterator i = test_notes.begin(); i != test_notes.end(); ++i) {
|
||||||
|
seq->notes().insert(*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public:
|
||||||
|
|
||||||
virtual uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf) {
|
virtual uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf) {
|
||||||
if (type == cc_type) {
|
if (type == cc_type) {
|
||||||
CPPUNIT_ASSERT(size == 3);
|
CPPUNIT_ASSERT_EQUAL((uint32_t)3, size);
|
||||||
events.push_back(std::make_pair(time, buf[2]));
|
events.push_back(std::make_pair(time, buf[2]));
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue