@@ -54,11 +54,11 @@ for (a = 0; a < sch_exp_polyphony; a ++) {
5454 if (o.song_exists [sch_exp_range_start + b, sch_exp_layer[a]]) {
5555 if (o.song_key [sch_exp_range_start + b, sch_exp_layer[a]] > 32 && o.song_key [sch_exp_range_start + b, sch_exp_layer[a]] < 58 ) {
5656 switch (sch_exp_stereo) {
57- case 1 : if o.song_pan [b, sch_exp_layer[a]] > 100 accepted = 1 ; // Right Notes
57+ case 1 : if o.song_pan [sch_exp_range_start + b, sch_exp_layer[a]] > 100 accepted = 1 ; // Right Notes
5858 break ;
59- case 2 : if o.song_pan [b, sch_exp_layer[a]] < 100 accepted = 1 ; // Left Notes
59+ case 2 : if o.song_pan [sch_exp_range_start + b, sch_exp_layer[a]] < 100 accepted = 1 ; // Left Notes
6060 break ;
61- case 3 : if o.song_pan [b, sch_exp_layer[a]] = 100 accepted = 1 ; // Center Notes
61+ case 3 : if o.song_pan [sch_exp_range_start + b, sch_exp_layer[a]] = 100 accepted = 1 ; // Center Notes
6262 break ;
6363 case 4 : accepted = 1 ; // All Notes
6464 break ;
@@ -70,17 +70,19 @@ for (a = 0; a < sch_exp_polyphony; a ++) {
7070 }
7171 }
7272 if accepted = 1 {
73- nblocknote[a, ticks] = o.song_key [b, sch_exp_layer[a]] - 33
74- nblockins[a, ticks] = o.song_ins [b, sch_exp_layer[a]] - 100002
75- nblockvel[a, ticks] = o.song_vel [b, sch_exp_layer[a]]
76- sch_exp_totalnoteblocks += 1
73+ nblocknote[a, ticks] = o.song_key [sch_exp_range_start + b, sch_exp_layer[a]] - 33
74+ nblockins[a, ticks] = o.song_ins [sch_exp_range_start + b, sch_exp_layer[a]] - 100002
75+ nblockvel[a, ticks] = o.song_vel [sch_exp_range_start + b, sch_exp_layer[a]]
76+ sch_exp_totalnoteblocks ++
7777 accepted = 0
7878 } else {
7979 nblocknote[a, ticks] = 0
8080 nblockins[a, ticks] = 0
8181 nblockvel[a, ticks] = 0
8282 }
83- // show_debug_message("WROTE nblocknote" + string(a) + "," + string(ticks) + " val " + string(nblocknote[a, ticks]))
83+ show_debug_message (" WROTE nblocknote" + string (a) + " ," + string (ticks) + " val " + string (nblocknote[a, ticks]))
84+ noteblockzvel[a, ticks] = 0
85+ noteblockxpos[a, ticks] = 0
8486 ticks ++
8587 }
8688}
@@ -107,12 +109,8 @@ for (a = 0; a < sch_exp_polyphony; a ++) { // layer count
107109 noteblockzvel[a, c] = zvel
108110 noteblockxpos[a, c] = xpos
109111 if sch_exp_circuitry = 1 {
110- if sch_exp_polyphony != 3 {
111112 schematic_fill (mySchematic, lineloc, b, 0 , zvel, b, 0 , sch_exp_circuit_block, sch_exp_circuit_data) // Connects a redstone line to the block
112113 schematic_fill (mySchematic, lineloc + -direc, b, 1 , zvel, b, 1 , 55 , 0 )
113- } else
114- schematic_fill (mySchematic, lineloc, b, 0 , noteblockzvel[0 , c], b, 0 , sch_exp_circuit_block, sch_exp_circuit_data) // Connects a redstone line to the block
115- schematic_fill (mySchematic, lineloc + -direc, b, 1 , noteblockzvel[0 , c], b, 1 , 55 , 0 )
116114 }
117115 }
118116 }
@@ -131,10 +129,15 @@ if sch_exp_velocity = 1 { // When polyphony is 1 or 2, make velocity independent
131129 if sch_exp_polyphony = 2 { // Various checks if note blocks conflict.
132130 var layer_correction = 0
133131 if noteblockzvel[0 , c] != noteblockzvel[1 , c] { // Adds some redstone next to the noteblock if the velocity is different
134- schematic_cell_set (mySchematic, noteblockzvel[1 , c], b, 1 , sch_exp_circuit_block, sch_exp_circuit_data)
135- schematic_cell_set (mySchematic, noteblockzvel[1 , c], b, 2 , 55 , 0 )
136- if noteblockzvel[0 , c] > lineloc && noteblockzvel[0 , c] < noteblockzvel[1 , c] layer_correction = 1
137- else if noteblockzvel[0 , c] < lineloc && noteblockzvel[0 , c] > noteblockzvel[1 , c] layer_correction = 1
132+ if noteblockzvel[0 , c] != 0 j = 0 else if noteblockzvel[1 , c] != 0 j = 1
133+ if j != 0 {
134+ schematic_cell_set (mySchematic, noteblockzvel[j, c], b, 1 , sch_exp_circuit_block, sch_exp_circuit_data)
135+ schematic_cell_set (mySchematic, noteblockzvel[j, c], b, 2 , 55 , 0 )
136+ if noteblockzvel[0 , c] != 0 && noteblockzvel[1 , c] != 0 {
137+ if noteblockzvel[0 , c] > lineloc && noteblockzvel[0 , c] < noteblockzvel[1 , c] layer_correction = 1
138+ else if noteblockzvel[0 , c] < lineloc && noteblockzvel[0 , c] > noteblockzvel[1 , c] layer_correction = 1
139+ }
140+ }
138141 }
139142 if layer_correction = 1 { // Alter layer 0's position and add connecting redstone.
140143 freespace ++
@@ -155,24 +158,30 @@ if sch_exp_velocity = 1 { // When polyphony is 1 or 2, make velocity independent
155158 noteblockz[a, c] = noteblockzvel[a, c]
156159 }
157160 if sch_exp_polyphony = 3 { // if polyphony = 3 then base all velocity values off layer 0.
158- if a = 1 var fix = 1 else fix = 0
161+ if a = 1 var fix = 1 else fix = 0 // only offset the 2nd layer
159162 var shiftblock = 0
163+ var j = 0
164+ if noteblockzvel[0 , c] != 0 j = 0 else if noteblockzvel[1 , c] != 0 j = 1 else if noteblockzvel[2 , c] != 0 j = 2
165+ if noteblockzvel[0 , c] = 0 {
166+ schematic_cell_set (mySchematic, noteblockzvel[j, c], b, 1 , sch_exp_circuit_block, sch_exp_circuit_data) // Adds some redstone next to the chosen layer's noteblock
167+ schematic_cell_set (mySchematic, noteblockzvel[j, c], b, 2 , 55 , 0 )
168+ }
160169 if a = 2 {
161- if noteblockzvel[0 , c] > 17 shiftblock = 1 else shiftblock = -1
162- fix = 0
170+ if noteblockzvel[2 , c] > 17 shiftblock = 1 else shiftblock = -1
163171 }
164- schematic_cell_set (mySchematic, noteblockzvel[0 , c] + shiftblock, b + fix, 1 , 25 , 0 )
165- schematic_cell_set (mySchematic, noteblockzvel[0 , c] + shiftblock, b + fix, 0 , sch_exp_ins_block[nblockins[a, c]], 0 )
166- noteblockx[a, c] = noteblockxpos[0 , c] - fix
172+ schematic_cell_set (mySchematic, noteblockzvel[j, c] + shiftblock, b + fix, 1 , 25 , 0 )
173+ schematic_cell_set (mySchematic, noteblockzvel[j, c] + shiftblock, b + fix, 2 , 0 , 0 )
174+ schematic_cell_set (mySchematic, noteblockzvel[j, c] + shiftblock, b + fix, 0 , sch_exp_ins_block[nblockins[a, c]], 0 )
175+ noteblockx[a, c] = noteblockxpos[j, c] - fix
167176 noteblocky[a, c] = 1
168- noteblockz[a, c] = noteblockzvel[0 , c] + shiftblock
177+ noteblockz[a, c] = noteblockzvel[j , c] + shiftblock
169178 }
170179 }
171180 b += 2
172181 }
173182 }
174183}
175-
184+ show_debug_message ( " total note blocks = " + string(sch_exp_totalnoteblocks))
176185schematic_save(mySchematic, fn);
177186schematic_destroy (mySchematic);
178187schematic_end ();
0 commit comments