@@ -39,9 +39,9 @@ TEST_CASE("The input pattern is stored correctly", "[advanced][patternal]")
3939
4040 // Create the input pattern:
4141 patternalProcessor.inputs .patterns .value = {
42- (Pattern) {42 , {127 , 127 , 127 , 127 }}, // hi-hat
43- (Pattern) {38 , {0 , 127 , 0 , 127 }}, // snare
44- (Pattern) {35 , {127 , 0 , 127 , 0 }}, // bass drum
42+ {42 , {127 , 127 , 127 , 127 }}, // hi-hat
43+ {38 , {0 , 127 , 0 , 127 }}, // snare
44+ {35 , {127 , 0 , 127 , 0 }}, // bass drum
4545 };
4646
4747 // Check that the input pattern is stored correctly:
@@ -71,13 +71,13 @@ TEST_CASE("MIDI messages are output properly", "[advanced][patternal]")
7171 static constexpr double tickDuration = samplingRate / bufferSize; // seconds
7272 static constexpr double ticksPerSecond = 1.0 / tickDuration;
7373 static constexpr double testDuration = 3.0 ; // seconds
74- static constexpr double NS_PER_S = 1000000 ;
74+ static constexpr double NS_PER_S = 1000000000 ;
7575
7676 Processor patternalProcessor;
7777 patternalProcessor.inputs .patterns .value = {
78- (Pattern) {noteHiHat, {127 , 127 , 127 , 127 }}, // hi-hat
79- (Pattern) {noteSnare, {0 , 127 , 0 , 127 }}, // snare
80- (Pattern) {noteBassDrum, {127 , 0 , 127 , 0 }}, // bass drum
78+ {noteHiHat, {127 , 127 , 127 , 127 }}, // hi-hat
79+ {noteSnare, {0 , 127 , 0 , 127 }}, // snare
80+ {noteBassDrum, {127 , 0 , 127 , 0 }}, // bass drum
8181 };
8282
8383 // Check the output on each tick:
@@ -90,16 +90,22 @@ TEST_CASE("MIDI messages are output properly", "[advanced][patternal]")
9090 // INFO("Test tick " << tickIndex);
9191 pos_in_frames += bufferSize;
9292 pos_in_ns += tickDuration / NS_PER_S;
93+ double timeNow = tickIndex * tickDuration;
94+ double timeAtEndOfTick = (tickIndex + 1 ) * tickDuration;
95+
9396 tick_musical tk;
94- // TODO tk.start_position_quarter =
95- // TODO tk.end_position_quarter =
9697 tk.tempo = 120 ; // 120 BPM. One beat lasts 500 ms.
9798 tk.signature .num = 4 ;
9899 tk.signature .denom = 4 ;
99100 tk.frames = bufferSize;
100- tk.position_in_nanoseconds = pos_in_ns;
101+ tk.position_in_nanoseconds = pos_in_ns; // We don't really need to set this pos in ns.
101102 tk.position_in_frames = pos_in_frames;
102- double timeNow = tickIndex * tickDuration;
103+ tk.last_signature_change = 0 ; // The signature never changes.
104+ tk.start_position_in_quarters = TODO;
105+ tk.end_position_in_quarters = TODO;
106+ tk.bar_at_start = TODO;
107+ tk.bar_at_end = TODO;
108+
103109 patternalProcessor (tk);
104110
105111 // Test the 1st tick:
@@ -140,9 +146,5 @@ TEST_CASE("MIDI messages are output properly", "[advanced][patternal]")
140146 }
141147 // TODO: check the other ticks
142148 }
143-
144- // TODO check somethig with:
145- // - start_position_quarter
146- // - last_signature_change
147149}
148150
0 commit comments