2 ZynAddSubFX - a software synthesizer
4 KitTest.h - Test For Note Allocation Under Kits
5 Copyright (C) 2016 Mark McCurry
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 #include "test-suite.h"
17 #include "../Misc/Time.h"
18 #include "../Misc/Allocator.h"
19 #include "../DSP/FFTwrapper.h"
20 #include "../Misc/Microtonal.h"
21 #define private public
22 #define protected public
23 #include "../Synth/SynthNote.h"
24 #include "../Misc/Part.h"
25 #include "../globals.h"
33 #define SUSTAIN_BIT 0x04
34 enum PrivateNoteStatus
{
37 KEY_RELEASED_AND_SUSTAINED
= 0x02,
47 Microtonal microtonal
;
53 :fft(512), microtonal(dummy
)
57 time
= new AbsTime(*synth
);
58 outL
= new float[synth
->buffersize
];
59 outR
= new float[synth
->buffersize
];
60 memset(outL
, 0, synth
->bufferbytes
);
61 memset(outR
, 0, synth
->bufferbytes
);
64 part
= new Part(alloc
, *synth
, *time
, dummy
, dummy
, µtonal
, &fft
);
67 //Standard poly mode with sustain
68 void testSustainCase1() {
70 part
->ctl
.setsustain(127);
72 part
->NoteOn(64, 127, 0);
73 part
->NoteOn(64, 127, 0);
76 //first note has moved to release state
77 //second note has moved to sustain state
79 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
80 (NotePool::NoteDescriptor
{
85 .status
=KEY_RELEASED
|SUSTAIN_BIT
,
86 .legatoMirror
=false}));
88 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
89 (NotePool::NoteDescriptor
{
94 .status
=KEY_RELEASED_AND_SUSTAINED
,
95 .legatoMirror
=false}));
97 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
98 (NotePool::NoteDescriptor
{
104 .legatoMirror
=false}));
107 void testSustainCase2() {
109 part
->ctl
.setsustain(127);
111 part
->NoteOn(64, 127, 0);
113 part
->NoteOn(64, 127, 0);
115 //first note has moved to release state
116 //second note has stayed in playing state
118 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
119 (NotePool::NoteDescriptor
{
124 .status
=KEY_RELEASED
|SUSTAIN_BIT
,
125 .legatoMirror
=false}));
127 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
128 (NotePool::NoteDescriptor
{
134 .legatoMirror
=false}));
136 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
137 (NotePool::NoteDescriptor
{
143 .legatoMirror
=false}));
146 void testMonoSustain() {
148 part
->ctl
.setsustain(127);
149 part
->Ppolymode
= false;
151 part
->NoteOn(64, 127, 0);
153 part
->NoteOn(65, 127, 0);
155 part
->notePool
.dump();
157 //first note has moved to release state
158 //second note has stayed in playing state
160 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
161 (NotePool::NoteDescriptor
{
166 .status
=KEY_RELEASED
,
167 .legatoMirror
=false}));
169 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
170 (NotePool::NoteDescriptor
{
176 .legatoMirror
=false}));
178 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
179 (NotePool::NoteDescriptor
{
185 .legatoMirror
=false}));
188 //Enumerate cases of:
189 //Legato = {disabled,enabled}
190 //Mono = {disabled, enabled}
191 //Kit = {off, normal, single}
192 //ignore legato=enabled, mono=enabled
195 void testNoKitNoLegatoNoMono() {
196 part
->NoteOn(64, 127, 0);
197 part
->NoteOn(65, 127, 0);
199 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
200 (NotePool::NoteDescriptor
{
206 .legatoMirror
=false}));
208 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
209 (NotePool::NoteDescriptor
{
215 .legatoMirror
=false}));
217 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
218 (NotePool::NoteDescriptor
{
224 .legatoMirror
=false}));
227 void testNoKitYesLegatoNoMono() {
228 part
->Ppolymode
= false;
229 part
->Plegatomode
= true;
230 part
->NoteOn(64, 127, 0);
231 part
->NoteOn(65, 127, 0);
233 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
234 (NotePool::NoteDescriptor
{
240 .legatoMirror
=false}));
242 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
243 (NotePool::NoteDescriptor
{
249 .legatoMirror
=false}));
251 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
252 (NotePool::NoteDescriptor
{
258 .legatoMirror
=false}));
260 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
261 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
262 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
263 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
265 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
266 if(part
->notePool
.sdesc
[1].note
)
267 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, true);
268 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
269 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 0);
272 void testNoKitNoLegatoYesMono() {
273 part
->Ppolymode
= false;
274 part
->Plegatomode
= false;
275 part
->NoteOn(64, 127, 0);
276 part
->NoteOn(65, 127, 0);
279 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
280 (NotePool::NoteDescriptor
{
285 .status
=KEY_RELEASED
,
286 .legatoMirror
=false}));
288 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
289 (NotePool::NoteDescriptor
{
295 .legatoMirror
=false}));
297 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
298 (NotePool::NoteDescriptor
{
304 .legatoMirror
=false}));
306 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
307 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
308 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
309 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
311 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
312 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
313 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
314 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 0);
318 //Three patches that overlap give an overlapping response
319 void testYesKitNoLegatoNoMono() {
320 part
->setkititemstatus(1, true);
321 part
->setkititemstatus(2, true);
322 part
->kit
[1].Padenabled
= true;
323 part
->kit
[2].Padenabled
= true;
324 part
->kit
[2].Pmaxkey
= 32;
326 part
->NoteOn(64, 127, 0);
327 part
->NoteOn(65, 127, 0);
329 part
->notePool
.dump();
331 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
332 (NotePool::NoteDescriptor
{
338 .legatoMirror
=false}));
340 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
341 (NotePool::NoteDescriptor
{
347 .legatoMirror
=false}));
349 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
350 (NotePool::NoteDescriptor
{
356 .legatoMirror
=false}));
358 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
359 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
360 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
361 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
363 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
364 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
365 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
366 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 1);
368 TS_NON_NULL(part
->notePool
.sdesc
[2].note
);
369 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].note
->legato
.silent
, false);
370 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].type
, 0);
371 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].kit
, 0);
373 TS_NON_NULL(part
->notePool
.sdesc
[3].note
);
374 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].note
->legato
.silent
, false);
375 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].type
, 0);
376 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].kit
, 1);
378 assert_ptr_eq(part
->notePool
.sdesc
[4].note
,
380 "note free", __LINE__
);
381 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].type
, 0);
382 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].kit
, 0);
385 void testYesKitYesLegatoNoMono() {
386 part
->setkititemstatus(1, true);
387 part
->setkititemstatus(2, true);
388 part
->kit
[1].Padenabled
= true;
389 part
->kit
[2].Padenabled
= true;
390 part
->kit
[2].Pmaxkey
= 32;
392 part
->Ppolymode
= false;
393 part
->Plegatomode
= true;
394 part
->NoteOn(64, 127, 0);
395 part
->NoteOn(65, 127, 0);
397 part
->notePool
.dump();
399 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
400 (NotePool::NoteDescriptor
{
406 .legatoMirror
=false}));
408 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
409 (NotePool::NoteDescriptor
{
415 .legatoMirror
=false}));
417 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
418 (NotePool::NoteDescriptor
{
424 .legatoMirror
=false}));
426 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
427 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
428 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
429 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
431 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
432 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
433 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
434 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 1);
436 TS_NON_NULL(part
->notePool
.sdesc
[2].note
);
437 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].note
->legato
.silent
, true);
438 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].type
, 0);
439 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].kit
, 0);
441 TS_NON_NULL(part
->notePool
.sdesc
[3].note
);
442 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].note
->legato
.silent
, true);
443 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].type
, 0);
444 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].kit
, 1);
446 assert_ptr_eq(part
->notePool
.sdesc
[4].note
,
448 "note free", __LINE__
);
449 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].type
, 0);
450 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].kit
, 0);
453 void testYesKitNoLegatoYesMono() {
454 part
->setkititemstatus(1, true);
455 part
->setkititemstatus(2, true);
456 part
->kit
[1].Padenabled
= true;
457 part
->kit
[2].Padenabled
= true;
458 part
->kit
[2].Pmaxkey
= 32;
460 part
->Ppolymode
= false;
461 part
->Plegatomode
= false;
462 part
->NoteOn(64, 127, 0);
463 part
->NoteOn(65, 127, 0);
465 part
->notePool
.dump();
467 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
468 (NotePool::NoteDescriptor
{
473 .status
=KEY_RELEASED
,
474 .legatoMirror
=false}));
476 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
477 (NotePool::NoteDescriptor
{
483 .legatoMirror
=false}));
485 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
486 (NotePool::NoteDescriptor
{
492 .legatoMirror
=false}));
494 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
495 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
496 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
497 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
499 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
500 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
501 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
502 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 1);
504 TS_NON_NULL(part
->notePool
.sdesc
[2].note
);
505 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].note
->legato
.silent
, false);
506 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].type
, 0);
507 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].kit
, 0);
509 TS_NON_NULL(part
->notePool
.sdesc
[3].note
);
510 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].note
->legato
.silent
, false);
511 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].type
, 0);
512 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[3].kit
, 1);
514 assert_ptr_eq(part
->notePool
.sdesc
[4].note
,
516 "note free", __LINE__
);
517 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].type
, 0);
518 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[4].kit
, 0);
522 void testSingleKitNoLegatoNoMono() {
523 part
->setkititemstatus(1, true);
524 part
->setkititemstatus(2, true);
525 part
->kit
[1].Padenabled
= true;
526 part
->kit
[2].Padenabled
= true;
527 part
->kit
[2].Pmaxkey
= 32;
529 part
->NoteOn(64, 127, 0);
530 part
->NoteOn(65, 127, 0);
532 part
->notePool
.dump();
534 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
535 (NotePool::NoteDescriptor
{
541 .legatoMirror
=false}));
543 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
544 (NotePool::NoteDescriptor
{
550 .legatoMirror
=false}));
552 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
553 (NotePool::NoteDescriptor
{
559 .legatoMirror
=false}));
561 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
562 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
563 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
564 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
566 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
567 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
568 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
569 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 0);
571 assert_ptr_eq(part
->notePool
.sdesc
[2].note
,
573 "note free", __LINE__
);
574 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].type
, 0);
575 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[2].kit
, 0);
578 void testSingleKitYesLegatoNoMono() {
579 part
->setkititemstatus(1, true);
580 part
->setkititemstatus(2, true);
581 part
->kit
[1].Padenabled
= true;
582 part
->kit
[2].Padenabled
= true;
583 part
->kit
[2].Pmaxkey
= 32;
585 part
->Ppolymode
= false;
586 part
->Plegatomode
= true;
587 part
->NoteOn(64, 127, 0);
588 part
->NoteOn(65, 127, 0);
590 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
591 (NotePool::NoteDescriptor
{
597 .legatoMirror
=false}));
599 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
600 (NotePool::NoteDescriptor
{
606 .legatoMirror
=false}));
608 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
609 (NotePool::NoteDescriptor
{
615 .legatoMirror
=false}));
617 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
618 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
619 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
620 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
622 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
623 if(part
->notePool
.sdesc
[1].note
)
624 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, true);
625 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
626 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 0);
629 void testSingleKitNoLegatoYesMono() {
630 part
->setkititemstatus(1, true);
631 part
->setkititemstatus(2, true);
632 part
->kit
[1].Padenabled
= true;
633 part
->kit
[2].Padenabled
= true;
634 part
->kit
[2].Pmaxkey
= 32;
636 part
->Ppolymode
= false;
637 part
->Plegatomode
= false;
638 part
->NoteOn(64, 127, 0);
639 part
->NoteOn(65, 127, 0);
643 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[0],
644 (NotePool::NoteDescriptor
{
649 .status
=KEY_RELEASED
,
650 .legatoMirror
=false}));
652 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[1],
653 (NotePool::NoteDescriptor
{
659 .legatoMirror
=false}));
661 TS_ASSERT_EQUAL_CPP(part
->notePool
.ndesc
[2],
662 (NotePool::NoteDescriptor
{
668 .legatoMirror
=false}));
670 TS_NON_NULL(part
->notePool
.sdesc
[0].note
);
671 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].note
->legato
.silent
, false);
672 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].type
, 0);
673 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[0].kit
, 0);
675 TS_NON_NULL(part
->notePool
.sdesc
[1].note
);
676 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].note
->legato
.silent
, false);
677 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].type
, 0);
678 TS_ASSERT_EQUAL_INT(part
->notePool
.sdesc
[1].kit
, 0);
681 void testKeyLimit(void)
683 auto &pool
= part
->notePool
;
684 //Verify that without a key limit, several notes can be run
685 part
->NoteOn(64, 127, 0);
686 part
->NoteOn(65, 127, 0);
687 part
->NoteOn(66, 127, 0);
688 part
->NoteOn(67, 127, 0);
689 part
->NoteOn(68, 127, 0);
691 //Verify that notes are spawned as expected
692 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 5);
693 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 5);
696 part
->monomemClear();
699 //Verify that notes are despawned
700 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 0);
701 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 0);
704 part
->setkeylimit(3);
707 part
->NoteOn(64, 127, 0);
708 part
->NoteOn(65, 127, 0);
709 part
->NoteOn(66, 127, 0);
710 part
->NoteOn(67, 127, 0);
711 part
->NoteOn(68, 127, 0);
713 //Verify that notes are spawned as expected with limit
714 TS_ASSERT_EQUAL_INT(pool
.getRunningNotes(), 3);//2 entombed
715 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 5);
716 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 5);
719 part
->monomemClear();
722 //Verify that notes are despawned
723 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 0);
724 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 0);
726 //Now to test note stealing
729 part
->NoteOn(64, 127, 0);
730 part
->NoteOn(65, 127, 0);
731 part
->NoteOn(66, 127, 0);
733 //Verify that note pool is full
734 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 3);
735 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 3);
738 pool
.ndesc
[1].age
= 50;
739 pool
.ndesc
[2].age
= 500;
741 printf("-------------------------------------\n");
743 //Inject two more notes which should steal the note
744 //descriptors for #66 and #65
745 part
->NoteOn(67, 127, 0);
747 TS_ASSERT_EQUAL_INT(pool
.ndesc
[0].note
, 64);
748 TS_ASSERT_EQUAL_INT(pool
.ndesc
[1].note
, 65);
749 TS_ASSERT_EQUAL_INT(pool
.ndesc
[2].note
, 66);
750 TS_ASSERT_EQUAL_INT(pool
.ndesc
[2].status
, KEY_RELEASED
);
751 TS_ASSERT_EQUAL_INT(pool
.ndesc
[3].note
, 67);
753 part
->NoteOn(68, 127, 0);
755 //Verify that note pool is still full and entombed
756 TS_ASSERT_EQUAL_INT(pool
.usedNoteDesc(), 5);
757 TS_ASSERT_EQUAL_INT(pool
.usedSynthDesc(), 5);
759 //Check that the result is {64, 68, 67}
760 TS_ASSERT_EQUAL_INT(pool
.ndesc
[0].note
, 64);
761 TS_ASSERT_EQUAL_INT(pool
.ndesc
[1].note
, 65);
762 TS_ASSERT_EQUAL_INT(pool
.ndesc
[1].status
, KEY_RELEASED
);
763 TS_ASSERT_EQUAL_INT(pool
.ndesc
[2].note
, 66);
764 TS_ASSERT_EQUAL_INT(pool
.ndesc
[2].status
, KEY_RELEASED
);
765 TS_ASSERT_EQUAL_INT(pool
.ndesc
[3].note
, 67);
766 TS_ASSERT_EQUAL_INT(pool
.ndesc
[4].note
, 68);
781 RUN_TEST(testSustainCase1
);
782 RUN_TEST(testSustainCase2
);
783 RUN_TEST(testMonoSustain
);
784 RUN_TEST(testNoKitNoLegatoNoMono
);
785 RUN_TEST(testNoKitYesLegatoNoMono
);
786 RUN_TEST(testNoKitNoLegatoYesMono
);
787 RUN_TEST(testYesKitNoLegatoNoMono
);
788 RUN_TEST(testYesKitYesLegatoNoMono
);
789 RUN_TEST(testYesKitNoLegatoYesMono
);
790 RUN_TEST(testSingleKitNoLegatoNoMono
);
791 RUN_TEST(testSingleKitYesLegatoNoMono
);
792 RUN_TEST(testSingleKitNoLegatoYesMono
);
793 RUN_TEST(testKeyLimit
);
794 return test_summary();