/[projet1]/public/oric/routines/vortex/pascal/MC68KPT3.PAS
Defence Force logotype

Contents of /public/oric/routines/vortex/pascal/MC68KPT3.PAS

Parent Directory Parent Directory | Revision Log Revision Log


Revision 341 - (show annotations)
Tue Jun 8 20:23:31 2010 UTC (9 years, 3 months ago) by dbug
File size: 22013 byte(s)
Added the original pascal player for the Vortex player
1 {
2 ZX Spectrum Pro Tracker 3.0x - 3.6x modules player
3 Designed to compile for Atari ST with MC68000 processor
4 Used in Vortex Tracker II in PT3 to SNDH converter
5 To work on other MC68K based systems simply replace 'ROut' procedure
6 Based on Ay_Emul sources, tables packed via Ivan Roshin's algorithms
7
8 (c)2003-2006 S.V.Bulba
9
10 http://bulba.at.kz is
11 - Micro ST (Win32 SNDH player)
12 - AY Emulator (Win32 AY-3-8910/12 and YM2149F emulator/player/converter/ripper
13 - Vortex Tracker II (Win32 AY/YM music editor)
14 - and many other AY/YM soundchips related
15
16 Author Sergey Bulba <vorobey@mail.khstu.ru>
17 }
18 program MC68KPT3;
19
20 type
21
22 BytePtr = ^byte;
23
24 TModTypes = packed record
25 case Integer of
26 0: (Index:array[0..65535] of byte);
27 1: (PT3_MusicName:array[0..$62]of char;
28 PT3_TonTableId:byte;
29 PT3_Delay:byte;
30 PT3_NumberOfPositions:byte;
31 PT3_LoopPosition:byte;
32 PT3_PatternsPointer:word;
33 PT3_SamplesPointers:array[0..31]of word;
34 PT3_OrnamentsPointers:array[0..15]of word;
35 PT3_PositionList:array[0..65535-201]of byte);
36 end;
37
38 TRegisterAY = packed record
39 case Integer of
40 0:(Index:array[0..13] of byte);
41 1:(TonA,TonB,TonC: word;
42 Noise:byte;
43 Mixer:byte;
44 AmplitudeA,AmplitudeB,AmplitudeC:byte;
45 EnvelopeL:byte;
46 EnvelopeH:byte;
47 EnvType:byte);
48 end;
49
50 PT3_Channel_Parameters = record
51 Address_In_Pattern,
52 OrnamentPointer,
53 SamplePointer,
54 Ton:word;
55 Loop_Ornament_Position,
56 Ornament_Length,
57 Position_In_Ornament,
58 Loop_Sample_Position,
59 Sample_Length,
60 Position_In_Sample,
61 Volume,
62 Number_Of_Notes_To_Skip,
63 Note,
64 Slide_To_Note,
65 Amplitude:byte;
66 Envelope_Enabled,
67 Enabled,
68 SimpleGliss:boolean;
69 Current_Amplitude_Sliding,
70 Current_Noise_Sliding,
71 Current_Envelope_Sliding,
72 Ton_Slide_Count,
73 Current_OnOff,
74 OnOff_Delay,
75 OffOn_Delay,
76 Ton_Slide_Delay,
77 Current_Ton_Sliding,
78 Ton_Accumulator,
79 Ton_Slide_Step,
80 Ton_Delta:integer;
81 Note_Skip_Counter:shortint;
82 Dump:byte;
83 end;
84
85 PT3_Parameters = record
86 PT3_Version:integer;
87 Cur_Env_Slide,
88 Env_Slide_Add:integer;
89 PatPtr:word;
90 Cur_Env_Delay,
91 Env_Delay:shortint;
92 Noise_Base,
93 Delay,
94 AddToNoise,
95 DelayCounter,
96 CurrentPosition:byte;
97 Dump:byte;
98 end;
99
100 PT3ToneTable = array[0..95] of word;
101 PT3VolTable = array[0..15,0..15] of byte;
102
103 TPlVars = record
104 T_PACK:array[0..53] of byte;
105 TC:array[0..65] of byte;
106 NT_DATA:array[0..7,0..1]of byte;
107 VT_:record
108 case integer of
109 0:(VT:PT3VolTable); //Created Volume Table
110 1:(R:TRegisterAY;
111 Env_Base:word;
112 TT:array[0..49-1]of word); //Tone tables data temporary depacked here
113 2:(V:array[0..255]of byte);
114 end;
115 NT_:PT3ToneTable; //Created Note Table
116 PT3:PT3_Parameters;PT3_A,PT3_B,PT3_C:PT3_Channel_Parameters;
117 RAM:TModTypes;
118 end;
119
120 const
121 //9 tables total are:
122 {Table #0 of Pro Tracker 3.3x - 3.4r}
123 {Table #0 of Pro Tracker 3.4x - 3.5x}
124 {Table #1 of Pro Tracker 3.3x - 3.5x)}
125 {Table #2 of Pro Tracker 3.4r}
126 {Table #2 of Pro Tracker 3.4x - 3.5x}
127 {Table #3 of Pro Tracker 3.4r}
128 {Table #3 of Pro Tracker 3.4x - 3.5x}
129 {Volume table of Pro Tracker 3.3x - 3.4x}
130 {Volume table of Pro Tracker 3.5x}
131
132 //first 12 values of tone tables (packed)
133 T_PACK1:array[0..53] of byte =
134 ($06EC*2 div 256,$06EC*2 mod 256,
135 $0755-$06EC,
136 $07C5-$0755,
137 $083B-$07C5,
138 $08B8-$083B,
139 $093D-$08B8,
140 $09CA-$093D,
141 $0A5F-$09CA,
142 $0AFC-$0A5F,
143 $0BA4-$0AFC,
144 $0C55-$0BA4,
145 $0D10-$0C55,
146 $066D*2 div 256,$066D*2 mod 256,
147 $06CF-$066D,
148 $0737-$06CF,
149 $07A4-$0737,
150 $0819-$07A4,
151 $0894-$0819,
152 $0917-$0894,
153 $09A1-$0917,
154 $0A33-$09A1,
155 $0ACF-$0A33,
156 $0B73-$0ACF,
157 $0C22-$0B73,
158 $0CDA-$0C22,
159 $0704*2 div 256,$0704*2 mod 256,
160 $076E-$0704,
161 $07E0-$076E,
162 $0858-$07E0,
163 $08D6-$0858,
164 $095C-$08D6,
165 $09EC-$095C,
166 $0A82-$09EC,
167 $0B22-$0A82,
168 $0BCC-$0B22,
169 $0C80-$0BCC,
170 $0D3E-$0C80,
171 $07E0*2 div 256,$07E0*2 mod 256,
172 $0858-$07E0,
173 $08E0-$0858,
174 $0960-$08E0,
175 $09F0-$0960,
176 $0A88-$09F0,
177 $0B28-$0A88,
178 $0BD8-$0B28,
179 $0C80-$0BD8,
180 $0D60-$0C80,
181 $0E10-$0D60,
182 $0EF8-$0E10,
183 0{Dummy});
184
185 //tone tables corrections
186 TCOLD_0 = 0;
187 TCOLD_1 = 12;
188 TCOLD_2 = 14;
189 TCOLD_3 = 33;
190 TCNEW_0 = 42;
191 TCNEW_1 = TCOLD_1;
192 TCNEW_2 = 53;
193 TCNEW_3 = 32;
194 TC1:array[0..65] of byte =
195 ($00+1,$04+1,$08+1,$0A+1,$0C+1,$0E+1,$12+1,$14+1,
196 $18+1,$24+1,$3C+1,0,
197 $5C+1,0,
198 $30+1,$36+1,$4C+1,$52+1,$5E+1,$70+1,$82,$8C,$9C,
199 $9E,$A0,$A6,$A8,$AA,$AC,$AE,$AE,0,
200 $56+1,
201 $1E+1,$22+1,$24+1,$28+1,$2C+1,$2E+1,$32+1,$BE+1,0,
202 $1C+1,$20+1,$22+1,$26+1,$2A+1,$2C+1,$30+1,$54+1,
203 $BC+1,$BE+1,0,
204 $1A+1,$20+1,$24+1,$28+1,$2A+1,$3A+1,$4C+1,$5E+1,
205 $BA+1,$BC+1,$BE+1,0,
206 0{Dummy});
207
208 //first 12 values of tone tables (depacked structure)
209 T_OLD_1 = 0;
210 T_OLD_2 = T_OLD_1+24;
211 T_OLD_3 = T_OLD_2+24;
212 T_OLD_0 = T_OLD_3+2;
213 T_NEW_0 = T_OLD_0;
214 T_NEW_1 = T_OLD_1;
215 T_NEW_2 = T_NEW_0+24;
216 T_NEW_3 = T_OLD_3;
217
218 NT_DATA1:array[0..7,0..1]of byte =
219 ((T_NEW_0,TCNEW_0),
220 (T_OLD_0+1,TCOLD_0),
221 (T_NEW_1+1,TCNEW_1),
222 (T_OLD_1+1,TCOLD_1),
223 (T_NEW_2,TCNEW_2),
224 (T_OLD_2,TCOLD_2),
225 (T_NEW_3,TCNEW_3),
226 (T_OLD_3,TCOLD_3));
227
228 var
229 PVars:^TPlVars;
230
231 procedure ROut;
232 var
233 i:integer;
234 begin
235 with PVars^ do
236 begin
237 for i := 0 to 12 do
238 begin
239 BytePtr($FF8800)^ := i;
240 BytePtr($FF8802)^ := VT_.R.Index[i]
241 end;
242 if shortint(VT_.R.EnvType) <> -1 then
243 begin
244 BytePtr($FF8800)^ := 13;
245 BytePtr($FF8802)^ := VT_.R.EnvType
246 end
247 end
248 end;
249
250 function MW(L,H:byte):word;
251 begin
252 MW := L + (word(H) shl 8)
253 end;
254
255 function IW(W:word):word;
256 begin
257 IW := (W shl 8) or (W shr 8)
258 end;
259
260 procedure PT3Init;
261 var
262 i,j,k,l,m:integer;
263 a:byte;
264 w:word;
265 fl:boolean;
266 begin
267 with PVars^ do
268 begin
269
270 for i := 0 to sizeof(VT_) + sizeof(NT_) + sizeof(PT3) + sizeof(PT3_A)*3 - 1 do
271 VT_.V[i] := 0;
272 (*256{vt} + 192{nt} + 16{pt3} + 48*3{pt3_a+pt3_b+pt3_c}*)
273
274 //note table data depacker
275 i := 0; j := 49-1;
276 repeat
277 a := T_PACK[i]; inc(i);
278 if a < 15*2 then
279 begin
280 w := word(a) shl 8 + T_PACK[i]; inc(i);
281 end
282 else
283 inc(w,a + a);
284 VT_.TT[j] := w; dec(j);
285 until j < 0;
286
287 with PT3,RAM do
288 begin
289 PT3_Version := 6;
290 if (Index[13] >= $30) and (Index[13] <= $39) then
291 PT3_Version := Index[13] - $30;
292
293 //NoteTableCreator (c) Ivan Roshin
294 //A - NoteTableNumber*2+VersionForNoteTable
295 //(xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0)
296 a := (PT3_TonTableId shl 1) and 7;
297 if PT3_Version < 4 then inc(a);
298
299 j := NT_DATA[a,0];
300 fl := (j and 1) <> 0;
301 j := j shr 1;
302 for i := 0 to 11 do
303 begin
304 w := VT_.TT[j]; inc(j);
305 l := i;
306 for k := 0 to 7 do
307 begin
308 m := Ord(not fl and ((w and 1) <> 0));
309 w := w shr 1;
310 NT_[l] := w + m;
311 inc(l,12);
312 end;
313 end;
314
315 j := NT_DATA[a,1];
316 if j = TCOLD_1 then NT_[23] := $3FD;
317 repeat
318 i := TC[j]; if i = 0 then break;
319 if i and 1 <> 0 then
320 dec(NT_[i shr 1])
321 else
322 inc(NT_[i shr 1]);
323 inc(j);
324 until False;
325
326 //VolTableCreator (c) Ivan Roshin
327 //VersionForVolumeTable (0..4 - 3.xx..3.4x; 5.. - 3.5x..3.6x..VTII1.0)
328
329 w := 0;
330 i := $11;
331 fl := PT3_Version >= 5;
332 if not fl then
333 begin
334 w := $10;
335 i := $10;
336 end;
337
338 j := 16;
339 repeat
340 inc(w,i);
341 l := 0;
342 repeat
343 k := l shr 8;
344 if fl and ((l and 128) <> 0) then inc(k);
345 VT_.V[j] := k;
346 inc(l,w);
347 inc(j)
348 until (j and 15) = 0;
349 if (w and 255) = $77 then inc(w);
350 until j = 256;
351
352
353 DelayCounter := 1;
354 Delay := PT3_Delay;
355 PatPtr := MW(Index[103],Index[104]);
356 w := PatPtr + PT3_PositionList[0] * 2;
357 PT3_A.Address_In_Pattern := MW(Index[w + 0],Index[w + 1]);
358 PT3_B.Address_In_Pattern := MW(Index[w + 2],Index[w + 3]);
359 PT3_C.Address_In_Pattern := MW(Index[w + 4],Index[w + 5])
360 end;
361
362 with PT3_A,RAM do
363 begin
364 OrnamentPointer := MW(Index[169],Index[170]);
365 Loop_Ornament_Position := Index[OrnamentPointer];
366 inc(OrnamentPointer);
367 Ornament_Length := Index[OrnamentPointer];
368 inc(OrnamentPointer);
369 SamplePointer := MW(Index[107],Index[108]);
370 Loop_Sample_Position := Index[SamplePointer];
371 inc(SamplePointer);
372 Sample_Length := Index[SamplePointer];
373 inc(SamplePointer);
374 Volume := 15;
375 Note_Skip_Counter := 1;
376 end;
377
378 with PT3_B do
379 begin
380 OrnamentPointer := PT3_A.OrnamentPointer;
381 Loop_Ornament_Position := PT3_A.Loop_Ornament_Position;
382 Ornament_Length := PT3_A.Ornament_Length;
383 SamplePointer := PT3_A.SamplePointer;
384 Loop_Sample_Position := PT3_A.Loop_Sample_Position;
385 Sample_Length := PT3_A.Sample_Length;
386 Volume := 15;
387 Note_Skip_Counter := 1;
388 end;
389
390 with PT3_C do
391 begin
392 OrnamentPointer := PT3_A.OrnamentPointer;
393 Loop_Ornament_Position := PT3_A.Loop_Ornament_Position;
394 Ornament_Length := PT3_A.Ornament_Length;
395 SamplePointer := PT3_A.SamplePointer;
396 Loop_Sample_Position := PT3_A.Loop_Sample_Position;
397 Sample_Length := PT3_A.Sample_Length;
398 Volume := 15;
399 Note_Skip_Counter := 1;
400 end;
401
402 end;
403
404 ROut
405
406 end;
407
408 procedure Pl;
409
410 procedure P(var Chan:PT3_Channel_Parameters);
411 var
412 quit:boolean;
413 Flag9,Flag8,Flag5,Flag4,
414 Flag3,Flag2,Flag1:byte;
415 counter:byte;
416 PrNote,PrSliding:integer;
417 wp:word;
418 begin
419 PrNote := Chan.Note;
420 PrSliding := Chan.Current_Ton_Sliding;
421 quit := False;
422 counter := 0;
423 Flag9 := 0; Flag8 := 0; Flag5 := 0; Flag4 := 0;
424 Flag3 := 0; Flag2 := 0; Flag1 := 0;
425 with PVars^ do
426 with Chan,RAM do
427 begin
428 repeat
429 case Index[Address_In_Pattern] of
430 $f0..$ff:
431 begin
432 wp := 169 + (Index[Address_In_Pattern] - $f0) * 2;
433 OrnamentPointer := MW(Index[wp],Index[wp + 1]);
434 Loop_Ornament_Position := Index[OrnamentPointer];
435 Inc(OrnamentPointer);
436 Ornament_Length := Index[OrnamentPointer];
437 Inc(OrnamentPointer);
438 Inc(Address_In_Pattern);
439 wp := 105 + Index[Address_In_Pattern];
440 SamplePointer := MW(Index[wp],Index[wp + 1]);
441 Loop_Sample_Position := Index[SamplePointer];
442 Inc(SamplePointer);
443 Sample_Length := Index[SamplePointer];
444 Inc(SamplePointer);
445 Envelope_Enabled := False;
446 Position_In_Ornament := 0
447 end;
448 $d1..$ef:
449 begin
450 wp := 105 + (Index[Address_In_Pattern] - $d0) * 2;
451 SamplePointer := MW(Index[wp],Index[wp + 1]);
452 Loop_Sample_Position := Index[SamplePointer];
453 Inc(SamplePointer);
454 Sample_Length := Index[SamplePointer];
455 Inc(SamplePointer)
456 end;
457 $d0:
458 quit := true;
459 $c1..$cf:
460 Volume := Index[Address_In_Pattern] - $c0;
461 $c0:
462 begin
463 Position_In_Sample := 0;
464 Current_Amplitude_Sliding := 0;
465 Current_Noise_Sliding := 0;
466 Current_Envelope_Sliding := 0;
467 Position_In_Ornament := 0;
468 Ton_Slide_Count := 0;
469 Current_Ton_Sliding := 0;
470 Ton_Accumulator := 0;
471 Current_OnOff := 0;
472 Enabled := False;
473 quit := True
474 end;
475 $b2..$bf:
476 begin
477 Envelope_Enabled := True;
478 VT_.R.EnvType := Index[Address_In_Pattern] - $b1;
479 Inc(Address_In_Pattern);
480 with PT3 do
481 begin
482 {not big-endian}
483 VT_.Env_Base := MW(Index[Address_In_Pattern + 1],Index[Address_In_Pattern]);
484 Inc(Address_In_Pattern);
485 Position_In_Ornament := 0;
486 Cur_Env_Slide := 0;
487 Cur_Env_Delay := 0
488 end
489 end;
490 $b1:
491 begin
492 inc(Address_In_Pattern);
493 Number_Of_Notes_To_Skip := Index[Address_In_Pattern]
494 end;
495 $b0:
496 begin
497 Envelope_Enabled := False;
498 Position_In_Ornament := 0
499 end;
500 $50..$af:
501 begin
502 Note := Index[Address_In_Pattern] - $50;
503 Position_In_Sample := 0;
504 Current_Amplitude_Sliding := 0;
505 Current_Noise_Sliding := 0;
506 Current_Envelope_Sliding := 0;
507 Position_In_Ornament := 0;
508 Ton_Slide_Count := 0;
509 Current_Ton_Sliding := 0;
510 Ton_Accumulator := 0;
511 Current_OnOff := 0;
512 Enabled := True;
513 quit := True
514 end;
515 $40..$4f:
516 begin
517 wp := 169 + (Index[Address_In_Pattern] - $40) * 2;
518 OrnamentPointer := MW(Index[wp],Index[wp + 1]);
519 Loop_Ornament_Position := Index[Chan.OrnamentPointer];
520 Inc(OrnamentPointer);
521 Ornament_Length := Index[OrnamentPointer];
522 Inc(OrnamentPointer);
523 Position_In_Ornament := 0
524 end;
525 $20..$3f:
526 PT3.Noise_Base := Index[Address_In_Pattern] - $20;
527 $10..$1f:
528 begin
529 if Index[Address_In_Pattern] = $10 then
530 Envelope_Enabled := False
531 else
532 begin
533 VT_.R.EnvType := Index[Address_In_Pattern] - $10;
534 Inc(Address_In_Pattern);
535 with PT3 do
536 begin
537 {not big-endian}
538 VT_.Env_Base := MW(Index[Address_In_Pattern + 1],Index[Address_In_Pattern]);
539 Inc(Address_In_Pattern);
540 Envelope_Enabled := True;
541 Cur_Env_Slide := 0;
542 Cur_Env_Delay := 0
543 end
544 end;
545 Inc(Address_In_Pattern);
546 wp := 105 + Index[Address_In_Pattern];
547 SamplePointer := MW(Index[wp],Index[wp + 1]);
548 Loop_Sample_Position := Index[SamplePointer];
549 Inc(SamplePointer);
550 Sample_Length := Index[SamplePointer];
551 Inc(SamplePointer);
552 Position_In_Ornament := 0
553 end;
554 $9:
555 begin
556 Inc(counter);
557 Flag9 := counter
558 end;
559 $8:
560 begin
561 Inc(counter);
562 Flag8 := counter
563 end;
564 $5:
565 begin
566 Inc(counter);
567 Flag5 := counter
568 end;
569 $4:
570 begin
571 Inc(counter);
572 Flag4 := counter
573 end;
574 $3:
575 begin
576 Inc(counter);
577 Flag3 := counter
578 end;
579 $2:
580 begin
581 Inc(counter);
582 Flag2 := counter
583 end;
584 $1:
585 begin
586 Inc(counter);
587 Flag1 := counter
588 end
589 end;
590 inc(Address_In_Pattern)
591 until quit;
592 while counter > 0 do
593 begin
594 if (counter = Flag1) then
595 begin
596 Ton_Slide_Delay := Index[Address_In_Pattern];
597 Ton_Slide_Count := Ton_Slide_Delay;
598 Inc(Address_In_Pattern);
599 Ton_Slide_Step := MW(Index[Address_In_Pattern],Index[Address_In_Pattern + 1]);
600 Inc(Address_In_Pattern,2);
601 SimpleGliss := True;
602 Current_OnOff := 0
603 end
604 else if (counter = Flag2) then
605 begin
606 SimpleGliss := False;
607 Current_OnOff := 0;
608 Ton_Slide_Delay := Index[Address_In_Pattern];
609 Ton_Slide_Count := Ton_Slide_Delay;
610 Inc(Address_In_Pattern,3);
611 Ton_Slide_Step := Abs(integer(MW(Index[Address_In_Pattern],Index[Address_In_Pattern + 1])));
612 Inc(Address_In_Pattern,2);
613 Ton_Delta := NT_[Note] - NT_[PrNote];
614 Slide_To_Note := Note;
615 Note := PrNote;
616 if PT3.PT3_Version >= 6 then
617 Current_Ton_Sliding := PrSliding;
618 if Ton_Delta - Current_Ton_Sliding < 0 then
619 Ton_Slide_Step := -Ton_Slide_Step
620 end
621 else if counter = Flag3 then
622 begin
623 Position_in_Sample := Index[Address_In_Pattern];
624 Inc(Address_In_Pattern)
625 end
626 else if counter = Flag4 then
627 begin
628 Position_in_Ornament := Index[Address_In_Pattern];
629 inc(Address_In_Pattern)
630 end
631 else if counter = Flag5 then
632 begin
633 OnOff_Delay := Index[Address_In_Pattern];
634 Inc(Address_In_Pattern);
635 OffOn_Delay := Index[Address_In_Pattern];
636 Current_OnOff := OnOff_Delay;
637 Inc(Address_In_Pattern);
638 Ton_Slide_Count := 0;
639 Current_Ton_Sliding := 0
640 end
641 else if counter = Flag8 then
642 begin
643 with PT3 do
644 begin
645 Env_Delay := Index[Address_In_Pattern];
646 Cur_Env_Delay := Env_Delay;
647 Inc(Address_In_Pattern);
648 Env_Slide_Add := MW(Index[Address_In_Pattern],Index[Address_In_Pattern + 1]);
649 end;
650 Inc(Address_In_Pattern,2)
651 end
652 else if counter = Flag9 then
653 begin
654 PT3.Delay := Index[Address_In_Pattern];
655 Inc(Address_In_Pattern)
656 end;
657 Dec(counter)
658 end;
659 Note_Skip_Counter := Number_Of_Notes_To_Skip
660 end
661 end;
662
663 var
664 TempMixer:byte;
665 AddToEnv:shortint;
666
667 procedure C(var Chan:PT3_Channel_Parameters);
668 var
669 j,b1,b0:byte;
670 w,wp:word;
671 begin
672 with PVars^ do
673 with Chan,RAM do
674 begin
675 if Enabled then
676 begin
677 wp := SamplePointer + Position_In_Sample * 4;
678 Ton := MW(Index[wp + 2],Index[wp + 3]);
679 Inc(Ton,Ton_Accumulator);
680 b0 := Index[wp];
681 b1 := Index[wp + 1];
682 if b1 and $40 <> 0 then
683 Ton_Accumulator := Ton;
684 j := Note + Index[OrnamentPointer + Position_In_Ornament];
685 if shortint(j) < 0 then j := 0
686 else if j > 95 then j := 95;
687 w := NT_[j];
688 Ton := (Ton + Current_Ton_Sliding + w) and $fff;
689 if Ton_Slide_Count > 0 then
690 begin
691 Dec(Ton_Slide_Count);
692 if Ton_Slide_Count = 0 then
693 begin
694 Inc(Current_Ton_Sliding,Ton_Slide_Step);
695 Ton_Slide_Count := Ton_Slide_Delay;
696 if not SimpleGliss then
697 if ((Ton_Slide_Step < 0) and (Current_Ton_Sliding <= Ton_Delta)) or
698 ((Ton_Slide_Step >= 0) and (Current_Ton_Sliding >= Ton_Delta)) then
699 begin
700 Note := Slide_To_Note;
701 Ton_Slide_Count := 0;
702 Current_Ton_Sliding := 0
703 end
704 end
705 end;
706 Amplitude := b1 and $f;
707 if b0 and $80 <> 0 then
708 if b0 and $40 <> 0 then
709 begin
710 if Current_Amplitude_Sliding < 15 then
711 inc(Current_Amplitude_Sliding)
712 end
713 else if Current_Amplitude_Sliding > -15 then
714 dec(Current_Amplitude_Sliding);
715 inc(Amplitude,Current_Amplitude_Sliding);
716 if shortint(Amplitude) < 0 then Amplitude := 0
717 else if Amplitude > 15 then Amplitude := 15;
718 Amplitude := VT_.VT[Volume,Amplitude];
719 if (b0 and 1 = 0) and Envelope_Enabled then
720 Amplitude := Amplitude or 16;
721 if b1 and $80 <> 0 then
722 begin
723 if b0 and $20 <> 0 then
724 j := (b0 shr 1) or $F0 + Current_Envelope_Sliding
725 else
726 j := (b0 shr 1) and $F + Current_Envelope_Sliding;
727 if b1 and $20 <> 0 then Current_Envelope_Sliding := j;
728 Inc(AddToEnv,j)
729 end
730 else
731 begin
732 PT3.AddToNoise := b0 shr 1 + Current_Noise_Sliding;
733 if b1 and $20 <> 0 then
734 Current_Noise_Sliding := PT3.AddToNoise
735 end;
736 TempMixer := b1 shr 1 and $48 or TempMixer;
737 Inc(Position_In_Sample);
738 if Position_In_Sample >= Sample_Length then
739 Position_In_Sample := Loop_Sample_Position;
740 Inc(Position_In_Ornament);
741 if Position_In_Ornament >= Ornament_Length then
742 Position_In_Ornament := Loop_Ornament_Position
743 end
744 else
745 Amplitude := 0;
746 TempMixer := TempMixer shr 1;
747 if Current_OnOff > 0 then
748 begin
749 dec(Current_OnOff);
750 if Current_OnOff = 0 then
751 begin
752 Enabled := not Enabled;
753 if Enabled then Current_OnOff := OnOff_Delay
754 else Current_OnOff := OffOn_Delay
755 end;
756 end
757 end
758 end;
759
760 var
761 wp:word;
762 begin
763
764 with PVars^ do
765 begin
766
767 shortint(VT_.R.EnvType) := -1;
768 with PT3 do
769 begin
770 Dec(DelayCounter);
771 if DelayCounter = 0 then
772 begin
773 with PT3_A do
774 begin
775 Dec(Note_Skip_Counter);
776 if Note_Skip_Counter = 0 then
777 with RAM do
778 begin
779 if (Index[Address_In_Pattern] = 0) then
780 begin
781 inc(CurrentPosition);
782 if CurrentPosition = PT3_NumberOfPositions then
783 CurrentPosition := PT3_LoopPosition;
784 wp := PatPtr + PT3_PositionList[CurrentPosition] * 2;
785 Address_In_Pattern := MW(Index[wp + 0],Index[wp + 1]);
786 PT3_B.Address_In_Pattern := MW(Index[wp + 2],Index[wp + 3]);
787 PT3_C.Address_In_Pattern := MW(Index[wp + 4],Index[wp + 5]);
788 Noise_Base := 0
789 end;
790 P(PT3_A)
791 end
792 end;
793 with PT3_B do
794 begin
795 Dec(Note_Skip_Counter);
796 if Note_Skip_Counter = 0 then
797 P(PT3_B)
798 end;
799 with PT3_C do
800 begin
801 Dec(Note_Skip_Counter);
802 if Note_Skip_Counter = 0 then
803 P(PT3_C)
804 end;
805 DelayCounter := Delay
806 end;
807
808 AddToEnv := 0;
809 TempMixer := 0;
810 C(PT3_A);
811 C(PT3_B);
812 C(PT3_C);
813
814 VT_.R.Mixer := TempMixer;
815
816 VT_.R.TonA := IW(PT3_A.Ton);
817 VT_.R.TonB := IW(PT3_B.Ton);
818 VT_.R.TonC := IW(PT3_C.Ton);
819
820 VT_.R.AmplitudeA := PT3_A.Amplitude;
821 VT_.R.AmplitudeB := PT3_B.Amplitude;
822 VT_.R.AmplitudeC := PT3_C.Amplitude;
823
824 VT_.R.Noise := (Noise_Base + AddToNoise) and 31;
825
826 wp := VT_.Env_Base + AddToEnv + Cur_Env_Slide;
827 VT_.R.EnvelopeL := wp;
828 VT_.R.EnvelopeH := wp shr 8;
829
830 if Cur_Env_Delay > 0 then
831 begin
832 Dec(Cur_Env_Delay);
833 if Cur_Env_Delay = 0 then
834 begin
835 Cur_Env_Delay := Env_Delay;
836 Inc(Cur_Env_Slide,Env_Slide_Add)
837 end
838 end
839 end
840
841 end;
842
843 ROut
844
845 end;
846
847 begin
848 end.

  ViewVC Help
Powered by ViewVC 1.1.26