-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipattern.inc
5090 lines (4717 loc) · 231 KB
/
ipattern.inc
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
procedure cancel_note_recorder;
procedure PATTERN_tabs_refresh;
procedure STATUS_LINE_refresh;
function last_chan_pos: Byte;
function last_hpos: Byte;
procedure PATTERN_page_refresh(page: Byte);
procedure PATTERN_position_preview(pattern,line,channel,mode: Byte);
function PATTERN_trace: Word;
procedure PATTERN_edit(var pattern,page,hpos: Byte);
}
const
old_nm_track_chan: Byte = 0;
old_track_chan_start: Byte = 0;
const
pattern_undo_flag: Boolean = FALSE;
var
pattern_undo_patt: Byte;
pattern_undo_data: array[0..PRED(SizeOf(tPATTERN_DATA) DIV 16)] of Byte;
procedure cancel_note_recorder;
begin
If track_notes then
begin
old_nm_track_chan := nm_track_chan;
old_track_chan_start := track_chan_start;
track_notes := FALSE;
nm_track_chan := 1;
end;
end;
procedure PATTERN_tabs_refresh;
var
temp: Byte;
begin
If (command_typing <> 0) then
begin
For temp := chan_pos to max(chan_pos+MAX_TRACKS-1,songdata.nm_tracks) do
If (temp <> count_channel(pattern_hpos)) then
show_str(08+(temp-PRED(chan_pos)-1)*15,10,
patt_tab_str[0],
pattern_bckg+pattern_border);
Case count_pos(pattern_hpos) of
0,
1: show_cstr(08+(count_channel(pattern_hpos)-PRED(chan_pos)-1)*15,10,
patt_tab_str[1],
pattern_bckg+pattern_border,
pattern_bckg+pattern_pos_indic);
2,
3: show_cstr(08+(count_channel(pattern_hpos)-PRED(chan_pos)-1)*15,10,
patt_tab_str[2],
pattern_bckg+pattern_border,
pattern_bckg+pattern_pos_indic);
4,5,
6: show_cstr(08+(count_channel(pattern_hpos)-PRED(chan_pos)-1)*15,10,
patt_tab_str[3],
pattern_bckg+pattern_border,
pattern_bckg+pattern_pos_indic);
7,8,
9: show_cstr(08+(count_channel(pattern_hpos)-PRED(chan_pos)-1)*15,10,
patt_tab_str[4],
pattern_bckg+pattern_border,
pattern_bckg+pattern_pos_indic);
end;
end;
end;
procedure STATUS_LINE_refresh;
var
tracking_indicator_attr: array[Boolean] of Byte;
attr: Byte;
begin
{$IFDEF GO32V2}
_last_debug_str_ := _debug_str_;
_debug_str_ := 'IPATTERN.INC:STATUS_LINE_refresh';
{$ENDIF}
If really_no_status_refresh then EXIT;
If (get_4op_to_test <> 0) then
show_cstr(40,MAX_PATTERN_ROWS+12,'~[~'+byte2hex(HI(get_4op_to_test))+'~+~'+byte2hex(LO(get_4op_to_test))+'~]~',
main_background+main_hi_stat_line,
main_background+main_stat_line)
else show_cstr(40,MAX_PATTERN_ROWS+12,'~[~'+byte2hex(current_inst)+'~]~'#196#196#196,
main_background+main_border,
main_background+main_stat_line);
If marking and NOT (discard_block or
(tracing and (pattern_patt <> tracing_block_pattern))) then
show_cstr(MAX_COLUMNS-39,MAX_PATTERN_ROWS+12,'~[M.BLOCK:~'+
byte2hex(block_y0)+','+byte2dec(block_x0)+'~'#196#16'~'+
byte2hex(block_y1)+','+byte2dec(block_x1)+'~]~',
main_background+main_hi_stat_line,
main_background+main_stat_line)
else begin
show_cstr(MAX_COLUMNS-39,MAX_PATTERN_ROWS+12,'~[LN:~'+ExpStrL(Num2str(pattern_page,10),3,'0')+'/'+ExpStrL(Num2str(PRED(songdata.patt_len),10),3,'0')+'~;~',
main_background+main_hi_stat_line,
main_background+main_stat_line);
show_cstr(MAX_COLUMNS-27,MAX_PATTERN_ROWS+12,'~TRK:~'+byte2dec(count_channel(pattern_hpos))+'/'+byte2dec(songdata.nm_tracks)+'~]~',
main_background+main_hi_stat_line,
main_background+main_stat_line);
end;
If midiboard or (debugging and (play_status = isStopped)) then
show_str(03,MAX_PATTERN_ROWS+12,'MBOARD',main_background+main_hi_stat_line)
else show_str(03,MAX_PATTERN_ROWS+12,'MBOARD',main_background+main_stat_line);
If NOT debugging and tracing and (play_status <> isStopped) then
show_str(10,MAX_PATTERN_ROWS+12,'TRACE',main_background+main_hi_stat_line)
else show_str(10,MAX_PATTERN_ROWS+12,'TRACE',main_background+main_stat_line);
If debugging and (play_status <> isStopped) then
show_str(16,MAX_PATTERN_ROWS+12,'DEBUG',main_background+main_hi_stat_line)
else show_str(16,MAX_PATTERN_ROWS+12,'DEBUG',main_background+main_stat_line);
tracking_indicator_attr[TRUE] := main_background+main_hi_stat_line;
If (play_status = isPlaying) and tracing then
If track_notes_ins then tracking_indicator_attr[FALSE] := main_behavior SHL 4 AND $0f0
else tracking_indicator_attr[FALSE] := main_hi_stat_line SHL 4 AND $0f0
else tracking_indicator_attr[FALSE] := main_background+main_stat_line;
If track_notes then
begin
If jump_mark_mode and mark_lines then attr := main_background+main_dis_stat_line
else attr := main_background+main_hi_stat_line;
show_cstr(22,MAX_PATTERN_ROWS+12,'NRECM~:'#30+CHR(ORD('0')+rec_correction)+'~',
tracking_indicator_attr[_generic_blink_event_flag],
attr);
end
else If debugging and (play_status = isStopped) then
show_str(22,MAX_PATTERN_ROWS+12,'TRACKiNG',main_background+main_hi_stat_line)
else show_str(22,MAX_PATTERN_ROWS+12,'TRACKiNG',main_background+main_stat_line);
If linefeed and NOT (command_typing = 0) then
show_str(MAX_COLUMNS-16,MAX_PATTERN_ROWS+12,#127,main_background+main_behavior)
else show_str(MAX_COLUMNS-16,MAX_PATTERN_ROWS+12,#127,main_background+main_behavior_dis);
If jump_mark_mode then
show_str(MAX_COLUMNS-15,MAX_PATTERN_ROWS+12,#23,main_background+main_behavior)
else show_str(MAX_COLUMNS-15,MAX_PATTERN_ROWS+12,#23,main_background+main_behavior_dis);
end;
function last_chan_pos: Byte;
begin
If (songdata.nm_tracks > MAX_TRACKS) then
last_chan_pos := max(16,songdata.nm_tracks-MAX_TRACKS+1)
else last_chan_pos := 1;
end;
function last_hpos: Byte;
begin
last_hpos := max(_pattedit_lastpos,songdata.nm_tracks*(_pattedit_lastpos DIV MAX_TRACKS));
end;
procedure PATTERN_page_refresh(page: Byte);
var
attr: Word;
temp,temp1,temp2,temp3,attr2,attr3: Byte;
chan_attr: Byte;
{$IFNDEF GO32V2}
chanrec_indicator_attr: array[Boolean] of Byte;
{$ENDIF}
temps: String;
spos,epos: Byte;
dummy_str: String[1];
dummy_atr: Byte;
chunk: tCHUNK;
_row_bckg,
_row_bckg2,
_row_fgnd: Byte;
_no_block_tracing: Boolean;
function PRED1(value: Longint): Longint;
begin
If (value > 1) then PRED1 := PRED(value)
else PRED1 := 1;
end;
procedure _set_attr(chan: Byte; chunk: tCHUNK;
_bckg,_fix_note,_note,_note0,_note_hid,_inst,_inst0: Byte;
var attr: Word; var attr2: Byte);
begin
If (chunk.note <> 0) then
If (chunk.note in [fixed_note_flag+1..fixed_note_flag+12*8+1]) then
attr := attr+(_bckg+_fix_note) SHL 8
else attr := attr+(_bckg+_note) SHL 8
else attr := attr+(_bckg+_note0) SHL 8;
If (chunk.instr_def <> 0) then attr2 := _bckg+_inst
else attr2 := _bckg+_inst0;
end;
begin
{$IFDEF GO32V2}
_last_debug_str_ := _debug_str_;
_debug_str_ := 'IPATTERN.INC:PATTERN_page_refresh';
{$ENDIF}
For temp := SUCC(songdata.nm_tracks) to MAX_TRACKS do
begin
show_str(08+(temp-1)*15,10,patt_tab_str[0],
pattern_bckg+pattern_border);
show_str(11+(temp-1)*15,09,ExpStrL('',10,' '),
pattern_bckg+pattern_border);
end;
PATTERN_tabs_refresh;
If (page > PRED(songdata.patt_len)) then
page := PRED(songdata.patt_len);
If (pattern_page > PRED(songdata.patt_len)) then
pattern_page := PRED(songdata.patt_len);
While NOT ((chan_pos <= last_chan_pos) and (pattern_hpos <= last_hpos)) do
If (pattern_hpos > _pattedit_lastpos DIV MAX_TRACKS) then
begin
Dec(pattern_hpos,_pattedit_lastpos DIV MAX_TRACKS);
If (pattern_hpos MOD (_pattedit_lastpos DIV MAX_TRACKS) > 0) then
temp := PRED(pattern_hpos MOD (_pattedit_lastpos DIV MAX_TRACKS))
else temp := PRED(_pattedit_lastpos DIV MAX_TRACKS);
Dec(pattern_hpos,temp);
end
else If (chan_pos > 1) then
begin
Dec(chan_pos);
If (pattern_hpos MOD (_pattedit_lastpos DIV MAX_TRACKS) > 0) then
temp := PRED(pattern_hpos MOD (_pattedit_lastpos DIV MAX_TRACKS))
else temp := PRED(_pattedit_lastpos DIV MAX_TRACKS);
Dec(pattern_hpos,temp);
end
else If cycle_pattern then
begin
chan_pos := last_chan_pos;
pattern_hpos := last_hpos;
end;
If (page < PRED(MAX_PATTERN_ROWS DIV 2)) then spos := PRED(MAX_PATTERN_ROWS DIV 2)-page else spos := 0;
If (page > INTEGER(PRED(songdata.patt_len))-PRED(MAX_PATTERN_ROWS DIV 2)-1) then
epos := page-(INTEGER(PRED(songdata.patt_len))-PRED(MAX_PATTERN_ROWS DIV 2)-1)
else epos := 0;
If (spos <> 0) or (epos <> 0) then
For temp2 := chan_pos to chan_pos+MAX_TRACKS-1 do
begin
If (temp2-PRED(chan_pos) <> MAX_TRACKS) then dummy_str := #179
else dummy_str := '';
If (spos <> 0) then
For temp3 := 1 to spos do
begin
show_str(03,10+temp3,ExpStrL('',4,' ')+#186,pattern_bckg+pattern_border);
show_str(MAX_COLUMNS-8,10+temp3,#186+ExpStrL('',4,' '),pattern_bckg+pattern_border);
show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp3,ExpStrL('',14,' ')+
dummy_str,pattern_bckg+pattern_border);
end;
If (epos <> 0) then
For temp3 := MAX_PATTERN_ROWS downto MAX_PATTERN_ROWS-epos+1 do
begin
show_str(03,10+temp3,ExpStrL('',4,' ')+#186,pattern_bckg+pattern_border);
show_str(MAX_COLUMNS-8,10+temp3,#186+ExpStrL('',4,' '),pattern_bckg+pattern_border);
show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp3,ExpStrL('',14,' ')+
dummy_str,pattern_bckg+pattern_border);
end;
end;
_no_block_tracing := discard_block or
(tracing and (pattern_patt <> tracing_block_pattern));
show_str(17+(MAX_COLUMNS-19) DIV 2,08,byte2hex(pattern_patt),pattern_bckg+pattern_border);
For temp1 := 1+spos to MAX_PATTERN_ROWS-epos do
begin
If tracing and (play_status <> isStopped) then
begin
If (temp1 <> MAX_PATTERN_ROWS DIV 2) then _row_bckg := BYTE_NULL
else begin
_row_bckg := pattern_row_bckg_p;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_line_p;
end
end
else If NOT ((pattern_patt = current_pattern) and
(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1 = current_line) and
(play_status <> isStopped)) then
_row_bckg := BYTE_NULL
else begin
_row_bckg := pattern_row_bckg_p;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_line_p;
end;
If NOT ((mark_line <> 0) and mark_lines) then
begin
If (temp1 <> MAX_PATTERN_ROWS DIV 2) or (marking and (NOT _no_block_tracing or discard_block)) then
begin
If (temp1 <> MAX_PATTERN_ROWS DIV 2) then
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_line;
end;
show_cstr(03,10+temp1,' '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~ '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end
else
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_border;
end;
show_cstr(03,10+temp1,#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17+'~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~'#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17,
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end;
end
else begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_row_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_hi_line;
end;
show_cstr(03,10+temp1,#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17+'~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~'#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17,
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end;
end
else
begin
If (temp1 <> MAX_PATTERN_ROWS DIV 2) or (marking and (NOT _no_block_tracing or discard_block)) then
If ((page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1 = 0) or
((page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1) MOD mark_line = 0)) and
(mark_line <> 0) then
begin
If NOT marking or (marking and NOT discard_block and
_no_block_tracing) then
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_row_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_hi_line;
end;
show_cstr(03,10+temp1,' '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~ '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end
else
If (temp1 <> MAX_PATTERN_ROWS DIV 2) then
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_hi_line;
end;
show_cstr(03,10+temp1,' '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~ '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end
else
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_border;
end;
show_cstr(03,10+temp1,#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17+'~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~'#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17,
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end;
end
else
If (temp1 <> MAX_PATTERN_ROWS DIV 2) then
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_line;
end;
show_cstr(03,10+temp1,' '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~ '+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+' ',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end
else
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_bckg;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_border;
end;
show_cstr(03,10+temp1,#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17+'~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~'#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17,
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end
else
begin
If (_row_bckg = BYTE_NULL) then
begin
_row_bckg := pattern_row_bckg_m;
_row_bckg2 := pattern_bckg;
_row_fgnd := pattern_hi_line_m;
end;
show_cstr(03,10+temp1,#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17'~'#186'~',
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
show_cstr(MAX_COLUMNS-8,10+temp1,'~'#186'~'#16+byte2hex(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1)+#17,
_row_bckg+_row_fgnd,
_row_bckg2+pattern_border);
end;
end;
For temp2 := chan_pos to chan_pos+MAX_TRACKS-1 do
begin
get_chunk(pattern_patt,page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1,temp2,chunk);
If marking and (
(NOT tracing and
is_in_block(temp2,page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1,
count_channel(pattern_hpos),page))
or (NOT discard_block and tracing and
NOT _no_block_tracing and
is_in_block(temp2,page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1,
tracing_block_xend,tracing_block_yend))
or (discard_block and (temp2 = block_xstart) and
(page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1 = block_ystart))) then
begin
If NOT ((chunk.effect_def = 0) and (chunk.effect = 0)) then
attr := pattern_block_bckg+pattern_cmnd_b
else attr := pattern_block_bckg+pattern_cmnd0_b;
If NOT ((chunk.effect_def2 = 0) and (chunk.effect2 = 0)) then
attr3 := pattern_block_bckg+pattern_cmnd_b
else attr3 := pattern_block_bckg+pattern_cmnd0_b;
_set_attr(temp2,chunk,pattern_block_bckg,pattern_fix_note_b,
pattern_note_b,pattern_note0_b,pattern_note_hid_b,
pattern_inst_b,pattern_inst0_b,attr,attr2);
end
else If (NOT marking or (marking and NOT discard_block and
_no_block_tracing)) and
(temp1 = 1+PRED(MAX_PATTERN_ROWS DIV 2)) then
begin
If NOT ((mark_line <> 0) and mark_lines) then
begin
If NOT ((chunk.effect_def = 0) and (chunk.effect = 0)) then
attr := pattern_row_bckg+pattern_hi_cmnd
else attr := pattern_row_bckg+pattern_hi_cmnd0;
If NOT ((chunk.effect_def2 = 0) and (chunk.effect2 = 0)) then
attr3 := pattern_row_bckg+pattern_hi_cmnd
else attr3 := pattern_row_bckg+pattern_hi_cmnd0;
_set_attr(temp2,chunk,pattern_row_bckg,pattern_hi_fx_note,
pattern_hi_note,pattern_hi_note0,pattern_hi_note_h,
pattern_hi_inst,pattern_hi_inst0,attr,attr2);
end
else
begin
If NOT ((chunk.effect_def = 0) and (chunk.effect = 0)) then
attr := pattern_row_bckg_m+pattern_cmnd_m
else attr := pattern_row_bckg_m+pattern_cmnd0_m;
If NOT ((chunk.effect_def2 = 0) and (chunk.effect2 = 0)) then
attr3 := pattern_row_bckg_m+pattern_cmnd_m
else attr3 := pattern_row_bckg_m+pattern_cmnd0_m;
_set_attr(temp2,chunk,pattern_row_bckg_m,pattern_fix_note_m,
pattern_note_m,pattern_note0_m,pattern_note_hid_m,
pattern_inst_m,pattern_inst0_m,attr,attr2);
end;
end
else If ((page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1 = 0) or
((page+temp1-PRED(MAX_PATTERN_ROWS DIV 2)-1) MOD mark_line = 0)) and
(mark_line <> 0) and
(NOT marking or (marking and NOT discard_block and
_no_block_tracing)) and
mark_lines then
begin
If NOT ((chunk.effect_def = 0) and (chunk.effect = 0)) then
attr := pattern_row_bckg+pattern_hi_cmnd
else attr := pattern_row_bckg+pattern_hi_cmnd0;
If NOT ((chunk.effect_def2 = 0) and (chunk.effect2 = 0)) then
attr3 := pattern_row_bckg+pattern_hi_cmnd
else attr3 := pattern_row_bckg+pattern_hi_cmnd0;
_set_attr(temp2,chunk,pattern_row_bckg,pattern_hi_fx_note,
pattern_hi_note,pattern_hi_note0,pattern_hi_note_h,
pattern_hi_inst,pattern_hi_inst0,attr,attr2);
end
else
begin
If NOT ((chunk.effect_def = 0) and (chunk.effect = 0)) then
begin
If NOT highlight_controls or
NOT ((chunk.effect_def in [ef_PositionJump,
ef_PatternBreak,
ef_SetSpeed,
ef_SetTempo]) or
((chunk.effect_def = ef_Extended) and
(chunk.effect DIV 16 in [ef_ex_PatternLoop,
ef_ex_PatternLoopRec]))) then
attr := pattern_bckg+pattern_cmnd
else attr := pattern_bckg+pattern_cmnd_ctrl
end
else attr := pattern_bckg+pattern_cmnd0;
If NOT ((chunk.effect_def2 = 0) and (chunk.effect2 = 0)) then
begin
If NOT highlight_controls or
NOT ((chunk.effect_def2 in [ef_PositionJump,
ef_PatternBreak,
ef_SetSpeed,
ef_SetTempo]) or
((chunk.effect_def2 = ef_Extended) and
(chunk.effect2 DIV 16 in [ef_ex_PatternLoop,
ef_ex_PatternLoopRec]))) then
attr3 := pattern_bckg+pattern_cmnd
else attr3 := pattern_bckg+pattern_cmnd_ctrl
end
else attr3 := pattern_bckg+pattern_cmnd0;
_set_attr(temp2,chunk,pattern_bckg,pattern_fix_note,
pattern_note,pattern_note0,pattern_note_hid,
pattern_inst,pattern_inst0,attr,attr2);
end;
dummy_atr := attr3 AND $0f0+pattern_border;
If (temp2-PRED(chan_pos) <> MAX_TRACKS) and
(NOT (marking and (temp2 >= block_x1)) or
(marking and _no_block_tracing)) then
begin
dummy_str := #179;
If marking and discard_block then
dummy_atr := pattern_bckg+pattern_border;
end
else If marking and (temp2-PRED(chan_pos) <> MAX_TRACKS) and
NOT _no_block_tracing then
begin
dummy_str := #179;
dummy_atr := pattern_bckg+pattern_border;
end
else dummy_str := '';
If (temp2 > max(chan_pos+MAX_TRACKS-1,songdata.nm_tracks)) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,' ',HI(attr))
else
Case pattern_layout of
0: Case chunk.note of
0: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,#250#250#250' ',HI(attr));
1..12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note]+' ',HI(attr));
fixed_note_flag+
1..
fixed_note_flag+
12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note-fixed_note_flag]+' ',HI(attr));
BYTE_NULL: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,#254#254#254' ',HI(attr));
end;
1: Case chunk.note of
0: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,#250#250#250' ',HI(attr));
1..12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note]+' ',HI(attr));
fixed_note_flag+
1..
fixed_note_flag+
12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note-fixed_note_flag]+' ',HI(attr));
BYTE_NULL: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,#205#205#205' ',HI(attr));
end;
2: Case chunk.note of
0: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,#250#250#250' ',HI(attr));
1..12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note]+' ',HI(attr));
fixed_note_flag+
1..
fixed_note_flag+
12*8+1: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,note_layout[chunk.note-fixed_note_flag]+' ',HI(attr));
BYTE_NULL: show_str(08+pos3[(temp2-PRED(chan_pos))*4-3],10+temp1,'^^'#250' ',HI(attr));
end;
end;
If (temp2 > max(chan_pos+MAX_TRACKS-1,songdata.nm_tracks)) then
begin
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,' ',attr2);
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,' ',LO(attr));
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4], 10+temp1,' '+
#10+dummy_str+#10,attr3,dummy_atr);
end
else
Case pattern_layout of
0: begin
If (chunk.instr_def = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,#249#249' ',attr2)
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,
ExpStrL(Num2str(chunk.instr_def,16),2,#249)+' ',attr2);
If (chunk.effect_def = 0) and (chunk.effect = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,#250#250#250' ',LO(attr))
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,
fx_digits[chunk.effect_def]+byte2hex(chunk.effect)+' ',LO(attr));
If (chunk.effect_def2 = 0) and (chunk.effect2 = 0) then
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,#250#250#250+
#10+dummy_str+#10,attr3,dummy_atr)
else
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,
fx_digits[chunk.effect_def2]+byte2hex(chunk.effect2)+
#10+dummy_str+#10,attr3,dummy_atr);
end;
1: begin
If (chunk.instr_def = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,#250#250' ',attr2)
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,
ExpStrL(Num2str(chunk.instr_def,16),2,#250)+' ',attr2);
If (chunk.effect_def = 0) and (chunk.effect = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,#249#249#249' ',LO(attr))
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,
fx_digits[chunk.effect_def]+byte2hex(chunk.effect)+' ',LO(attr));
If (chunk.effect_def2 = 0) and (chunk.effect2 = 0) then
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,#249#249#249+
#10+dummy_str+#10,attr3,dummy_atr)
else
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,
fx_digits[chunk.effect_def2]+byte2hex(chunk.effect2)+
#10+dummy_str+#10,attr3,dummy_atr);
end;
2: begin
If (chunk.instr_def = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,#250#250' ',attr2)
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-2],10+temp1,
ExpStrL(Num2str(chunk.instr_def,16),2,#250)+' ',attr2);
If (chunk.effect_def = 0) and (chunk.effect = 0) then
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,#250#249#249' ',LO(attr))
else
show_str(08+pos3[(temp2-PRED(chan_pos))*4-1],10+temp1,
fx_digits[chunk.effect_def]+byte2hex(chunk.effect)+' ',LO(attr));
If (chunk.effect_def2 = 0) and (chunk.effect2 = 0) then
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,#250#249#249+
#10+dummy_str+#10,attr3,dummy_atr)
else
show_cstr_alt(08+pos3[(temp2-PRED(chan_pos))*4],10+temp1,
fx_digits[chunk.effect_def2]+byte2hex(chunk.effect2)+
#10+dummy_str+#10,attr3,dummy_atr);
end;
end;
end;
end;
{$IFNDEF GO32V2}
chanrec_indicator_attr[TRUE] := main_behavior SHL 4 AND $0f0;
If (play_status = isPlaying) then
chanrec_indicator_attr[FALSE] := pattern_bckg+pattern_border
else chanrec_indicator_attr[FALSE] := main_behavior SHL 4 AND $0f0;
{$ENDIF}
STATUS_LINE_refresh;
For temp1 := chan_pos to chan_pos+MAX_TRACKS-1 do
begin
If NOT is_4op_chan(temp1) then
temps := '~ ~'+ExpStrR(Num2str(temp1,10),2,' ')+'~ ~'
else If (temp1 in _4op_tracks_hi) then
temps := '~'#244'~'+ExpStrR(Num2str(temp1,10),2,' ')+'~ ~'
else temps := '~'#245'~'+ExpStrR(Num2str(temp1,10),2,' ')+'~ ~';
{$IFNDEF GO32V2}
If opl3_channel_recording_mode and opl3_record_channel[temp1] then
chan_attr := chanrec_indicator_attr[_generic_blink_event_flag]
else
{$ENDIF}
If track_notes and (temp1 >= track_chan_start) and
(temp1 <= track_chan_start+nm_track_chan-1) then
chan_attr := main_behavior SHL 4 and $0f0
else chan_attr := pattern_bckg+pattern_border;
show_cstr(08+(temp1-PRED(chan_pos)-1)*15,09,temps,
chan_attr,
pattern_bckg+pattern_4op_indic);
end;
If scroll_bars then
begin
scroll_pos2 := vscroll_bar(MAX_COLUMNS-2,08,MAX_PATTERN_ROWS+4,PRED1(songdata.patt_len),
page,scroll_pos2,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
scroll_pos3 := hscroll_bar(MAX_COLUMNS-14,MAX_PATTERN_ROWS+12,13,PRED1(songdata.nm_tracks),PRED(count_channel(pattern_hpos)),
scroll_pos3,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
If (pattern_patt <= PRED(max_patterns)) then
scroll_pos4 := vscroll_bar(MAX_COLUMNS-1,08,MAX_PATTERN_ROWS+4,PRED(max_patterns),
pattern_patt,scroll_pos4,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_2nd_mark)
else
scroll_pos4 := vscroll_bar(MAX_COLUMNS-1,08,MAX_PATTERN_ROWS+4,1,1,BYTE_NULL,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
end
else
begin
scroll_pos2 := vscroll_bar(MAX_COLUMNS-2,08,MAX_PATTERN_ROWS+4,1,1,BYTE_NULL,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
scroll_pos3 := hscroll_bar(MAX_COLUMNS-14,MAX_PATTERN_ROWS+12,13,1,1,BYTE_NULL,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
scroll_pos4 := vscroll_bar(MAX_COLUMNS-1,08,MAX_PATTERN_ROWS+4,1,1,BYTE_NULL,
scrollbar_bckg+scrollbar_text,
scrollbar_bckg+scrollbar_mark);
end;
end;
procedure PATTERN_position_preview(pattern,line,channel,mode: Byte);
begin
{$IFDEF GO32V2}
_last_debug_str_ := _debug_str_;
_debug_str_ := 'IPATTERN.INC:PATTERN_position_preview';
{$ENDIF}
If (mode = 0) then
begin
old_pattern_patt := pattern_patt;
old_pattern_page := pattern_page;
old_pattern_hpos := pattern_hpos;
old_chan_pos := chan_pos;
old_block_xstart := block_xstart;
old_block_ystart := block_ystart;
old_marking := marking;
end
else If (mode = 1) then
begin
pattern_patt := pattern;
pattern_page := line;
If (channel > chan_pos+MAX_TRACKS-1) then
While (channel > chan_pos+MAX_TRACKS-1) do Inc(chan_pos)
else While (channel < chan_pos) do Dec(chan_pos);
While (channel > chan_pos+MAX_TRACKS-1) and (chan_pos < last_chan_pos) do Inc(chan_pos);
If (count_channel(pattern_hpos) < channel) then
While (count_channel(pattern_hpos) <> channel) do Inc(pattern_hpos)
else While (count_channel(pattern_hpos) <> channel) do Dec(pattern_hpos);
While (count_pos(pattern_hpos) <> 0) do Dec(pattern_hpos);
block_xstart := count_channel(pattern_hpos);
block_ystart := line;
marking := TRUE;
cancel_note_recorder;
discard_block := TRUE;
PATTERN_ORDER_page_refresh(pattord_page);
PATTERN_page_refresh(pattern_page);
end
else If (mode = BYTE_NULL) then
begin
pattern_patt := old_pattern_patt;
pattern_page := old_pattern_page;
pattern_hpos := old_pattern_hpos;
chan_pos := old_chan_pos;
block_xstart := old_block_xstart;
block_ystart := old_block_ystart;
marking := old_marking;
discard_block := FALSE;
PATTERN_ORDER_page_refresh(pattord_page);
PATTERN_page_refresh(pattern_page);
end;
end;
function PATTERN_trace: Word;
var
old_pattord_page,old_pattord_hpos,old_pattord_vpos: Byte;
old_pattern_patt,old_pattern_page,old_pattern_hpos: Byte;
nope,flag,reset_pos: Boolean;
temp,temp2,fkey2: Word;
idx,idx2,track_ch,curr_ch: Byte;
patt_nm,line_nm,dif1,dif2: Byte;
track_ch_key: array[1..20] of Byte;
old_hpos: Byte;
temps: String;
chunk,chunk2: tCHUNK;
procedure pause_debugging;
begin
If debugging then
begin
debugging := FALSE;
replay_forbidden := TRUE;
play_status := isPaused;
PATTERN_ORDER_page_refresh(pattord_page);
PATTERN_page_refresh(pattern_page);
end;
end;
label _end;
begin
{$IFDEF GO32V2}
_last_debug_str_ := _debug_str_;
_debug_str_ := 'IPATTERN.INC:PATTERN_trace';
{$ENDIF}
If (play_status = isStopped) then EXIT;
_traceprc_last_order := BYTE_NULL;
_traceprc_last_pattern := BYTE_NULL;
_traceprc_last_line := BYTE_NULL;
HideCursor;
old_pattord_page := pattord_page;
old_pattord_hpos := pattord_hpos;
old_pattord_vpos := pattord_vpos;
old_pattern_patt := pattern_patt;
old_pattern_page := pattern_page;
old_pattern_hpos := pattern_hpos;
reset_pos := TRUE;
tracing := TRUE;
If marking then
begin
tracing_block_pattern := pattern_patt;
tracing_block_xend := count_channel(pattern_hpos);
tracing_block_yend := pattern_page;
end;
Repeat
nope := FALSE;
trace_update_proc;
If ctrl_pressed and alt_pressed then
begin
DEBUG_INFO;
PATTERN_ORDER_page_refresh(pattord_page);
PATTERN_page_refresh(pattern_page);
end;
old_hpos := pattern_hpos;
If keypressed then fkey2 := getkey
else If NOT (seconds_counter >= ssaver_time) then GOTO _end //CONTINUE
else begin
screen_saver;
GOTO _end; //CONTINUE;
end;
If track_notes and midiboard then
begin
curr_ch := track_chan_start;
track_ch := 0;
flag := FALSE;
FillChar(track_ch_key,SizeOf(track_ch_key),BYTE_NULL);
If NOT ctrl_pressed and NOT alt_pressed then
For idx := 1 to 29 do
If (scankey(board_scancodes[idx])) then
begin
flag := TRUE;
If (track_ch < nm_track_chan) then Inc(track_ch)
else BREAK;
track_ch_key[track_ch] := idx;
end;
If (fkey2 = kWeird) or (flag AND track_notes) then
begin
idx2 := 1;
For idx := 1 to nm_track_chan do
begin
If (fkey2 = kWeird) or
((track_ch_key[idx2] <> BYTE_NULL) and
(track_ch_key[idx2]+12*(current_octave-1) in [1..12*8+1])) then
begin
If NOT (jump_mark_mode and mark_lines) and
(rec_correction <> 0) then
begin
patt_nm := HI(play_pos_buf[rec_correction]);
line_nm := LO(play_pos_buf[rec_correction]);
end
else
begin
patt_nm := current_pattern;
line_nm := current_line;
end;
If (jump_mark_mode and mark_lines and (line_nm MOD mark_line <> 0)) then
begin
dif1 := line_nm;
While (dif1 MOD mark_line <> 0) and (dif1 <= songdata.patt_len) do
Inc(dif1);
If (dif1 > songdata.patt_len) then
dif1 := 0;
dif2 := line_nm;
While (dif2 MOD mark_line <> 0) and (dif2 > 0) do
Dec(dif2);
If (Abs(dif1-line_nm) <= Abs(line_nm-dif2)) then line_nm := dif1
else line_nm := dif2;
end;
get_chunk(patt_nm,line_nm,curr_ch+idx-1,chunk);
If (fkey2 <> kWeird) then
begin
If NOT right_shift_pressed then
chunk.note := track_ch_key[idx2]+12*(current_octave-1)
else chunk.note := track_ch_key[idx2]+12*(current_octave-1)+fixed_note_flag;
If NOT (chunk.effect_def in [ef_TonePortamento,
ef_TPortamVolSlide]) then
begin
If track_notes_ins then
chunk.instr_def := current_inst
else chunk.instr_def := min(voice_table[curr_ch+idx-1],1);
If is_4op_chan(curr_ch+idx-1) and
(curr_ch+idx-1 in _4op_tracks_lo) then
begin
get_chunk(patt_nm,line_nm,PRED(curr_ch)+idx-1,chunk2);
chunk2.note := 0;
If NOT track_notes or track_notes_ins then
If (HI(get_4op_to_test) <> 0) then
chunk2.instr_def := HI(get_4op_to_test)
else chunk2.instr_def := current_inst
else chunk2.instr_def := min(voice_table[PRED(curr_ch)+idx-1],1);
If channel_flag[PRED(curr_ch)+idx-1] then
put_chunk(patt_nm,line_nm,PRED(curr_ch)+idx-1,chunk2);
end
else
If is_4op_chan(curr_ch+idx-1) and
(curr_ch+idx-1 in _4op_tracks_hi) then
begin
get_chunk(patt_nm,line_nm,SUCC(curr_ch)+idx-1,chunk2);
chunk2.note := 0;
If NOT track_notes or track_notes_ins then
If (LO(get_4op_to_test) <> 0) then
chunk2.instr_def := LO(get_4op_to_test)
else chunk2.instr_def := current_inst
else chunk2.instr_def := min(voice_table[SUCC(curr_ch)+idx-1],1);
If channel_flag[SUCC(curr_ch)+idx-1] then
put_chunk(patt_nm,line_nm,SUCC(curr_ch)+idx-1,chunk2);
end;
end;
end
else begin
chunk.note := BYTE_NULL;
chunk.instr_def := 0;
end;
If channel_flag[curr_ch+idx-1] and
NOT ignore_note_once[curr_ch+idx-1] then
begin
ignore_note_once[curr_ch+idx-1] := TRUE;
put_chunk(patt_nm,line_nm,curr_ch+idx-1,chunk);
If (patt_nm <> current_pattern) or (line_nm <= current_line) then
begin
If (chunk.instr_def <> 0) then
load_instrument(songdata.instr_data[chunk.instr_def],curr_ch+idx-1);
If is_4op_chan(curr_ch+idx-1) then
If (curr_ch+idx-1 in _4op_tracks_lo) then
begin
get_chunk(patt_nm,line_nm,PRED(curr_ch)+idx-1,chunk2);
load_instrument(songdata.instr_data[chunk2.instr_def],PRED(curr_ch)+idx-1);