forked from libxmp/libxmp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_effect_ed_delay.c
More file actions
134 lines (106 loc) · 3.93 KB
/
Copy pathtest_effect_ed_delay.c
File metadata and controls
134 lines (106 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include "test.h"
#include "../src/mixer.h"
#include "../src/virtual.h"
TEST(test_effect_ed_delay)
{
xmp_context opaque;
struct context_data *ctx;
struct player_data *p;
struct mixer_voice *vi;
int voc;
opaque = xmp_create_context();
ctx = (struct context_data *)opaque;
p = &ctx->p;
create_simple_module(ctx, 2, 2);
new_event(ctx, 0, 0, 0, 60, 2, 40, 0x0f, 0x02, 0, 0);
new_event(ctx, 0, 1, 0, 61, 1, 0, 0, 0, 0x0e, 0xd0);
new_event(ctx, 0, 2, 0, 62, 2, 0, 0x0e, 0xd1, 0, 0);
new_event(ctx, 0, 3, 0, 63, 2, 0, 0, 0, 0x0e, 0xd3);
new_event(ctx, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0);
new_event(ctx, 0, 5, 0, 0, 0, 0, 0, 0, 0x0e, 0xd1);
new_event(ctx, 0, 6, 0, 0, 0, 0, 0, 0, 0x0e, 0xd1);
new_event(ctx, 0, 7, 0, 0, 0, 0, 0, 0, 0x0e, 0xd0);
new_event(ctx, 0, 8, 0, 0, 3, 0, 0, 0, 0, 0);
new_event(ctx, 0, 9, 0, 0, 0, 0, 0, 0, 0x0e, 0xd1);
xmp_start_player(opaque, 44100, 0);
/* Row 0 */
xmp_play_frame(opaque);
voc = map_channel(p, 0);
fail_unless(voc >= 0, "virtual map");
vi = &p->virt.voice_array[voc];
fail_unless(vi->note == 59, "row 0 frame 0");
fail_unless(vi->pos0 == 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 59, "row 0 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Row 1 */
xmp_play_frame(opaque);
fail_unless(vi->note == 60, "row 1 frame 0");
fail_unless(vi->pos0 == 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 60, "row 1 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Row 2: delay this frame */
xmp_play_frame(opaque);
fail_unless(vi->note == 60, "row 2 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
/* note changes in frame 1 */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 2 frame 1");
fail_unless(vi->pos0 == 0, "sample position");
/* Row 3: delay larger than speed */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 3 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 3 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Row 4: nothing should happen */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 4 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 4 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Now test retrigs on delay effect */
/* Row 5: in standard mode */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 5 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 5 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
set_quirk(ctx, QUIRK_RTDELAY, READ_EVENT_FT2);
/* Row 6: in retrig mode */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 6 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 6 frame 1");
fail_unless(vi->pos0 == 0, "sample position");
/* Row 7: don't retrig */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 7 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 7 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Row 8: invalid instrument is ignored */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 8 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 8 frame 1");
fail_unless(vi->pos0 != 0, "sample position");
/* Row 9: don't retrig */
xmp_play_frame(opaque);
fail_unless(vi->note == 61, "row 9 frame 0");
fail_unless(vi->pos0 != 0, "sample position");
fail_unless(vi->vol != 0, "voice volume");
xmp_play_frame(opaque);
/* we cut the virtual voice on invalid instrument */
fail_unless(vi->note == 0, "row 9 frame 1");
fail_unless(vi->pos0 == 0, "sample position");
fail_unless(vi->vol == 0, "voice volume");
}
END_TEST