summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-15 18:01:14 -0400
committerDavid Robillard <d@drobilla.net>2016-03-15 18:01:14 -0400
commitf205d626e0fbcd98f3c0459b739d6688b19b157a (patch)
tree7f5fdca6a9f7a89983c539fdf6a32e91cec90f7a /tests
parent2d66c5e98f1bbc8244d61e6f328e2a7b5671fab2 (diff)
downloadsratom-f205d626e0fbcd98f3c0459b739d6688b19b157a.tar.gz
sratom-f205d626e0fbcd98f3c0459b739d6688b19b157a.tar.bz2
sratom-f205d626e0fbcd98f3c0459b739d6688b19b157a.zip
Support sequences with beat time stamps
Based on a patch from Hanspeter Portner.
Diffstat (limited to 'tests')
-rw-r--r--tests/sratom_test.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/sratom_test.c b/tests/sratom_test.c
index 49b9357..90a81cd 100644
--- a/tests/sratom_test.c
+++ b/tests/sratom_test.c
@@ -112,7 +112,8 @@ test(bool top_level, bool pretty_numbers)
LV2_URID eg_fvector = urid_map(NULL, "http://example.org/t-fvector");
LV2_URID eg_dvector = urid_map(NULL, "http://example.org/u-dvector");
LV2_URID eg_bvector = urid_map(NULL, "http://example.org/v-bvector");
- LV2_URID eg_seq = urid_map(NULL, "http://example.org/x-seq");
+ LV2_URID eg_fseq = urid_map(NULL, "http://example.org/w-fseq");
+ LV2_URID eg_bseq = urid_map(NULL, "http://example.org/x-bseq");
uint8_t buf[1024];
lv2_atom_forge_set_buffer(&forge, buf, sizeof(buf));
@@ -248,11 +249,11 @@ test(bool top_level, bool pretty_numbers)
int32_t belems[] = { true, false };
lv2_atom_forge_vector(&forge, sizeof(int32_t), forge.Bool, 2, belems);
- // eg_seq = (Sequence)1, 2
+ // eg_fseq = (Sequence)1, 2
LV2_URID midi_midiEvent = map.map(map.handle, LV2_MIDI__MidiEvent);
- lv2_atom_forge_key(&forge, eg_seq);
- LV2_Atom_Forge_Frame seq_frame;
- lv2_atom_forge_sequence_head(&forge, &seq_frame, 0);
+ lv2_atom_forge_key(&forge, eg_fseq);
+ LV2_Atom_Forge_Frame fseq_frame;
+ lv2_atom_forge_sequence_head(&forge, &fseq_frame, 0);
const uint8_t ev1[3] = { 0x90, 0x1A, 0x1 };
lv2_atom_forge_frame_time(&forge, 1);
@@ -266,7 +267,26 @@ test(bool top_level, bool pretty_numbers)
lv2_atom_forge_raw(&forge, ev2, sizeof(ev2));
lv2_atom_forge_pad(&forge, sizeof(ev2));
- lv2_atom_forge_pop(&forge, &seq_frame);
+ lv2_atom_forge_pop(&forge, &fseq_frame);
+
+ // eg_bseq = (Sequence)1.1, 2.2
+ LV2_URID atom_beatTime = map.map(map.handle, LV2_ATOM__beatTime);
+ lv2_atom_forge_key(&forge, eg_bseq);
+ LV2_Atom_Forge_Frame bseq_frame;
+ lv2_atom_forge_sequence_head(&forge, &bseq_frame, atom_beatTime);
+
+ lv2_atom_forge_beat_time(&forge, 1.0);
+ lv2_atom_forge_atom(&forge, sizeof(ev1), midi_midiEvent);
+ lv2_atom_forge_raw(&forge, ev1, sizeof(ev1));
+ lv2_atom_forge_pad(&forge, sizeof(ev1));
+
+ lv2_atom_forge_beat_time(&forge, 2.0);
+ lv2_atom_forge_atom(&forge, sizeof(ev2), midi_midiEvent);
+ lv2_atom_forge_raw(&forge, ev2, sizeof(ev2));
+ lv2_atom_forge_pad(&forge, sizeof(ev2));
+
+ lv2_atom_forge_pop(&forge, &bseq_frame);
+
lv2_atom_forge_pop(&forge, &obj_frame);
const char* base_uri = "file:///tmp/base/";