ADPCM.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.lang.*;
16: import java.util.*;
17:
18: public class ADPCM {
19:
20: public static final boolean PCM_ON = true;
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34: public static final int PCM_SAMPLE_FREQ = 62500;
35: public static final long PCM_SAMPLE_TIME = XEiJ.TMR_FREQ / PCM_SAMPLE_FREQ;
36: public static final int PCM_BLOCK_SAMPLES = PCM_SAMPLE_FREQ / SoundSource.SND_BLOCK_FREQ;
37:
38:
39:
40:
41: public static final int PCM_MAX_REPEAT = PCM_SAMPLE_FREQ * 1024 / 4000000;
42: public static final int[] PCM_SAMPLE_REPEAT = {
43: PCM_SAMPLE_FREQ * 1024 / 8000000,
44: PCM_SAMPLE_FREQ * 768 / 8000000,
45: PCM_SAMPLE_FREQ * 512 / 8000000,
46: PCM_SAMPLE_FREQ * 768 / 8000000,
47: PCM_SAMPLE_FREQ * 1024 / 4000000,
48: PCM_SAMPLE_FREQ * 768 / 4000000,
49: PCM_SAMPLE_FREQ * 512 / 4000000,
50: PCM_SAMPLE_FREQ * 768 / 4000000,
51: PCM_SAMPLE_FREQ * 1024 / 8000000,
52: PCM_SAMPLE_FREQ * 768 / 8000000,
53: PCM_SAMPLE_FREQ * 512 / 8000000,
54: PCM_SAMPLE_FREQ * 768 / 8000000,
55: PCM_SAMPLE_FREQ * 1024 / 16000000,
56: PCM_SAMPLE_FREQ * 768 / 16000000,
57: PCM_SAMPLE_FREQ * 512 / 16000000,
58: PCM_SAMPLE_FREQ * 768 / 16000000,
59: };
60: public static int pcmOSCFreqRequest;
61: public static int pcmOSCFreqMode;
62: public static int pcmOscillator;
63: public static int pcmDivider;
64: public static int pcmRepeat;
65: public static long pcmInterval;
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: public static final int[] pcmDecoderTable = new int[256 * 49];
100: public static int pcmDecoderPointer;
101:
102:
103: public static final int[] pcmBuffer = new int[SoundSource.SND_CHANNELS * (PCM_BLOCK_SAMPLES + PCM_MAX_REPEAT * 2)];
104: public static int pcmPointer;
105:
106:
107: public static long pcmClock;
108:
109:
110: public static boolean pcmOutputOn;
111: public static boolean pcmActive;
112: public static int pcmEncodedData;
113: public static int pcmDecodedData1;
114: public static int pcmDecodedData2;
115: public static int pcmDecodedData3;
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129: public static final boolean PCM_MODIFY_ZERO_ZERO = true;
130: public static final boolean PCM_MODIFY_ZERO_TWICE = false;
131: public static final int[] pcmDecoderTableP = new int[256 * 49];
132: public static final int[] pcmDecoderTableM = new int[256 * 49];
133: public static int pcmZeroPreviousData;
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145: public static final boolean PCM_DECAY_ON = true;
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158: public static final int PCM_INTERPOLATION_CONSTANT = 0;
159: public static final int PCM_INTERPOLATION_LINEAR = 1;
160: public static final int PCM_INTERPOLATION_HERMITE = 2;
161: public static int pcmInterpolationAlgorithm;
162:
163: public static final PIP[][] PCM_INTERPOLATION_MONO = {
164:
165:
166:
167: {
168: PIP.PIP_MONO_CONSTANT_8,
169: PIP.PIP_MONO_CONSTANT_6,
170: PIP.PIP_MONO_CONSTANT_4,
171: PIP.PIP_MONO_CONSTANT_6,
172: PIP.PIP_MONO_CONSTANT_16,
173: PIP.PIP_MONO_CONSTANT_12,
174: PIP.PIP_MONO_CONSTANT_8,
175: PIP.PIP_MONO_CONSTANT_12,
176: PIP.PIP_MONO_CONSTANT_8,
177: PIP.PIP_MONO_CONSTANT_6,
178: PIP.PIP_MONO_CONSTANT_4,
179: PIP.PIP_MONO_CONSTANT_6,
180: PIP.PIP_MONO_CONSTANT_4,
181: PIP.PIP_MONO_CONSTANT_3,
182: PIP.PIP_MONO_CONSTANT_2,
183: PIP.PIP_MONO_CONSTANT_3,
184: },
185:
186: {
187: PIP.PIP_MONO_LINEAR_8,
188: PIP.PIP_MONO_LINEAR_6,
189: PIP.PIP_MONO_LINEAR_4,
190: PIP.PIP_MONO_LINEAR_6,
191: PIP.PIP_MONO_LINEAR_16,
192: PIP.PIP_MONO_LINEAR_12,
193: PIP.PIP_MONO_LINEAR_8,
194: PIP.PIP_MONO_LINEAR_12,
195: PIP.PIP_MONO_LINEAR_8,
196: PIP.PIP_MONO_LINEAR_6,
197: PIP.PIP_MONO_LINEAR_4,
198: PIP.PIP_MONO_LINEAR_6,
199: PIP.PIP_MONO_LINEAR_4,
200: PIP.PIP_MONO_LINEAR_3,
201: PIP.PIP_MONO_LINEAR_2,
202: PIP.PIP_MONO_LINEAR_3,
203: },
204:
205: {
206: PIP.PIP_MONO_HERMITE_8,
207: PIP.PIP_MONO_HERMITE_6,
208: PIP.PIP_MONO_HERMITE_4,
209: PIP.PIP_MONO_HERMITE_6,
210: PIP.PIP_MONO_HERMITE_16,
211: PIP.PIP_MONO_HERMITE_12,
212: PIP.PIP_MONO_HERMITE_8,
213: PIP.PIP_MONO_HERMITE_12,
214: PIP.PIP_MONO_HERMITE_8,
215: PIP.PIP_MONO_HERMITE_6,
216: PIP.PIP_MONO_HERMITE_4,
217: PIP.PIP_MONO_HERMITE_6,
218: PIP.PIP_MONO_HERMITE_4,
219: PIP.PIP_MONO_HERMITE_3,
220: PIP.PIP_MONO_HERMITE_2,
221: PIP.PIP_MONO_HERMITE_3,
222: },
223: };
224:
225: public static final PIP[][] PCM_INTERPOLATION_STEREO = {
226:
227:
228:
229: {
230: PIP.PIP_STEREO_CONSTANT_8,
231: PIP.PIP_STEREO_CONSTANT_6,
232: PIP.PIP_STEREO_CONSTANT_4,
233: PIP.PIP_STEREO_CONSTANT_6,
234: PIP.PIP_STEREO_CONSTANT_16,
235: PIP.PIP_STEREO_CONSTANT_12,
236: PIP.PIP_STEREO_CONSTANT_8,
237: PIP.PIP_STEREO_CONSTANT_12,
238: PIP.PIP_STEREO_CONSTANT_8,
239: PIP.PIP_STEREO_CONSTANT_6,
240: PIP.PIP_STEREO_CONSTANT_4,
241: PIP.PIP_STEREO_CONSTANT_6,
242: PIP.PIP_STEREO_CONSTANT_4,
243: PIP.PIP_STEREO_CONSTANT_3,
244: PIP.PIP_STEREO_CONSTANT_2,
245: PIP.PIP_STEREO_CONSTANT_3,
246: },
247:
248: {
249: PIP.PIP_STEREO_LINEAR_8,
250: PIP.PIP_STEREO_LINEAR_6,
251: PIP.PIP_STEREO_LINEAR_4,
252: PIP.PIP_STEREO_LINEAR_6,
253: PIP.PIP_STEREO_LINEAR_16,
254: PIP.PIP_STEREO_LINEAR_12,
255: PIP.PIP_STEREO_LINEAR_8,
256: PIP.PIP_STEREO_LINEAR_12,
257: PIP.PIP_STEREO_LINEAR_8,
258: PIP.PIP_STEREO_LINEAR_6,
259: PIP.PIP_STEREO_LINEAR_4,
260: PIP.PIP_STEREO_LINEAR_6,
261: PIP.PIP_STEREO_LINEAR_4,
262: PIP.PIP_STEREO_LINEAR_3,
263: PIP.PIP_STEREO_LINEAR_2,
264: PIP.PIP_STEREO_LINEAR_3,
265: },
266:
267: {
268: PIP.PIP_STEREO_HERMITE_8,
269: PIP.PIP_STEREO_HERMITE_6,
270: PIP.PIP_STEREO_HERMITE_4,
271: PIP.PIP_STEREO_HERMITE_6,
272: PIP.PIP_STEREO_HERMITE_16,
273: PIP.PIP_STEREO_HERMITE_12,
274: PIP.PIP_STEREO_HERMITE_8,
275: PIP.PIP_STEREO_HERMITE_12,
276: PIP.PIP_STEREO_HERMITE_8,
277: PIP.PIP_STEREO_HERMITE_6,
278: PIP.PIP_STEREO_HERMITE_4,
279: PIP.PIP_STEREO_HERMITE_6,
280: PIP.PIP_STEREO_HERMITE_4,
281: PIP.PIP_STEREO_HERMITE_3,
282: PIP.PIP_STEREO_HERMITE_2,
283: PIP.PIP_STEREO_HERMITE_3,
284: },
285: };
286: public static PIP pcmInterpolationEngine;
287:
288:
289:
290: public static final int PCM_ATTACK_RATE = 10;
291: public static final int PCM_ATTACK_SPAN = 1 << PCM_ATTACK_RATE;
292: public static final int PCM_ATTACK_MASK = PCM_ATTACK_SPAN - 1;
293: public static final int PCM_ATTACK_SHIFT = 14;
294: public static final int[] pcmAttackCurve = new int[PCM_ATTACK_SPAN * 4];
295:
296:
297:
298:
299:
300:
301: public static int pcmPanLeft;
302: public static int pcmPanRight;
303:
304: public static int pcmLastPan;
305:
306:
307:
308: public static void pcmInit () {
309:
310:
311: pcmActive = false;
312: pcmEncodedData = -1;
313: pcmDecodedData1 = 0;
314: pcmDecodedData2 = 0;
315: pcmDecodedData3 = 0;
316:
317:
318:
319:
320: int[] d4 = new int[16 * 49];
321: int[] p4 = new int[16 * 49];
322: int[] deltaP = new int[] { -1, -1, -1, -1, 2, 4, 6, 8 };
323: for (int p = 0; p < 49; p++) {
324: int x = (int) Math.floor (16.0 * Math.pow (1.1, p));
325:
326: for (int n = 0; n < 16; n++) {
327: int i = p << 4 | n;
328: if (true) {
329: int t = ((((n & 7) << 1) | 1) * x) >> 3;
330: d4[i] = (n & 8) == 0 ? t : -t;
331: } else {
332: d4[i] = (1 - (n >> 2 & 2)) * ((n >> 2 & 1) * x + (n >> 1 & 1) * (x >> 1) + (n & 1) * (x >> 2) + (x >> 3));
333: }
334: p4[i] = Math.max (0, Math.min (48, p + deltaP[n & 7]));
335: if (false) {
336: System.out.printf ("(%2d,%2d,%5d,%2d),", p, n, d4[i], p4[i]);
337: if ((n & 7) == 7) {
338: System.out.println ();
339: }
340: }
341: }
342: }
343:
344:
345:
346:
347: for (int p = 0; p < 49; p++) {
348: for (int n2 = 0; n2 < 16; n2++) {
349: int i4 = p << 8 | n2 << 4;
350: for (int n1 = 0; n1 < 16; n1++) {
351: int i = p << 4 | n1;
352: int delta1 = d4[i];
353: i = p4[i] << 4 | n2;
354: int delta2 = d4[i];
355: int q = p4[i];
356: int t = delta1 << 19 | (delta2 & 8191) << 6 | q;
357: pcmDecoderTable[i4 | n1] = t;
358: if (PCM_MODIFY_ZERO_ZERO) {
359:
360:
361: pcmDecoderTableP[i4 | n1] = n1 == 0 && n2 == 0 ? (t ^ -1 << 19) + (1 << 19) : t;
362: pcmDecoderTableM[i4 | n1] = n1 == 8 && n2 == 8 ? (t ^ -1 << 19) + (1 << 19) : t;
363: }
364: }
365: }
366: }
367: if (PCM_MODIFY_ZERO_TWICE) {
368: pcmZeroPreviousData = -1;
369: }
370:
371:
372:
373:
374: for (int i = 0; i < PCM_ATTACK_SPAN; i++) {
375: pcmAttackCurve[i] =
376: (int) Math.round (0.5 * (double) (1 << PCM_ATTACK_SHIFT) *
377: (1.0 + Math.cos (Math.PI / (double) PCM_ATTACK_SPAN * (double) i)));
378: pcmAttackCurve[PCM_ATTACK_SPAN * 2 + i] =
379: (int) Math.round (0.5 * (double) (1 << PCM_ATTACK_SHIFT) *
380: (1.0 + Math.cos (Math.PI / (double) PCM_ATTACK_SPAN * (double) i)));
381: }
382: Arrays.fill (pcmAttackCurve, PCM_ATTACK_SPAN, PCM_ATTACK_SPAN * 2, 0);
383: Arrays.fill (pcmAttackCurve, PCM_ATTACK_SPAN * 3, PCM_ATTACK_SPAN * 4, 1 << PCM_ATTACK_SHIFT);
384: pcmPanLeft = 0;
385: if (SoundSource.SND_CHANNELS == 2) {
386: pcmPanRight = 0;
387: }
388:
389:
390:
391: pcmReset ();
392: }
393:
394:
395: public static void pcmReset () {
396:
397:
398: pcmOSCFreqMode = 0;
399: pcmOscillator = 0;
400: pcmDivider = 2;
401: pcmUpdateRepeatInterval ();
402: pcmLastPan = 0;
403: pcmSetPan (pcmLastPan);
404:
405: pcmDecoderPointer = 0;
406:
407: Arrays.fill (pcmBuffer, 0);
408: pcmPointer = 0;
409:
410: pcmClock = XEiJ.FAR_FUTURE;
411: TickerQueue.tkqRemove (SoundSource.sndPcmTicker);
412:
413: pcmActive = false;
414: pcmEncodedData = -1;
415: }
416:
417:
418:
419: public static void pcmUpdateRepeatInterval () {
420: pcmRepeat = PCM_SAMPLE_REPEAT[pcmOSCFreqMode << 3 | pcmOscillator << 2 | pcmDivider];
421: pcmInterval = PCM_SAMPLE_TIME * 2 * pcmRepeat;
422: pcmSetInterpolationAlgorithm (pcmInterpolationAlgorithm);
423: }
424:
425:
426:
427: public static void pcmSetInterpolationAlgorithm (int algorithm) {
428: pcmInterpolationAlgorithm = algorithm;
429: pcmInterpolationEngine = (SoundSource.SND_CHANNELS == 1 ? PCM_INTERPOLATION_MONO : PCM_INTERPOLATION_STEREO)
430: [algorithm][pcmOSCFreqMode << 3 | pcmOscillator << 2 | pcmDivider];
431: }
432:
433:
434:
435: public static void pcmSetOutputOn (boolean on) {
436: pcmOutputOn = on;
437: pcmSetPan (pcmLastPan);
438: }
439:
440:
441:
442:
443:
444:
445: public static void pcmSetPan (int pan) {
446: pcmLastPan = pan;
447: boolean on0 = !(pcmPanLeft == 0 || pcmPanLeft < 0x80000000 + PCM_ATTACK_SPAN * 2);
448: boolean on1 = pcmOutputOn && (SoundSource.SND_CHANNELS == 1 ? (pan & 3) != 3 : (pan & 2) == 0);
449: if (on0 != on1) {
450: if (on1) {
451: if (pcmPanLeft < 0x80000000 + PCM_ATTACK_SPAN) {
452: pcmPanLeft ^= PCM_ATTACK_SPAN * 2 | PCM_ATTACK_MASK;
453: } else {
454: pcmPanLeft = 0x80000000 + PCM_ATTACK_SPAN * 2;
455: }
456: } else {
457: if (pcmPanLeft < 0x80000000 + PCM_ATTACK_SPAN * 3) {
458: pcmPanLeft ^= PCM_ATTACK_SPAN * 2 | PCM_ATTACK_MASK;
459: } else {
460: pcmPanLeft = 0x80000000 + PCM_ATTACK_SPAN * 0;
461: }
462: }
463: }
464: if (SoundSource.SND_CHANNELS == 2) {
465: on0 = !(pcmPanRight == 0 || pcmPanRight < 0x80000000 + PCM_ATTACK_SPAN * 2);
466: on1 = pcmOutputOn && (pan & 1) == 0;
467: if (on0 != on1) {
468: if (on1) {
469: if (pcmPanRight < 0x80000000 + PCM_ATTACK_SPAN) {
470: pcmPanRight ^= PCM_ATTACK_SPAN * 2 | PCM_ATTACK_MASK;
471: } else {
472: pcmPanRight = 0x80000000 + PCM_ATTACK_SPAN * 2;
473: }
474: } else {
475: if (pcmPanRight < 0x80000000 + PCM_ATTACK_SPAN * 3) {
476: pcmPanRight ^= PCM_ATTACK_SPAN * 2 | PCM_ATTACK_MASK;
477: } else {
478: pcmPanRight = 0x80000000 + PCM_ATTACK_SPAN * 0;
479: }
480: }
481: }
482: }
483: }
484:
485:
486: public static void pcmFillBuffer (int endPointer) {
487: while (pcmPointer < endPointer && (pcmDecodedData1 | pcmDecodedData2 | pcmDecodedData3) != 0) {
488: if (PCM_DECAY_ON) {
489: int m = pcmDecodedData1;
490: pcmInterpolationEngine.write (m + (m >>> 31) - (-m >>> 31));
491: } else {
492: pcmInterpolationEngine.write (0);
493: }
494: }
495: if (pcmPointer < endPointer) {
496: Arrays.fill (pcmBuffer, pcmPointer, endPointer, 0);
497: pcmPointer = endPointer;
498: } else if (endPointer < pcmPointer) {
499: Arrays.fill (pcmBuffer, endPointer, pcmPointer, 0);
500: pcmPointer = endPointer;
501: }
502: }
503:
504:
505:
506:
507: public static enum PIP {
508:
509:
510: PIP_MONO_CONSTANT_16 {
511: @Override public void write (int m) {
512: int i = pcmPointer;
513: int p = pcmPanLeft;
514: if (p > 0) {
515: pcmBuffer[ i ] = (
516: pcmBuffer[i + 1] =
517: pcmBuffer[i + 2] =
518: pcmBuffer[i + 3] =
519: pcmBuffer[i + 4] =
520: pcmBuffer[i + 5] =
521: pcmBuffer[i + 6] =
522: pcmBuffer[i + 7] =
523: pcmBuffer[i + 8] =
524: pcmBuffer[i + 9] =
525: pcmBuffer[i + 10] =
526: pcmBuffer[i + 11] =
527: pcmBuffer[i + 12] =
528: pcmBuffer[i + 13] =
529: pcmBuffer[i + 14] =
530: pcmBuffer[i + 15] = m);
531: } else if (p < 0) {
532: p = (char) p;
533: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
534: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
535: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
536: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 3] >> 14;
537: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 4] >> 14;
538: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 5] >> 14;
539: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 6] >> 14;
540: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 7] >> 14;
541: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 8] >> 14;
542: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 9] >> 14;
543: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 10] >> 14;
544: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 11] >> 14;
545: pcmBuffer[i + 12] = m * pcmAttackCurve[p + 12] >> 14;
546: pcmBuffer[i + 13] = m * pcmAttackCurve[p + 13] >> 14;
547: pcmBuffer[i + 14] = m * pcmAttackCurve[p + 14] >> 14;
548: pcmBuffer[i + 15] = m * pcmAttackCurve[p + 15] >> 14;
549: p += 16;
550: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
551: } else {
552: pcmBuffer[ i ] = (
553: pcmBuffer[i + 1] =
554: pcmBuffer[i + 2] =
555: pcmBuffer[i + 3] =
556: pcmBuffer[i + 4] =
557: pcmBuffer[i + 5] =
558: pcmBuffer[i + 6] =
559: pcmBuffer[i + 7] =
560: pcmBuffer[i + 8] =
561: pcmBuffer[i + 9] =
562: pcmBuffer[i + 10] =
563: pcmBuffer[i + 11] =
564: pcmBuffer[i + 12] =
565: pcmBuffer[i + 13] =
566: pcmBuffer[i + 14] =
567: pcmBuffer[i + 15] = 0);
568: }
569: pcmDecodedData1 = m;
570: pcmPointer = i + 16;
571: }
572: },
573:
574:
575: PIP_MONO_CONSTANT_12 {
576: @Override public void write (int m) {
577: int i = pcmPointer;
578: int p = pcmPanLeft;
579: if (p > 0) {
580: pcmBuffer[ i ] = (
581: pcmBuffer[i + 1] =
582: pcmBuffer[i + 2] =
583: pcmBuffer[i + 3] =
584: pcmBuffer[i + 4] =
585: pcmBuffer[i + 5] =
586: pcmBuffer[i + 6] =
587: pcmBuffer[i + 7] =
588: pcmBuffer[i + 8] =
589: pcmBuffer[i + 9] =
590: pcmBuffer[i + 10] =
591: pcmBuffer[i + 11] = m);
592: } else if (p < 0) {
593: p = (char) p;
594: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
595: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
596: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
597: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 3] >> 14;
598: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 4] >> 14;
599: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 5] >> 14;
600: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 6] >> 14;
601: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 7] >> 14;
602: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 8] >> 14;
603: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 9] >> 14;
604: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 10] >> 14;
605: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 11] >> 14;
606: p += 12;
607: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
608: } else {
609: pcmBuffer[ i ] = (
610: pcmBuffer[i + 1] =
611: pcmBuffer[i + 2] =
612: pcmBuffer[i + 3] =
613: pcmBuffer[i + 4] =
614: pcmBuffer[i + 5] =
615: pcmBuffer[i + 6] =
616: pcmBuffer[i + 7] =
617: pcmBuffer[i + 8] =
618: pcmBuffer[i + 9] =
619: pcmBuffer[i + 10] =
620: pcmBuffer[i + 11] = 0);
621: }
622: pcmDecodedData1 = m;
623: pcmPointer = i + 12;
624: }
625: },
626:
627:
628: PIP_MONO_CONSTANT_8 {
629: @Override public void write (int m) {
630: int i = pcmPointer;
631: int p = pcmPanLeft;
632: if (p > 0) {
633: pcmBuffer[ i ] = (
634: pcmBuffer[i + 1] =
635: pcmBuffer[i + 2] =
636: pcmBuffer[i + 3] =
637: pcmBuffer[i + 4] =
638: pcmBuffer[i + 5] =
639: pcmBuffer[i + 6] =
640: pcmBuffer[i + 7] = m);
641: } else if (p < 0) {
642: p = (char) p;
643: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
644: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
645: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
646: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 3] >> 14;
647: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 4] >> 14;
648: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 5] >> 14;
649: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 6] >> 14;
650: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 7] >> 14;
651: p += 8;
652: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
653: } else {
654: pcmBuffer[ i ] = (
655: pcmBuffer[i + 1] =
656: pcmBuffer[i + 2] =
657: pcmBuffer[i + 3] =
658: pcmBuffer[i + 4] =
659: pcmBuffer[i + 5] =
660: pcmBuffer[i + 6] =
661: pcmBuffer[i + 7] = 0);
662: }
663: pcmDecodedData1 = m;
664: pcmPointer = i + 8;
665: }
666: },
667:
668:
669: PIP_MONO_CONSTANT_6 {
670: @Override public void write (int m) {
671: int i = pcmPointer;
672: int p = pcmPanLeft;
673: if (p > 0) {
674: pcmBuffer[ i ] = (
675: pcmBuffer[i + 1] =
676: pcmBuffer[i + 2] =
677: pcmBuffer[i + 3] =
678: pcmBuffer[i + 4] =
679: pcmBuffer[i + 5] = m);
680: } else if (p < 0) {
681: p = (char) p;
682: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
683: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
684: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
685: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 3] >> 14;
686: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 4] >> 14;
687: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 5] >> 14;
688: p += 6;
689: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
690: } else {
691: pcmBuffer[ i ] = (
692: pcmBuffer[i + 1] =
693: pcmBuffer[i + 2] =
694: pcmBuffer[i + 3] =
695: pcmBuffer[i + 4] =
696: pcmBuffer[i + 5] = 0);
697: }
698: pcmDecodedData1 = m;
699: pcmPointer = i + 6;
700: }
701: },
702:
703:
704: PIP_MONO_CONSTANT_4 {
705: @Override public void write (int m) {
706: int i = pcmPointer;
707: int p = pcmPanLeft;
708: if (p > 0) {
709: pcmBuffer[ i ] = (
710: pcmBuffer[i + 1] =
711: pcmBuffer[i + 2] =
712: pcmBuffer[i + 3] = m);
713: } else if (p < 0) {
714: p = (char) p;
715: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
716: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
717: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
718: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 3] >> 14;
719: p += 4;
720: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
721: } else {
722: pcmBuffer[ i ] = (
723: pcmBuffer[i + 1] =
724: pcmBuffer[i + 2] =
725: pcmBuffer[i + 3] = 0);
726: }
727: pcmDecodedData1 = m;
728: pcmPointer = i + 4;
729: }
730: },
731:
732:
733: PIP_MONO_CONSTANT_3 {
734: @Override public void write (int m) {
735: int i = pcmPointer;
736: int p = pcmPanLeft;
737: if (p > 0) {
738: pcmBuffer[ i ] = (
739: pcmBuffer[i + 1] =
740: pcmBuffer[i + 2] = m);
741: } else if (p < 0) {
742: p = (char) p;
743: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
744: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
745: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 2] >> 14;
746: p += 3;
747: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
748: } else {
749: pcmBuffer[ i ] = (
750: pcmBuffer[i + 1] =
751: pcmBuffer[i + 2] = 0);
752: }
753: pcmDecodedData1 = m;
754: pcmPointer = i + 3;
755: }
756: },
757:
758:
759: PIP_MONO_CONSTANT_2 {
760: @Override public void write (int m) {
761: int i = pcmPointer;
762: int p = pcmPanLeft;
763: if (p > 0) {
764: pcmBuffer[ i ] = (
765: pcmBuffer[i + 1] = m);
766: } else if (p < 0) {
767: p = (char) p;
768: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
769: pcmBuffer[i + 1] = m * pcmAttackCurve[p + 1] >> 14;
770: p += 2;
771: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
772: } else {
773: pcmBuffer[ i ] = (
774: pcmBuffer[i + 1] = 0);
775: }
776: pcmDecodedData1 = m;
777: pcmPointer = i + 2;
778: }
779: },
780:
781:
782: PIP_MONO_LINEAR_16 {
783: @Override public void write (int m1) {
784: int i = pcmPointer;
785: int p = pcmPanLeft;
786: if (p > 0) {
787: int m0 = pcmDecodedData1;
788: pcmBuffer[i ] = 15 * m0 + m1 >> 4;
789: pcmBuffer[i + 1] = 7 * m0 + m1 >> 3;
790: pcmBuffer[i + 2] = 13 * m0 + 3 * m1 >> 4;
791: pcmBuffer[i + 3] = 3 * m0 + m1 >> 2;
792: pcmBuffer[i + 4] = 11 * m0 + 5 * m1 >> 4;
793: pcmBuffer[i + 5] = 5 * m0 + 3 * m1 >> 3;
794: pcmBuffer[i + 6] = 9 * m0 + 7 * m1 >> 4;
795: pcmBuffer[i + 7] = m0 + m1 >> 1;
796: pcmBuffer[i + 8] = 7 * m0 + 9 * m1 >> 4;
797: pcmBuffer[i + 9] = 3 * m0 + 5 * m1 >> 3;
798: pcmBuffer[i + 10] = 5 * m0 + 11 * m1 >> 4;
799: pcmBuffer[i + 11] = m0 + 3 * m1 >> 2;
800: pcmBuffer[i + 12] = 3 * m0 + 13 * m1 >> 4;
801: pcmBuffer[i + 13] = m0 + 7 * m1 >> 3;
802: pcmBuffer[i + 14] = m0 + 15 * m1 >> 4;
803: pcmBuffer[i + 15] = m1;
804: } else if (p < 0) {
805: p = (char) p;
806: int m0 = pcmDecodedData1;
807: pcmBuffer[i ] = (15 * m0 + m1 >> 4) * pcmAttackCurve[p ] >> 14;
808: pcmBuffer[i + 1] = ( 7 * m0 + m1 >> 3) * pcmAttackCurve[p + 1] >> 14;
809: pcmBuffer[i + 2] = (13 * m0 + 3 * m1 >> 4) * pcmAttackCurve[p + 2] >> 14;
810: pcmBuffer[i + 3] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 3] >> 14;
811: pcmBuffer[i + 4] = (11 * m0 + 5 * m1 >> 4) * pcmAttackCurve[p + 4] >> 14;
812: pcmBuffer[i + 5] = ( 5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 5] >> 14;
813: pcmBuffer[i + 6] = ( 9 * m0 + 7 * m1 >> 4) * pcmAttackCurve[p + 6] >> 14;
814: pcmBuffer[i + 7] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 7] >> 14;
815: pcmBuffer[i + 8] = ( 7 * m0 + 9 * m1 >> 4) * pcmAttackCurve[p + 8] >> 14;
816: pcmBuffer[i + 9] = ( 3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 9] >> 14;
817: pcmBuffer[i + 10] = ( 5 * m0 + 11 * m1 >> 4) * pcmAttackCurve[p + 10] >> 14;
818: pcmBuffer[i + 11] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 11] >> 14;
819: pcmBuffer[i + 12] = ( 3 * m0 + 13 * m1 >> 4) * pcmAttackCurve[p + 12] >> 14;
820: pcmBuffer[i + 13] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 13] >> 14;
821: pcmBuffer[i + 14] = ( m0 + 15 * m1 >> 4) * pcmAttackCurve[p + 14] >> 14;
822: pcmBuffer[i + 15] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
823: p += 16;
824: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
825: } else {
826: pcmBuffer[ i ] = (
827: pcmBuffer[i + 1] =
828: pcmBuffer[i + 2] =
829: pcmBuffer[i + 3] =
830: pcmBuffer[i + 4] =
831: pcmBuffer[i + 5] =
832: pcmBuffer[i + 6] =
833: pcmBuffer[i + 7] =
834: pcmBuffer[i + 8] =
835: pcmBuffer[i + 9] =
836: pcmBuffer[i + 10] =
837: pcmBuffer[i + 11] =
838: pcmBuffer[i + 12] =
839: pcmBuffer[i + 13] =
840: pcmBuffer[i + 14] =
841: pcmBuffer[i + 15] = 0);
842: }
843: pcmDecodedData1 = m1;
844: pcmPointer = i + 16;
845: }
846: },
847:
848:
849: PIP_MONO_LINEAR_12 {
850: @Override public void write (int m1) {
851: int i = pcmPointer;
852: int p = pcmPanLeft;
853: if (p > 0) {
854: int m0 = pcmDecodedData1;
855: pcmBuffer[i ] = 65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16;
856: pcmBuffer[i + 1] = 65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16;
857: pcmBuffer[i + 2] = 3 * m0 + m1 >> 2;
858: pcmBuffer[i + 3] = 65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16;
859: pcmBuffer[i + 4] = 65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16;
860: pcmBuffer[i + 5] = m0 + m1 >> 1;
861: pcmBuffer[i + 6] = 65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16;
862: pcmBuffer[i + 7] = 65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16;
863: pcmBuffer[i + 8] = m0 + 3 * m1 >> 2;
864: pcmBuffer[i + 9] = 65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16;
865: pcmBuffer[i + 10] = 65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16;
866: pcmBuffer[i + 11] = m1;
867: } else if (p < 0) {
868: p = (char) p;
869: int m0 = pcmDecodedData1;
870: pcmBuffer[i ] = (65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
871: pcmBuffer[i + 1] = (65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
872: pcmBuffer[i + 2] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
873: pcmBuffer[i + 3] = (65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
874: pcmBuffer[i + 4] = (65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
875: pcmBuffer[i + 5] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 5] >> 14;
876: pcmBuffer[i + 6] = (65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16) * pcmAttackCurve[p + 6] >> 14;
877: pcmBuffer[i + 7] = (65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16) * pcmAttackCurve[p + 7] >> 14;
878: pcmBuffer[i + 8] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 8] >> 14;
879: pcmBuffer[i + 9] = (65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16) * pcmAttackCurve[p + 9] >> 14;
880: pcmBuffer[i + 10] = (65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16) * pcmAttackCurve[p + 10] >> 14;
881: pcmBuffer[i + 11] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
882: p += 12;
883: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
884: } else {
885: pcmBuffer[ i ] = (
886: pcmBuffer[i + 1] =
887: pcmBuffer[i + 2] =
888: pcmBuffer[i + 3] =
889: pcmBuffer[i + 4] =
890: pcmBuffer[i + 5] =
891: pcmBuffer[i + 6] =
892: pcmBuffer[i + 7] =
893: pcmBuffer[i + 8] =
894: pcmBuffer[i + 9] =
895: pcmBuffer[i + 10] =
896: pcmBuffer[i + 11] = 0);
897: }
898: pcmDecodedData1 = m1;
899: pcmPointer = i + 12;
900: }
901: },
902:
903:
904: PIP_MONO_LINEAR_8 {
905: @Override public void write (int m1) {
906: int i = pcmPointer;
907: int p = pcmPanLeft;
908: if (p > 0) {
909: int m0 = pcmDecodedData1;
910: pcmBuffer[i ] = 7 * m0 + m1 >> 3;
911: pcmBuffer[i + 1] = 3 * m0 + m1 >> 2;
912: pcmBuffer[i + 2] = 5 * m0 + 3 * m1 >> 3;
913: pcmBuffer[i + 3] = m0 + m1 >> 1;
914: pcmBuffer[i + 4] = 3 * m0 + 5 * m1 >> 3;
915: pcmBuffer[i + 5] = m0 + 3 * m1 >> 2;
916: pcmBuffer[i + 6] = m0 + 7 * m1 >> 3;
917: pcmBuffer[i + 7] = m1;
918: } else if (p < 0) {
919: p = (char) p;
920: int m0 = pcmDecodedData1;
921: pcmBuffer[i ] = (7 * m0 + m1 >> 3) * pcmAttackCurve[p ] >> 14;
922: pcmBuffer[i + 1] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p + 1] >> 14;
923: pcmBuffer[i + 2] = (5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 2] >> 14;
924: pcmBuffer[i + 3] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 3] >> 14;
925: pcmBuffer[i + 4] = (3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 4] >> 14;
926: pcmBuffer[i + 5] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 5] >> 14;
927: pcmBuffer[i + 6] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 6] >> 14;
928: pcmBuffer[i + 7] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
929: p += 8;
930: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
931: } else {
932: pcmBuffer[ i ] = (
933: pcmBuffer[i + 1] =
934: pcmBuffer[i + 2] =
935: pcmBuffer[i + 3] =
936: pcmBuffer[i + 4] =
937: pcmBuffer[i + 5] =
938: pcmBuffer[i + 6] =
939: pcmBuffer[i + 7] = 0);
940: }
941: pcmDecodedData1 = m1;
942: pcmPointer = i + 8;
943: }
944: },
945:
946:
947: PIP_MONO_LINEAR_6 {
948: @Override public void write (int m1) {
949: int i = pcmPointer;
950: int p = pcmPanLeft;
951: if (p > 0) {
952: int m0 = pcmDecodedData1;
953: pcmBuffer[i ] = 65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16;
954: pcmBuffer[i + 1] = 65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16;
955: pcmBuffer[i + 2] = m0 + m1 >> 1;
956: pcmBuffer[i + 3] = 65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16;
957: pcmBuffer[i + 4] = 65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16;
958: pcmBuffer[i + 5] = m1;
959: } else if (p < 0) {
960: p = (char) p;
961: int m0 = pcmDecodedData1;
962: pcmBuffer[i ] = (65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
963: pcmBuffer[i + 1] = (65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
964: pcmBuffer[i + 2] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 2] >> 14;
965: pcmBuffer[i + 3] = (65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
966: pcmBuffer[i + 4] = (65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
967: pcmBuffer[i + 5] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
968: p += 6;
969: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
970: } else {
971: pcmBuffer[ i ] = (
972: pcmBuffer[i + 1] =
973: pcmBuffer[i + 2] =
974: pcmBuffer[i + 3] =
975: pcmBuffer[i + 4] =
976: pcmBuffer[i + 5] = 0);
977: }
978: pcmDecodedData1 = m1;
979: pcmPointer = i + 6;
980: }
981: },
982:
983:
984: PIP_MONO_LINEAR_4 {
985: @Override public void write (int m1) {
986: int i = pcmPointer;
987: int p = pcmPanLeft;
988: if (p > 0) {
989: int m0 = pcmDecodedData1;
990: pcmBuffer[i ] = 3 * m0 + m1 >> 2;
991: pcmBuffer[i + 1] = m0 + m1 >> 1;
992: pcmBuffer[i + 2] = m0 + 3 * m1 >> 2;
993: pcmBuffer[i + 3] = m1;
994: } else if (p < 0) {
995: p = (char) p;
996: int m0 = pcmDecodedData1;
997: pcmBuffer[i ] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p ] >> 14;
998: pcmBuffer[i + 1] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 1] >> 14;
999: pcmBuffer[i + 2] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
1000: pcmBuffer[i + 3] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
1001: p += 4;
1002: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1003: } else {
1004: pcmBuffer[ i ] = (
1005: pcmBuffer[i + 1] =
1006: pcmBuffer[i + 2] =
1007: pcmBuffer[i + 3] = 0);
1008: }
1009: pcmDecodedData1 = m1;
1010: pcmPointer = i + 4;
1011: }
1012: },
1013:
1014:
1015: PIP_MONO_LINEAR_3 {
1016: @Override public void write (int m1) {
1017: int i = pcmPointer;
1018: int p = pcmPanLeft;
1019: if (p > 0) {
1020: int m0 = pcmDecodedData1;
1021: pcmBuffer[i ] = 65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16;
1022: pcmBuffer[i + 1] = 65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16;
1023: pcmBuffer[i + 2] = m1;
1024: } else if (p < 0) {
1025: p = (char) p;
1026: int m0 = pcmDecodedData1;
1027: pcmBuffer[i ] = (65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
1028: pcmBuffer[i + 1] = (65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
1029: pcmBuffer[i + 2] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
1030: p += 3;
1031: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1032: } else {
1033: pcmBuffer[ i ] = (
1034: pcmBuffer[i + 1] =
1035: pcmBuffer[i + 2] = 0);
1036: }
1037: pcmDecodedData1 = m1;
1038: pcmPointer = i + 3;
1039: }
1040: },
1041:
1042:
1043: PIP_MONO_LINEAR_2 {
1044: @Override public void write (int m1) {
1045: int i = pcmPointer;
1046: int p = pcmPanLeft;
1047: if (p > 0) {
1048: int m0 = pcmDecodedData1;
1049: pcmBuffer[i ] = m0 + m1 >> 1;
1050: pcmBuffer[i + 1] = m1;
1051: } else if (p < 0) {
1052: p = (char) p;
1053: int m0 = pcmDecodedData1;
1054: pcmBuffer[i ] = (m0 + m1 >> 1) * pcmAttackCurve[p ] >> 14;
1055: pcmBuffer[i + 1] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
1056: p += 2;
1057: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1058: } else {
1059: pcmBuffer[ i ] = (
1060: pcmBuffer[i + 1] = 0);
1061: }
1062: pcmDecodedData1 = m1;
1063: pcmPointer = i + 2;
1064: }
1065: },
1066:
1067:
1068: PIP_MONO_HERMITE_16 {
1069: @Override public void write (int m2) {
1070:
1071: int i = pcmPointer;
1072: int mm = pcmDecodedData3;
1073: int m0 = pcmDecodedData2;
1074: int m1 = pcmDecodedData1;
1075: int p = pcmPanLeft;
1076: if (p > 0) {
1077: pcmBuffer[i ] = -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13;
1078: pcmBuffer[i + 1] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
1079: pcmBuffer[i + 2] = -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13;
1080: pcmBuffer[i + 3] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
1081: pcmBuffer[i + 4] = -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13;
1082: pcmBuffer[i + 5] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
1083: pcmBuffer[i + 6] = -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13;
1084: pcmBuffer[i + 7] = -mm + 9 * (m0 + m1) - m2 >> 4;
1085: pcmBuffer[i + 8] = -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13;
1086: pcmBuffer[i + 9] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
1087: pcmBuffer[i + 10] = -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13;
1088: pcmBuffer[i + 11] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
1089: pcmBuffer[i + 12] = -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13;
1090: pcmBuffer[i + 13] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
1091: pcmBuffer[i + 14] = -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13;
1092: pcmBuffer[i + 15] = m1;
1093: } else if (p < 0) {
1094: p = (char) p;
1095: pcmBuffer[i ] = ( -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13) * pcmAttackCurve[p ] >> 14;
1096: pcmBuffer[i + 1] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p + 1] >> 14;
1097: pcmBuffer[i + 2] = ( -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13) * pcmAttackCurve[p + 2] >> 14;
1098: pcmBuffer[i + 3] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 3] >> 14;
1099: pcmBuffer[i + 4] = ( -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13) * pcmAttackCurve[p + 4] >> 14;
1100: pcmBuffer[i + 5] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 5] >> 14;
1101: pcmBuffer[i + 6] = ( -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13) * pcmAttackCurve[p + 6] >> 14;
1102: pcmBuffer[i + 7] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 7] >> 14;
1103: pcmBuffer[i + 8] = ( -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13) * pcmAttackCurve[p + 8] >> 14;
1104: pcmBuffer[i + 9] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 9] >> 14;
1105: pcmBuffer[i + 10] = ( -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13) * pcmAttackCurve[p + 10] >> 14;
1106: pcmBuffer[i + 11] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 11] >> 14;
1107: pcmBuffer[i + 12] = ( -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13) * pcmAttackCurve[p + 12] >> 14;
1108: pcmBuffer[i + 13] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 13] >> 14;
1109: pcmBuffer[i + 14] = ( -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13) * pcmAttackCurve[p + 14] >> 14;
1110: pcmBuffer[i + 15] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
1111: p += 16;
1112: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1113: } else {
1114: pcmBuffer[ i ] = (
1115: pcmBuffer[i + 1] =
1116: pcmBuffer[i + 2] =
1117: pcmBuffer[i + 3] =
1118: pcmBuffer[i + 4] =
1119: pcmBuffer[i + 5] =
1120: pcmBuffer[i + 6] =
1121: pcmBuffer[i + 7] =
1122: pcmBuffer[i + 8] =
1123: pcmBuffer[i + 9] =
1124: pcmBuffer[i + 10] =
1125: pcmBuffer[i + 11] =
1126: pcmBuffer[i + 12] =
1127: pcmBuffer[i + 13] =
1128: pcmBuffer[i + 14] =
1129: pcmBuffer[i + 15] = 0);
1130: }
1131: pcmDecodedData3 = m0;
1132: pcmDecodedData2 = m1;
1133: pcmDecodedData1 = m2;
1134: pcmPointer = i + 16;
1135: }
1136: },
1137:
1138:
1139: PIP_MONO_HERMITE_12 {
1140: @Override public void write (int m2) {
1141:
1142: int i = pcmPointer;
1143: int mm = pcmDecodedData3;
1144: int m0 = pcmDecodedData2;
1145: int m1 = pcmDecodedData1;
1146: int p = pcmPanLeft;
1147: if (p > 0) {
1148: pcmBuffer[i ] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32);
1149: pcmBuffer[i + 1] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
1150: pcmBuffer[i + 2] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
1151: pcmBuffer[i + 3] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
1152: pcmBuffer[i + 4] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32);
1153: pcmBuffer[i + 5] = -mm + 9 * (m0 + m1) - m2 >> 4;
1154: pcmBuffer[i + 6] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32);
1155: pcmBuffer[i + 7] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
1156: pcmBuffer[i + 8] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
1157: pcmBuffer[i + 9] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
1158: pcmBuffer[i + 10] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32);
1159: pcmBuffer[i + 11] = m1;
1160: } else if (p < 0) {
1161: p = (char) p;
1162: pcmBuffer[i ] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32) * pcmAttackCurve[p ] >> 14;
1163: pcmBuffer[i + 1] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 1] >> 14;
1164: pcmBuffer[i + 2] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7 ) * pcmAttackCurve[p + 2] >> 14;
1165: pcmBuffer[i + 3] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
1166: pcmBuffer[i + 4] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 4] >> 14;
1167: pcmBuffer[i + 5] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 5] >> 14;
1168: pcmBuffer[i + 6] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 6] >> 14;
1169: pcmBuffer[i + 7] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 7] >> 14;
1170: pcmBuffer[i + 8] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7 ) * pcmAttackCurve[p + 8] >> 14;
1171: pcmBuffer[i + 9] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 9] >> 14;
1172: pcmBuffer[i + 10] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 10] >> 14;
1173: pcmBuffer[i + 11] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
1174: p += 12;
1175: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1176: } else {
1177: pcmBuffer[ i ] = (
1178: pcmBuffer[i + 1] =
1179: pcmBuffer[i + 2] =
1180: pcmBuffer[i + 3] =
1181: pcmBuffer[i + 4] =
1182: pcmBuffer[i + 5] =
1183: pcmBuffer[i + 6] =
1184: pcmBuffer[i + 7] =
1185: pcmBuffer[i + 8] =
1186: pcmBuffer[i + 9] =
1187: pcmBuffer[i + 10] =
1188: pcmBuffer[i + 11] = 0);
1189: }
1190: pcmDecodedData3 = m0;
1191: pcmDecodedData2 = m1;
1192: pcmDecodedData1 = m2;
1193: pcmPointer = i + 12;
1194: }
1195: },
1196:
1197:
1198: PIP_MONO_HERMITE_8 {
1199: @Override public void write (int m2) {
1200:
1201: int i = pcmPointer;
1202: int mm = pcmDecodedData3;
1203: int m0 = pcmDecodedData2;
1204: int m1 = pcmDecodedData1;
1205: int p = pcmPanLeft;
1206: if (p > 0) {
1207: pcmBuffer[i ] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
1208: pcmBuffer[i + 1] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
1209: pcmBuffer[i + 2] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
1210: pcmBuffer[i + 3] = -mm + 9 * (m0 + m1) - m2 >> 4;
1211: pcmBuffer[i + 4] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
1212: pcmBuffer[i + 5] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
1213: pcmBuffer[i + 6] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
1214: pcmBuffer[i + 7] = m1;
1215: } else if (p < 0) {
1216: p = (char) p;
1217: pcmBuffer[i ] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p ] >> 14;
1218: pcmBuffer[i + 1] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 1] >> 14;
1219: pcmBuffer[i + 2] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 2] >> 14;
1220: pcmBuffer[i + 3] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 3] >> 14;
1221: pcmBuffer[i + 4] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 4] >> 14;
1222: pcmBuffer[i + 5] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 5] >> 14;
1223: pcmBuffer[i + 6] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 6] >> 14;
1224: pcmBuffer[i + 7] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
1225: p += 8;
1226: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1227: } else {
1228: pcmBuffer[ i ] = (
1229: pcmBuffer[i + 1] =
1230: pcmBuffer[i + 2] =
1231: pcmBuffer[i + 3] =
1232: pcmBuffer[i + 4] =
1233: pcmBuffer[i + 5] =
1234: pcmBuffer[i + 6] =
1235: pcmBuffer[i + 7] = 0);
1236: }
1237: pcmDecodedData3 = m0;
1238: pcmDecodedData2 = m1;
1239: pcmDecodedData1 = m2;
1240: pcmPointer = i + 8;
1241: }
1242: },
1243:
1244:
1245: PIP_MONO_HERMITE_6 {
1246: @Override public void write (int m2) {
1247:
1248: int i = pcmPointer;
1249: int mm = pcmDecodedData3;
1250: int m0 = pcmDecodedData2;
1251: int m1 = pcmDecodedData1;
1252: int p = pcmPanLeft;
1253: if (p > 0) {
1254: pcmBuffer[i ] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
1255: pcmBuffer[i + 1] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
1256: pcmBuffer[i + 2] = -mm + 9 * (m0 + m1) - m2 >> 4;
1257: pcmBuffer[i + 3] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
1258: pcmBuffer[i + 4] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
1259: pcmBuffer[i + 5] = m1;
1260: } else if (p < 0) {
1261: p = (char) p;
1262: pcmBuffer[i ] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p ] >> 14;
1263: pcmBuffer[i + 1] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
1264: pcmBuffer[i + 2] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 2] >> 14;
1265: pcmBuffer[i + 3] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
1266: pcmBuffer[i + 4] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 4] >> 14;
1267: pcmBuffer[i + 5] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
1268: p += 6;
1269: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1270: } else {
1271: pcmBuffer[ i ] = (
1272: pcmBuffer[i + 1] =
1273: pcmBuffer[i + 2] =
1274: pcmBuffer[i + 3] =
1275: pcmBuffer[i + 4] =
1276: pcmBuffer[i + 5] = 0);
1277: }
1278: pcmDecodedData3 = m0;
1279: pcmDecodedData2 = m1;
1280: pcmDecodedData1 = m2;
1281: pcmPointer = i + 6;
1282: }
1283: },
1284:
1285:
1286: PIP_MONO_HERMITE_4 {
1287: @Override public void write (int m2) {
1288:
1289: int i = pcmPointer;
1290: int mm = pcmDecodedData3;
1291: int m0 = pcmDecodedData2;
1292: int m1 = pcmDecodedData1;
1293: int p = pcmPanLeft;
1294: if (p > 0) {
1295: pcmBuffer[i ] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
1296: pcmBuffer[i + 1] = -mm + 9 * (m0 + m1) - m2 >> 4;
1297: pcmBuffer[i + 2] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
1298: pcmBuffer[i + 3] = m1;
1299: } else if (p < 0) {
1300: p = (char) p;
1301: pcmBuffer[i ] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p ] >> 14;
1302: pcmBuffer[i + 1] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 1] >> 14;
1303: pcmBuffer[i + 2] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 2] >> 14;
1304: pcmBuffer[i + 3] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
1305: p += 4;
1306: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1307: } else {
1308: pcmBuffer[ i ] = (
1309: pcmBuffer[i + 1] =
1310: pcmBuffer[i + 2] =
1311: pcmBuffer[i + 3] = 0);
1312: }
1313: pcmDecodedData3 = m0;
1314: pcmDecodedData2 = m1;
1315: pcmDecodedData1 = m2;
1316: pcmPointer = i + 4;
1317: }
1318: },
1319:
1320:
1321: PIP_MONO_HERMITE_3 {
1322: @Override public void write (int m2) {
1323:
1324: int i = pcmPointer;
1325: int mm = pcmDecodedData3;
1326: int m0 = pcmDecodedData2;
1327: int m1 = pcmDecodedData1;
1328: int p = pcmPanLeft;
1329: if (p > 0) {
1330: pcmBuffer[i ] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
1331: pcmBuffer[i + 1] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
1332: pcmBuffer[i + 2] = m1;
1333: } else if (p < 0) {
1334: p = (char) p;
1335: pcmBuffer[i ] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p ] >> 14;
1336: pcmBuffer[i + 1] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
1337: pcmBuffer[i + 2] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
1338: p += 3;
1339: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1340: } else {
1341: pcmBuffer[ i ] = (
1342: pcmBuffer[i + 1] =
1343: pcmBuffer[i + 2] = 0);
1344: }
1345: pcmDecodedData3 = m0;
1346: pcmDecodedData2 = m1;
1347: pcmDecodedData1 = m2;
1348: pcmPointer = i + 3;
1349: }
1350: },
1351:
1352:
1353: PIP_MONO_HERMITE_2 {
1354: @Override public void write (int m2) {
1355:
1356: int i = pcmPointer;
1357: int mm = pcmDecodedData3;
1358: int m0 = pcmDecodedData2;
1359: int m1 = pcmDecodedData1;
1360: int p = pcmPanLeft;
1361: if (p > 0) {
1362: pcmBuffer[i ] = -mm + 9 * (m0 + m1) - m2 >> 4;
1363: pcmBuffer[i + 1] = m1;
1364: } else if (p < 0) {
1365: p = (char) p;
1366: pcmBuffer[i ] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p ] >> 14;
1367: pcmBuffer[i + 1] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
1368: p += 2;
1369: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1370: } else {
1371: pcmBuffer[ i ] = (
1372: pcmBuffer[i + 1] = 0);
1373: }
1374: pcmDecodedData3 = m0;
1375: pcmDecodedData2 = m1;
1376: pcmDecodedData1 = m2;
1377: pcmPointer = i + 2;
1378: }
1379: },
1380:
1381:
1382: PIP_STEREO_CONSTANT_16 {
1383: @Override public void write (int m) {
1384: int i = pcmPointer;
1385: int p = pcmPanLeft;
1386: if (p > 0) {
1387: pcmBuffer[ i ] = (
1388: pcmBuffer[i + 2] =
1389: pcmBuffer[i + 4] =
1390: pcmBuffer[i + 6] =
1391: pcmBuffer[i + 8] =
1392: pcmBuffer[i + 10] =
1393: pcmBuffer[i + 12] =
1394: pcmBuffer[i + 14] =
1395: pcmBuffer[i + 16] =
1396: pcmBuffer[i + 18] =
1397: pcmBuffer[i + 20] =
1398: pcmBuffer[i + 22] =
1399: pcmBuffer[i + 24] =
1400: pcmBuffer[i + 26] =
1401: pcmBuffer[i + 28] =
1402: pcmBuffer[i + 30] = m);
1403: } else if (p < 0) {
1404: p = (char) p;
1405: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1406: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1407: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1408: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 3] >> 14;
1409: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 4] >> 14;
1410: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 5] >> 14;
1411: pcmBuffer[i + 12] = m * pcmAttackCurve[p + 6] >> 14;
1412: pcmBuffer[i + 14] = m * pcmAttackCurve[p + 7] >> 14;
1413: pcmBuffer[i + 16] = m * pcmAttackCurve[p + 8] >> 14;
1414: pcmBuffer[i + 18] = m * pcmAttackCurve[p + 9] >> 14;
1415: pcmBuffer[i + 20] = m * pcmAttackCurve[p + 10] >> 14;
1416: pcmBuffer[i + 22] = m * pcmAttackCurve[p + 11] >> 14;
1417: pcmBuffer[i + 24] = m * pcmAttackCurve[p + 12] >> 14;
1418: pcmBuffer[i + 26] = m * pcmAttackCurve[p + 13] >> 14;
1419: pcmBuffer[i + 28] = m * pcmAttackCurve[p + 14] >> 14;
1420: pcmBuffer[i + 30] = m * pcmAttackCurve[p + 15] >> 14;
1421: p += 16;
1422: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1423: } else {
1424: pcmBuffer[ i ] = (
1425: pcmBuffer[i + 2] =
1426: pcmBuffer[i + 4] =
1427: pcmBuffer[i + 6] =
1428: pcmBuffer[i + 8] =
1429: pcmBuffer[i + 10] =
1430: pcmBuffer[i + 12] =
1431: pcmBuffer[i + 14] =
1432: pcmBuffer[i + 16] =
1433: pcmBuffer[i + 18] =
1434: pcmBuffer[i + 20] =
1435: pcmBuffer[i + 22] =
1436: pcmBuffer[i + 24] =
1437: pcmBuffer[i + 26] =
1438: pcmBuffer[i + 28] =
1439: pcmBuffer[i + 30] = 0);
1440: }
1441: p = pcmPanRight;
1442: if (p > 0) {
1443: pcmBuffer[ i + 1] = (
1444: pcmBuffer[i + 3] =
1445: pcmBuffer[i + 5] =
1446: pcmBuffer[i + 7] =
1447: pcmBuffer[i + 9] =
1448: pcmBuffer[i + 11] =
1449: pcmBuffer[i + 13] =
1450: pcmBuffer[i + 15] =
1451: pcmBuffer[i + 17] =
1452: pcmBuffer[i + 19] =
1453: pcmBuffer[i + 21] =
1454: pcmBuffer[i + 23] =
1455: pcmBuffer[i + 25] =
1456: pcmBuffer[i + 27] =
1457: pcmBuffer[i + 29] =
1458: pcmBuffer[i + 31] = m);
1459: } else if (p < 0) {
1460: p = (char) p;
1461: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1462: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1463: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1464: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 3] >> 14;
1465: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 4] >> 14;
1466: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 5] >> 14;
1467: pcmBuffer[i + 13] = m * pcmAttackCurve[p + 6] >> 14;
1468: pcmBuffer[i + 15] = m * pcmAttackCurve[p + 7] >> 14;
1469: pcmBuffer[i + 17] = m * pcmAttackCurve[p + 8] >> 14;
1470: pcmBuffer[i + 19] = m * pcmAttackCurve[p + 9] >> 14;
1471: pcmBuffer[i + 21] = m * pcmAttackCurve[p + 10] >> 14;
1472: pcmBuffer[i + 23] = m * pcmAttackCurve[p + 11] >> 14;
1473: pcmBuffer[i + 25] = m * pcmAttackCurve[p + 12] >> 14;
1474: pcmBuffer[i + 27] = m * pcmAttackCurve[p + 13] >> 14;
1475: pcmBuffer[i + 29] = m * pcmAttackCurve[p + 14] >> 14;
1476: pcmBuffer[i + 31] = m * pcmAttackCurve[p + 15] >> 14;
1477: p += 16;
1478: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1479: } else {
1480: pcmBuffer[ i + 1] = (
1481: pcmBuffer[i + 3] =
1482: pcmBuffer[i + 5] =
1483: pcmBuffer[i + 7] =
1484: pcmBuffer[i + 9] =
1485: pcmBuffer[i + 11] =
1486: pcmBuffer[i + 13] =
1487: pcmBuffer[i + 15] =
1488: pcmBuffer[i + 17] =
1489: pcmBuffer[i + 19] =
1490: pcmBuffer[i + 21] =
1491: pcmBuffer[i + 23] =
1492: pcmBuffer[i + 25] =
1493: pcmBuffer[i + 27] =
1494: pcmBuffer[i + 29] =
1495: pcmBuffer[i + 31] = 0);
1496: }
1497: pcmDecodedData1 = m;
1498: pcmPointer = i + 32;
1499: }
1500: },
1501:
1502:
1503: PIP_STEREO_CONSTANT_12 {
1504: @Override public void write (int m) {
1505: int i = pcmPointer;
1506: int p = pcmPanLeft;
1507: if (p > 0) {
1508: pcmBuffer[ i ] = (
1509: pcmBuffer[i + 2] =
1510: pcmBuffer[i + 4] =
1511: pcmBuffer[i + 6] =
1512: pcmBuffer[i + 8] =
1513: pcmBuffer[i + 10] =
1514: pcmBuffer[i + 12] =
1515: pcmBuffer[i + 14] =
1516: pcmBuffer[i + 16] =
1517: pcmBuffer[i + 18] =
1518: pcmBuffer[i + 20] =
1519: pcmBuffer[i + 22] = m);
1520: } else if (p < 0) {
1521: p = (char) p;
1522: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1523: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1524: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1525: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 3] >> 14;
1526: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 4] >> 14;
1527: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 5] >> 14;
1528: pcmBuffer[i + 12] = m * pcmAttackCurve[p + 6] >> 14;
1529: pcmBuffer[i + 14] = m * pcmAttackCurve[p + 7] >> 14;
1530: pcmBuffer[i + 16] = m * pcmAttackCurve[p + 8] >> 14;
1531: pcmBuffer[i + 18] = m * pcmAttackCurve[p + 9] >> 14;
1532: pcmBuffer[i + 20] = m * pcmAttackCurve[p + 10] >> 14;
1533: pcmBuffer[i + 22] = m * pcmAttackCurve[p + 11] >> 14;
1534: p += 12;
1535: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1536: } else {
1537: pcmBuffer[ i ] = (
1538: pcmBuffer[i + 2] =
1539: pcmBuffer[i + 4] =
1540: pcmBuffer[i + 6] =
1541: pcmBuffer[i + 8] =
1542: pcmBuffer[i + 10] =
1543: pcmBuffer[i + 12] =
1544: pcmBuffer[i + 14] =
1545: pcmBuffer[i + 16] =
1546: pcmBuffer[i + 18] =
1547: pcmBuffer[i + 20] =
1548: pcmBuffer[i + 22] = 0);
1549: }
1550: p = pcmPanRight;
1551: if (p > 0) {
1552: pcmBuffer[ i + 1] = (
1553: pcmBuffer[i + 3] =
1554: pcmBuffer[i + 5] =
1555: pcmBuffer[i + 7] =
1556: pcmBuffer[i + 9] =
1557: pcmBuffer[i + 11] =
1558: pcmBuffer[i + 13] =
1559: pcmBuffer[i + 15] =
1560: pcmBuffer[i + 17] =
1561: pcmBuffer[i + 19] =
1562: pcmBuffer[i + 21] =
1563: pcmBuffer[i + 23] = m);
1564: } else if (p < 0) {
1565: p = (char) p;
1566: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1567: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1568: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1569: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 3] >> 14;
1570: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 4] >> 14;
1571: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 5] >> 14;
1572: pcmBuffer[i + 13] = m * pcmAttackCurve[p + 6] >> 14;
1573: pcmBuffer[i + 15] = m * pcmAttackCurve[p + 7] >> 14;
1574: pcmBuffer[i + 17] = m * pcmAttackCurve[p + 8] >> 14;
1575: pcmBuffer[i + 19] = m * pcmAttackCurve[p + 9] >> 14;
1576: pcmBuffer[i + 21] = m * pcmAttackCurve[p + 10] >> 14;
1577: pcmBuffer[i + 23] = m * pcmAttackCurve[p + 11] >> 14;
1578: p += 12;
1579: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1580: } else {
1581: pcmBuffer[ i + 1] = (
1582: pcmBuffer[i + 3] =
1583: pcmBuffer[i + 5] =
1584: pcmBuffer[i + 7] =
1585: pcmBuffer[i + 9] =
1586: pcmBuffer[i + 11] =
1587: pcmBuffer[i + 13] =
1588: pcmBuffer[i + 15] =
1589: pcmBuffer[i + 17] =
1590: pcmBuffer[i + 19] =
1591: pcmBuffer[i + 21] =
1592: pcmBuffer[i + 23] = 0);
1593: }
1594: pcmDecodedData1 = m;
1595: pcmPointer = i + 24;
1596: }
1597: },
1598:
1599:
1600: PIP_STEREO_CONSTANT_8 {
1601: @Override public void write (int m) {
1602: int i = pcmPointer;
1603: int p = pcmPanLeft;
1604: if (p > 0) {
1605: pcmBuffer[ i ] = (
1606: pcmBuffer[i + 2] =
1607: pcmBuffer[i + 4] =
1608: pcmBuffer[i + 6] =
1609: pcmBuffer[i + 8] =
1610: pcmBuffer[i + 10] =
1611: pcmBuffer[i + 12] =
1612: pcmBuffer[i + 14] = m);
1613: } else if (p < 0) {
1614: p = (char) p;
1615: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1616: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1617: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1618: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 3] >> 14;
1619: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 4] >> 14;
1620: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 5] >> 14;
1621: pcmBuffer[i + 12] = m * pcmAttackCurve[p + 6] >> 14;
1622: pcmBuffer[i + 14] = m * pcmAttackCurve[p + 7] >> 14;
1623: p += 8;
1624: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1625: } else {
1626: pcmBuffer[ i ] = (
1627: pcmBuffer[i + 2] =
1628: pcmBuffer[i + 4] =
1629: pcmBuffer[i + 6] =
1630: pcmBuffer[i + 8] =
1631: pcmBuffer[i + 10] =
1632: pcmBuffer[i + 12] =
1633: pcmBuffer[i + 14] = 0);
1634: }
1635: p = pcmPanRight;
1636: if (p > 0) {
1637: pcmBuffer[ i + 1] = (
1638: pcmBuffer[i + 3] =
1639: pcmBuffer[i + 5] =
1640: pcmBuffer[i + 7] =
1641: pcmBuffer[i + 9] =
1642: pcmBuffer[i + 11] =
1643: pcmBuffer[i + 13] =
1644: pcmBuffer[i + 15] = m);
1645: } else if (p < 0) {
1646: p = (char) p;
1647: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1648: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1649: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1650: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 3] >> 14;
1651: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 4] >> 14;
1652: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 5] >> 14;
1653: pcmBuffer[i + 13] = m * pcmAttackCurve[p + 6] >> 14;
1654: pcmBuffer[i + 15] = m * pcmAttackCurve[p + 7] >> 14;
1655: p += 8;
1656: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1657: } else {
1658: pcmBuffer[ i + 1] = (
1659: pcmBuffer[i + 3] =
1660: pcmBuffer[i + 5] =
1661: pcmBuffer[i + 7] =
1662: pcmBuffer[i + 9] =
1663: pcmBuffer[i + 11] =
1664: pcmBuffer[i + 13] =
1665: pcmBuffer[i + 15] = 0);
1666: }
1667: pcmDecodedData1 = m;
1668: pcmPointer = i + 16;
1669: }
1670: },
1671:
1672:
1673: PIP_STEREO_CONSTANT_6 {
1674: @Override public void write (int m) {
1675: int i = pcmPointer;
1676: int p = pcmPanLeft;
1677: if (p > 0) {
1678: pcmBuffer[ i ] = (
1679: pcmBuffer[i + 2] =
1680: pcmBuffer[i + 4] =
1681: pcmBuffer[i + 6] =
1682: pcmBuffer[i + 8] =
1683: pcmBuffer[i + 10] = m);
1684: } else if (p < 0) {
1685: p = (char) p;
1686: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1687: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1688: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1689: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 3] >> 14;
1690: pcmBuffer[i + 8] = m * pcmAttackCurve[p + 4] >> 14;
1691: pcmBuffer[i + 10] = m * pcmAttackCurve[p + 5] >> 14;
1692: p += 6;
1693: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1694: } else {
1695: pcmBuffer[ i ] = (
1696: pcmBuffer[i + 2] =
1697: pcmBuffer[i + 4] =
1698: pcmBuffer[i + 6] =
1699: pcmBuffer[i + 8] =
1700: pcmBuffer[i + 10] = 0);
1701: }
1702: p = pcmPanRight;
1703: if (p > 0) {
1704: pcmBuffer[ i + 1] = (
1705: pcmBuffer[i + 3] =
1706: pcmBuffer[i + 5] =
1707: pcmBuffer[i + 7] =
1708: pcmBuffer[i + 9] =
1709: pcmBuffer[i + 11] = m);
1710: } else if (p < 0) {
1711: p = (char) p;
1712: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1713: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1714: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1715: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 3] >> 14;
1716: pcmBuffer[i + 9] = m * pcmAttackCurve[p + 4] >> 14;
1717: pcmBuffer[i + 11] = m * pcmAttackCurve[p + 5] >> 14;
1718: p += 6;
1719: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1720: } else {
1721: pcmBuffer[ i + 1] = (
1722: pcmBuffer[i + 3] =
1723: pcmBuffer[i + 5] =
1724: pcmBuffer[i + 7] =
1725: pcmBuffer[i + 9] =
1726: pcmBuffer[i + 11] = 0);
1727: }
1728: pcmDecodedData1 = m;
1729: pcmPointer = i + 12;
1730: }
1731: },
1732:
1733:
1734: PIP_STEREO_CONSTANT_4 {
1735: @Override public void write (int m) {
1736: int i = pcmPointer;
1737: int p = pcmPanLeft;
1738: if (p > 0) {
1739: pcmBuffer[ i ] = (
1740: pcmBuffer[i + 2] =
1741: pcmBuffer[i + 4] =
1742: pcmBuffer[i + 6] = m);
1743: } else if (p < 0) {
1744: p = (char) p;
1745: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1746: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1747: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1748: pcmBuffer[i + 6] = m * pcmAttackCurve[p + 3] >> 14;
1749: p += 4;
1750: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1751: } else {
1752: pcmBuffer[ i ] = (
1753: pcmBuffer[i + 2] =
1754: pcmBuffer[i + 4] =
1755: pcmBuffer[i + 6] = 0);
1756: }
1757: p = pcmPanRight;
1758: if (p > 0) {
1759: pcmBuffer[ i + 1] = (
1760: pcmBuffer[i + 3] =
1761: pcmBuffer[i + 5] =
1762: pcmBuffer[i + 7] = m);
1763: } else if (p < 0) {
1764: p = (char) p;
1765: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1766: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1767: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1768: pcmBuffer[i + 7] = m * pcmAttackCurve[p + 3] >> 14;
1769: p += 4;
1770: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1771: } else {
1772: pcmBuffer[ i + 1] = (
1773: pcmBuffer[i + 3] =
1774: pcmBuffer[i + 5] =
1775: pcmBuffer[i + 7] = 0);
1776: }
1777: pcmDecodedData1 = m;
1778: pcmPointer = i + 8;
1779: }
1780: },
1781:
1782:
1783: PIP_STEREO_CONSTANT_3 {
1784: @Override public void write (int m) {
1785: int i = pcmPointer;
1786: int p = pcmPanLeft;
1787: if (p > 0) {
1788: pcmBuffer[ i ] = (
1789: pcmBuffer[i + 2] =
1790: pcmBuffer[i + 4] = m);
1791: } else if (p < 0) {
1792: p = (char) p;
1793: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1794: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1795: pcmBuffer[i + 4] = m * pcmAttackCurve[p + 2] >> 14;
1796: p += 3;
1797: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1798: } else {
1799: pcmBuffer[ i ] = (
1800: pcmBuffer[i + 2] =
1801: pcmBuffer[i + 4] = 0);
1802: }
1803: p = pcmPanRight;
1804: if (p > 0) {
1805: pcmBuffer[ i + 1] = (
1806: pcmBuffer[i + 3] =
1807: pcmBuffer[i + 5] = m);
1808: } else if (p < 0) {
1809: p = (char) p;
1810: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1811: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1812: pcmBuffer[i + 5] = m * pcmAttackCurve[p + 2] >> 14;
1813: p += 3;
1814: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1815: } else {
1816: pcmBuffer[ i + 1] = (
1817: pcmBuffer[i + 3] =
1818: pcmBuffer[i + 5] = 0);
1819: }
1820: pcmDecodedData1 = m;
1821: pcmPointer = i + 6;
1822: }
1823: },
1824:
1825:
1826: PIP_STEREO_CONSTANT_2 {
1827: @Override public void write (int m) {
1828: int i = pcmPointer;
1829: int p = pcmPanLeft;
1830: if (p > 0) {
1831: pcmBuffer[ i ] = (
1832: pcmBuffer[i + 2] = m);
1833: } else if (p < 0) {
1834: p = (char) p;
1835: pcmBuffer[i ] = m * pcmAttackCurve[p ] >> 14;
1836: pcmBuffer[i + 2] = m * pcmAttackCurve[p + 1] >> 14;
1837: p += 2;
1838: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1839: } else {
1840: pcmBuffer[ i ] = (
1841: pcmBuffer[i + 2] = 0);
1842: }
1843: p = pcmPanRight;
1844: if (p > 0) {
1845: pcmBuffer[ i + 1] = (
1846: pcmBuffer[i + 3] = m);
1847: } else if (p < 0) {
1848: p = (char) p;
1849: pcmBuffer[i + 1] = m * pcmAttackCurve[p ] >> 14;
1850: pcmBuffer[i + 3] = m * pcmAttackCurve[p + 1] >> 14;
1851: p += 2;
1852: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1853: } else {
1854: pcmBuffer[ i + 1] = (
1855: pcmBuffer[i + 3] = 0);
1856: }
1857: pcmDecodedData1 = m;
1858: pcmPointer = i + 4;
1859: }
1860: },
1861:
1862:
1863: PIP_STEREO_LINEAR_16 {
1864: @Override public void write (int m1) {
1865: int i = pcmPointer;
1866: int p = pcmPanLeft;
1867: if (p > 0) {
1868: int m0 = pcmDecodedData1;
1869: pcmBuffer[i ] = 15 * m0 + m1 >> 4;
1870: pcmBuffer[i + 2] = 7 * m0 + m1 >> 3;
1871: pcmBuffer[i + 4] = 13 * m0 + 3 * m1 >> 4;
1872: pcmBuffer[i + 6] = 3 * m0 + m1 >> 2;
1873: pcmBuffer[i + 8] = 11 * m0 + 5 * m1 >> 4;
1874: pcmBuffer[i + 10] = 5 * m0 + 3 * m1 >> 3;
1875: pcmBuffer[i + 12] = 9 * m0 + 7 * m1 >> 4;
1876: pcmBuffer[i + 14] = m0 + m1 >> 1;
1877: pcmBuffer[i + 16] = 7 * m0 + 9 * m1 >> 4;
1878: pcmBuffer[i + 18] = 3 * m0 + 5 * m1 >> 3;
1879: pcmBuffer[i + 20] = 5 * m0 + 11 * m1 >> 4;
1880: pcmBuffer[i + 22] = m0 + 3 * m1 >> 2;
1881: pcmBuffer[i + 24] = 3 * m0 + 13 * m1 >> 4;
1882: pcmBuffer[i + 26] = m0 + 7 * m1 >> 3;
1883: pcmBuffer[i + 28] = m0 + 15 * m1 >> 4;
1884: pcmBuffer[i + 30] = m1;
1885: } else if (p < 0) {
1886: p = (char) p;
1887: int m0 = pcmDecodedData1;
1888: pcmBuffer[i ] = (15 * m0 + m1 >> 4) * pcmAttackCurve[p ] >> 14;
1889: pcmBuffer[i + 2] = ( 7 * m0 + m1 >> 3) * pcmAttackCurve[p + 1] >> 14;
1890: pcmBuffer[i + 4] = (13 * m0 + 3 * m1 >> 4) * pcmAttackCurve[p + 2] >> 14;
1891: pcmBuffer[i + 6] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 3] >> 14;
1892: pcmBuffer[i + 8] = (11 * m0 + 5 * m1 >> 4) * pcmAttackCurve[p + 4] >> 14;
1893: pcmBuffer[i + 10] = ( 5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 5] >> 14;
1894: pcmBuffer[i + 12] = ( 9 * m0 + 7 * m1 >> 4) * pcmAttackCurve[p + 6] >> 14;
1895: pcmBuffer[i + 14] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 7] >> 14;
1896: pcmBuffer[i + 16] = ( 7 * m0 + 9 * m1 >> 4) * pcmAttackCurve[p + 8] >> 14;
1897: pcmBuffer[i + 18] = ( 3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 9] >> 14;
1898: pcmBuffer[i + 20] = ( 5 * m0 + 11 * m1 >> 4) * pcmAttackCurve[p + 10] >> 14;
1899: pcmBuffer[i + 22] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 11] >> 14;
1900: pcmBuffer[i + 24] = ( 3 * m0 + 13 * m1 >> 4) * pcmAttackCurve[p + 12] >> 14;
1901: pcmBuffer[i + 26] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 13] >> 14;
1902: pcmBuffer[i + 28] = ( m0 + 15 * m1 >> 4) * pcmAttackCurve[p + 14] >> 14;
1903: pcmBuffer[i + 30] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
1904: p += 16;
1905: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1906: } else {
1907: pcmBuffer[ i ] = (
1908: pcmBuffer[i + 2] =
1909: pcmBuffer[i + 4] =
1910: pcmBuffer[i + 6] =
1911: pcmBuffer[i + 8] =
1912: pcmBuffer[i + 10] =
1913: pcmBuffer[i + 12] =
1914: pcmBuffer[i + 14] =
1915: pcmBuffer[i + 16] =
1916: pcmBuffer[i + 18] =
1917: pcmBuffer[i + 20] =
1918: pcmBuffer[i + 22] =
1919: pcmBuffer[i + 24] =
1920: pcmBuffer[i + 26] =
1921: pcmBuffer[i + 28] =
1922: pcmBuffer[i + 30] = 0);
1923: }
1924: p = pcmPanRight;
1925: if (p > 0) {
1926: int m0 = pcmDecodedData1;
1927: pcmBuffer[i + 1] = 15 * m0 + m1 >> 4;
1928: pcmBuffer[i + 3] = 7 * m0 + m1 >> 3;
1929: pcmBuffer[i + 5] = 13 * m0 + 3 * m1 >> 4;
1930: pcmBuffer[i + 7] = 3 * m0 + m1 >> 2;
1931: pcmBuffer[i + 9] = 11 * m0 + 5 * m1 >> 4;
1932: pcmBuffer[i + 11] = 5 * m0 + 3 * m1 >> 3;
1933: pcmBuffer[i + 13] = 9 * m0 + 7 * m1 >> 4;
1934: pcmBuffer[i + 15] = m0 + m1 >> 1;
1935: pcmBuffer[i + 17] = 7 * m0 + 9 * m1 >> 4;
1936: pcmBuffer[i + 19] = 3 * m0 + 5 * m1 >> 3;
1937: pcmBuffer[i + 21] = 5 * m0 + 11 * m1 >> 4;
1938: pcmBuffer[i + 23] = m0 + 3 * m1 >> 2;
1939: pcmBuffer[i + 25] = 3 * m0 + 13 * m1 >> 4;
1940: pcmBuffer[i + 27] = m0 + 7 * m1 >> 3;
1941: pcmBuffer[i + 29] = m0 + 15 * m1 >> 4;
1942: pcmBuffer[i + 31] = m1;
1943: } else if (p < 0) {
1944: p = (char) p;
1945: int m0 = pcmDecodedData1;
1946: pcmBuffer[i + 1] = (15 * m0 + m1 >> 4) * pcmAttackCurve[p ] >> 14;
1947: pcmBuffer[i + 3] = ( 7 * m0 + m1 >> 3) * pcmAttackCurve[p + 1] >> 14;
1948: pcmBuffer[i + 5] = (13 * m0 + 3 * m1 >> 4) * pcmAttackCurve[p + 2] >> 14;
1949: pcmBuffer[i + 7] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 3] >> 14;
1950: pcmBuffer[i + 9] = (11 * m0 + 5 * m1 >> 4) * pcmAttackCurve[p + 4] >> 14;
1951: pcmBuffer[i + 11] = ( 5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 5] >> 14;
1952: pcmBuffer[i + 13] = ( 9 * m0 + 7 * m1 >> 4) * pcmAttackCurve[p + 6] >> 14;
1953: pcmBuffer[i + 15] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 7] >> 14;
1954: pcmBuffer[i + 17] = ( 7 * m0 + 9 * m1 >> 4) * pcmAttackCurve[p + 8] >> 14;
1955: pcmBuffer[i + 19] = ( 3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 9] >> 14;
1956: pcmBuffer[i + 21] = ( 5 * m0 + 11 * m1 >> 4) * pcmAttackCurve[p + 10] >> 14;
1957: pcmBuffer[i + 23] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 11] >> 14;
1958: pcmBuffer[i + 25] = ( 3 * m0 + 13 * m1 >> 4) * pcmAttackCurve[p + 12] >> 14;
1959: pcmBuffer[i + 27] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 13] >> 14;
1960: pcmBuffer[i + 29] = ( m0 + 15 * m1 >> 4) * pcmAttackCurve[p + 14] >> 14;
1961: pcmBuffer[i + 31] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
1962: p += 16;
1963: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
1964: } else {
1965: pcmBuffer[ i + 1] = (
1966: pcmBuffer[i + 3] =
1967: pcmBuffer[i + 5] =
1968: pcmBuffer[i + 7] =
1969: pcmBuffer[i + 9] =
1970: pcmBuffer[i + 11] =
1971: pcmBuffer[i + 13] =
1972: pcmBuffer[i + 15] =
1973: pcmBuffer[i + 17] =
1974: pcmBuffer[i + 19] =
1975: pcmBuffer[i + 21] =
1976: pcmBuffer[i + 23] =
1977: pcmBuffer[i + 25] =
1978: pcmBuffer[i + 27] =
1979: pcmBuffer[i + 29] =
1980: pcmBuffer[i + 31] = 0);
1981: }
1982: pcmDecodedData1 = m1;
1983: pcmPointer = i + 32;
1984: }
1985: },
1986:
1987:
1988: PIP_STEREO_LINEAR_12 {
1989: @Override public void write (int m1) {
1990: int i = pcmPointer;
1991: int p = pcmPanLeft;
1992: if (p > 0) {
1993: int m0 = pcmDecodedData1;
1994: pcmBuffer[i ] = 65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16;
1995: pcmBuffer[i + 2] = 65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16;
1996: pcmBuffer[i + 4] = 3 * m0 + m1 >> 2;
1997: pcmBuffer[i + 6] = 65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16;
1998: pcmBuffer[i + 8] = 65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16;
1999: pcmBuffer[i + 10] = m0 + m1 >> 1;
2000: pcmBuffer[i + 12] = 65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16;
2001: pcmBuffer[i + 14] = 65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16;
2002: pcmBuffer[i + 16] = m0 + 3 * m1 >> 2;
2003: pcmBuffer[i + 18] = 65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16;
2004: pcmBuffer[i + 20] = 65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16;
2005: pcmBuffer[i + 22] = m1;
2006: } else if (p < 0) {
2007: p = (char) p;
2008: int m0 = pcmDecodedData1;
2009: pcmBuffer[i ] = (65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2010: pcmBuffer[i + 2] = (65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2011: pcmBuffer[i + 4] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
2012: pcmBuffer[i + 6] = (65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
2013: pcmBuffer[i + 8] = (65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
2014: pcmBuffer[i + 10] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 5] >> 14;
2015: pcmBuffer[i + 12] = (65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16) * pcmAttackCurve[p + 6] >> 14;
2016: pcmBuffer[i + 14] = (65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16) * pcmAttackCurve[p + 7] >> 14;
2017: pcmBuffer[i + 16] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 8] >> 14;
2018: pcmBuffer[i + 18] = (65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16) * pcmAttackCurve[p + 9] >> 14;
2019: pcmBuffer[i + 20] = (65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16) * pcmAttackCurve[p + 10] >> 14;
2020: pcmBuffer[i + 22] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
2021: p += 12;
2022: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2023: } else {
2024: pcmBuffer[ i ] = (
2025: pcmBuffer[i + 2] =
2026: pcmBuffer[i + 4] =
2027: pcmBuffer[i + 6] =
2028: pcmBuffer[i + 8] =
2029: pcmBuffer[i + 10] =
2030: pcmBuffer[i + 12] =
2031: pcmBuffer[i + 14] =
2032: pcmBuffer[i + 16] =
2033: pcmBuffer[i + 18] =
2034: pcmBuffer[i + 20] =
2035: pcmBuffer[i + 22] = 0);
2036: }
2037: p = pcmPanRight;
2038: if (p > 0) {
2039: int m0 = pcmDecodedData1;
2040: pcmBuffer[i + 1] = 65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16;
2041: pcmBuffer[i + 3] = 65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16;
2042: pcmBuffer[i + 5] = 3 * m0 + m1 >> 2;
2043: pcmBuffer[i + 7] = 65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16;
2044: pcmBuffer[i + 9] = 65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16;
2045: pcmBuffer[i + 11] = m0 + m1 >> 1;
2046: pcmBuffer[i + 13] = 65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16;
2047: pcmBuffer[i + 15] = 65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16;
2048: pcmBuffer[i + 17] = m0 + 3 * m1 >> 2;
2049: pcmBuffer[i + 19] = 65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16;
2050: pcmBuffer[i + 21] = 65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16;
2051: pcmBuffer[i + 23] = m1;
2052: } else if (p < 0) {
2053: p = (char) p;
2054: int m0 = pcmDecodedData1;
2055: pcmBuffer[i + 1] = (65536 * 11 / 12 * m0 + 65536 * 1 / 12 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2056: pcmBuffer[i + 3] = (65536 * 10 / 12 * m0 + 65536 * 2 / 12 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2057: pcmBuffer[i + 5] = ( 3 * m0 + m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
2058: pcmBuffer[i + 7] = (65536 * 8 / 12 * m0 + 65536 * 4 / 12 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
2059: pcmBuffer[i + 9] = (65536 * 7 / 12 * m0 + 65536 * 5 / 12 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
2060: pcmBuffer[i + 11] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 5] >> 14;
2061: pcmBuffer[i + 13] = (65536 * 5 / 12 * m0 + 65536 * 7 / 12 * m1 >> 16) * pcmAttackCurve[p + 6] >> 14;
2062: pcmBuffer[i + 15] = (65536 * 4 / 12 * m0 + 65536 * 8 / 12 * m1 >> 16) * pcmAttackCurve[p + 7] >> 14;
2063: pcmBuffer[i + 17] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 8] >> 14;
2064: pcmBuffer[i + 19] = (65536 * 2 / 12 * m0 + 65536 * 10 / 12 * m1 >> 16) * pcmAttackCurve[p + 9] >> 14;
2065: pcmBuffer[i + 21] = (65536 * 1 / 12 * m0 + 65536 * 11 / 12 * m1 >> 16) * pcmAttackCurve[p + 10] >> 14;
2066: pcmBuffer[i + 23] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
2067: p += 12;
2068: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2069: } else {
2070: pcmBuffer[ i + 1] = (
2071: pcmBuffer[i + 3] =
2072: pcmBuffer[i + 5] =
2073: pcmBuffer[i + 7] =
2074: pcmBuffer[i + 9] =
2075: pcmBuffer[i + 11] =
2076: pcmBuffer[i + 13] =
2077: pcmBuffer[i + 15] =
2078: pcmBuffer[i + 17] =
2079: pcmBuffer[i + 19] =
2080: pcmBuffer[i + 21] =
2081: pcmBuffer[i + 23] = 0);
2082: }
2083: pcmDecodedData1 = m1;
2084: pcmPointer = i + 24;
2085: }
2086: },
2087:
2088:
2089: PIP_STEREO_LINEAR_8 {
2090: @Override public void write (int m1) {
2091: int i = pcmPointer;
2092: int p = pcmPanLeft;
2093: if (p > 0) {
2094: int m0 = pcmDecodedData1;
2095: pcmBuffer[i ] = 7 * m0 + m1 >> 3;
2096: pcmBuffer[i + 2] = 3 * m0 + m1 >> 2;
2097: pcmBuffer[i + 4] = 5 * m0 + 3 * m1 >> 3;
2098: pcmBuffer[i + 6] = m0 + m1 >> 1;
2099: pcmBuffer[i + 8] = 3 * m0 + 5 * m1 >> 3;
2100: pcmBuffer[i + 10] = m0 + 3 * m1 >> 2;
2101: pcmBuffer[i + 12] = m0 + 7 * m1 >> 3;
2102: pcmBuffer[i + 14] = m1;
2103: } else if (p < 0) {
2104: p = (char) p;
2105: int m0 = pcmDecodedData1;
2106: pcmBuffer[i ] = (7 * m0 + m1 >> 3) * pcmAttackCurve[p ] >> 14;
2107: pcmBuffer[i + 2] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p + 1] >> 14;
2108: pcmBuffer[i + 4] = (5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 2] >> 14;
2109: pcmBuffer[i + 6] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 3] >> 14;
2110: pcmBuffer[i + 8] = (3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 4] >> 14;
2111: pcmBuffer[i + 10] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 5] >> 14;
2112: pcmBuffer[i + 12] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 6] >> 14;
2113: pcmBuffer[i + 14] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
2114: p += 8;
2115: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2116: } else {
2117: pcmBuffer[ i ] = (
2118: pcmBuffer[i + 2] =
2119: pcmBuffer[i + 4] =
2120: pcmBuffer[i + 6] =
2121: pcmBuffer[i + 8] =
2122: pcmBuffer[i + 10] =
2123: pcmBuffer[i + 12] =
2124: pcmBuffer[i + 14] = 0);
2125: }
2126: p = pcmPanRight;
2127: if (p > 0) {
2128: int m0 = pcmDecodedData1;
2129: pcmBuffer[i + 1] = 7 * m0 + m1 >> 3;
2130: pcmBuffer[i + 3] = 3 * m0 + m1 >> 2;
2131: pcmBuffer[i + 5] = 5 * m0 + 3 * m1 >> 3;
2132: pcmBuffer[i + 7] = m0 + m1 >> 1;
2133: pcmBuffer[i + 9] = 3 * m0 + 5 * m1 >> 3;
2134: pcmBuffer[i + 11] = m0 + 3 * m1 >> 2;
2135: pcmBuffer[i + 13] = m0 + 7 * m1 >> 3;
2136: pcmBuffer[i + 15] = m1;
2137: } else if (p < 0) {
2138: p = (char) p;
2139: int m0 = pcmDecodedData1;
2140: pcmBuffer[i + 1] = (7 * m0 + m1 >> 3) * pcmAttackCurve[p ] >> 14;
2141: pcmBuffer[i + 3] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p + 1] >> 14;
2142: pcmBuffer[i + 5] = (5 * m0 + 3 * m1 >> 3) * pcmAttackCurve[p + 2] >> 14;
2143: pcmBuffer[i + 7] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 3] >> 14;
2144: pcmBuffer[i + 9] = (3 * m0 + 5 * m1 >> 3) * pcmAttackCurve[p + 4] >> 14;
2145: pcmBuffer[i + 11] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 5] >> 14;
2146: pcmBuffer[i + 13] = ( m0 + 7 * m1 >> 3) * pcmAttackCurve[p + 6] >> 14;
2147: pcmBuffer[i + 15] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
2148: p += 8;
2149: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2150: } else {
2151: pcmBuffer[ i + 1] = (
2152: pcmBuffer[i + 3] =
2153: pcmBuffer[i + 5] =
2154: pcmBuffer[i + 7] =
2155: pcmBuffer[i + 9] =
2156: pcmBuffer[i + 11] =
2157: pcmBuffer[i + 13] =
2158: pcmBuffer[i + 15] = 0);
2159: }
2160: pcmDecodedData1 = m1;
2161: pcmPointer = i + 16;
2162: }
2163: },
2164:
2165:
2166: PIP_STEREO_LINEAR_6 {
2167: @Override public void write (int m1) {
2168: int i = pcmPointer;
2169: int p = pcmPanLeft;
2170: if (p > 0) {
2171: int m0 = pcmDecodedData1;
2172: pcmBuffer[i ] = 65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16;
2173: pcmBuffer[i + 2] = 65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16;
2174: pcmBuffer[i + 4] = m0 + m1 >> 1;
2175: pcmBuffer[i + 6] = 65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16;
2176: pcmBuffer[i + 8] = 65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16;
2177: pcmBuffer[i + 10] = m1;
2178: } else if (p < 0) {
2179: p = (char) p;
2180: int m0 = pcmDecodedData1;
2181: pcmBuffer[i ] = (65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2182: pcmBuffer[i + 2] = (65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2183: pcmBuffer[i + 4] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 2] >> 14;
2184: pcmBuffer[i + 6] = (65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
2185: pcmBuffer[i + 8] = (65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
2186: pcmBuffer[i + 10] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
2187: p += 6;
2188: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2189: } else {
2190: pcmBuffer[ i ] = (
2191: pcmBuffer[i + 2] =
2192: pcmBuffer[i + 4] =
2193: pcmBuffer[i + 6] =
2194: pcmBuffer[i + 8] =
2195: pcmBuffer[i + 10] = 0);
2196: }
2197: p = pcmPanRight;
2198: if (p > 0) {
2199: int m0 = pcmDecodedData1;
2200: pcmBuffer[i + 1] = 65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16;
2201: pcmBuffer[i + 3] = 65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16;
2202: pcmBuffer[i + 5] = m0 + m1 >> 1;
2203: pcmBuffer[i + 7] = 65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16;
2204: pcmBuffer[i + 9] = 65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16;
2205: pcmBuffer[i + 11] = m1;
2206: } else if (p < 0) {
2207: p = (char) p;
2208: int m0 = pcmDecodedData1;
2209: pcmBuffer[i + 1] = (65536 * 5 / 6 * m0 + 65536 * 1 / 6 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2210: pcmBuffer[i + 3] = (65536 * 4 / 6 * m0 + 65536 * 2 / 6 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2211: pcmBuffer[i + 5] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 2] >> 14;
2212: pcmBuffer[i + 7] = (65536 * 2 / 6 * m0 + 65536 * 4 / 6 * m1 >> 16) * pcmAttackCurve[p + 3] >> 14;
2213: pcmBuffer[i + 9] = (65536 * 1 / 6 * m0 + 65536 * 5 / 6 * m1 >> 16) * pcmAttackCurve[p + 4] >> 14;
2214: pcmBuffer[i + 11] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
2215: p += 6;
2216: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2217: } else {
2218: pcmBuffer[ i + 1] = (
2219: pcmBuffer[i + 3] =
2220: pcmBuffer[i + 5] =
2221: pcmBuffer[i + 7] =
2222: pcmBuffer[i + 9] =
2223: pcmBuffer[i + 11] = 0);
2224: }
2225: pcmDecodedData1 = m1;
2226: pcmPointer = i + 12;
2227: }
2228: },
2229:
2230:
2231: PIP_STEREO_LINEAR_4 {
2232: @Override public void write (int m1) {
2233: int i = pcmPointer;
2234: int p = pcmPanLeft;
2235: if (p > 0) {
2236: int m0 = pcmDecodedData1;
2237: pcmBuffer[i ] = 3 * m0 + m1 >> 2;
2238: pcmBuffer[i + 2] = m0 + m1 >> 1;
2239: pcmBuffer[i + 4] = m0 + 3 * m1 >> 2;
2240: pcmBuffer[i + 6] = m1;
2241: } else if (p < 0) {
2242: p = (char) p;
2243: int m0 = pcmDecodedData1;
2244: pcmBuffer[i ] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p ] >> 14;
2245: pcmBuffer[i + 2] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 1] >> 14;
2246: pcmBuffer[i + 4] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
2247: pcmBuffer[i + 6] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
2248: p += 4;
2249: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2250: } else {
2251: pcmBuffer[ i ] = (
2252: pcmBuffer[i + 2] =
2253: pcmBuffer[i + 4] =
2254: pcmBuffer[i + 6] = 0);
2255: }
2256: p = pcmPanRight;
2257: if (p > 0) {
2258: int m0 = pcmDecodedData1;
2259: pcmBuffer[i + 1] = 3 * m0 + m1 >> 2;
2260: pcmBuffer[i + 3] = m0 + m1 >> 1;
2261: pcmBuffer[i + 5] = m0 + 3 * m1 >> 2;
2262: pcmBuffer[i + 7] = m1;
2263: } else if (p < 0) {
2264: p = (char) p;
2265: int m0 = pcmDecodedData1;
2266: pcmBuffer[i + 1] = (3 * m0 + m1 >> 2) * pcmAttackCurve[p ] >> 14;
2267: pcmBuffer[i + 3] = ( m0 + m1 >> 1) * pcmAttackCurve[p + 1] >> 14;
2268: pcmBuffer[i + 5] = ( m0 + 3 * m1 >> 2) * pcmAttackCurve[p + 2] >> 14;
2269: pcmBuffer[i + 7] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
2270: p += 4;
2271: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2272: } else {
2273: pcmBuffer[ i + 1] = (
2274: pcmBuffer[i + 3] =
2275: pcmBuffer[i + 5] =
2276: pcmBuffer[i + 7] = 0);
2277: }
2278: pcmDecodedData1 = m1;
2279: pcmPointer = i + 8;
2280: }
2281: },
2282:
2283:
2284: PIP_STEREO_LINEAR_3 {
2285: @Override public void write (int m1) {
2286: int i = pcmPointer;
2287: int p = pcmPanLeft;
2288: if (p > 0) {
2289: int m0 = pcmDecodedData1;
2290: pcmBuffer[i ] = 65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16;
2291: pcmBuffer[i + 2] = 65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16;
2292: pcmBuffer[i + 4] = m1;
2293: } else if (p < 0) {
2294: p = (char) p;
2295: int m0 = pcmDecodedData1;
2296: pcmBuffer[i ] = (65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2297: pcmBuffer[i + 2] = (65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2298: pcmBuffer[i + 4] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
2299: p += 3;
2300: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2301: } else {
2302: pcmBuffer[ i ] = (
2303: pcmBuffer[i + 2] =
2304: pcmBuffer[i + 4] = 0);
2305: }
2306: p = pcmPanRight;
2307: if (p > 0) {
2308: int m0 = pcmDecodedData1;
2309: pcmBuffer[i + 1] = 65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16;
2310: pcmBuffer[i + 3] = 65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16;
2311: pcmBuffer[i + 5] = m1;
2312: } else if (p < 0) {
2313: p = (char) p;
2314: int m0 = pcmDecodedData1;
2315: pcmBuffer[i + 1] = (65536 * 2 / 3 * m0 + 65536 * 1 / 3 * m1 >> 16) * pcmAttackCurve[p ] >> 14;
2316: pcmBuffer[i + 3] = (65536 * 1 / 3 * m0 + 65536 * 2 / 3 * m1 >> 16) * pcmAttackCurve[p + 1] >> 14;
2317: pcmBuffer[i + 5] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
2318: p += 3;
2319: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2320: } else {
2321: pcmBuffer[ i + 1] = (
2322: pcmBuffer[i + 3] =
2323: pcmBuffer[i + 5] = 0);
2324: }
2325: pcmDecodedData1 = m1;
2326: pcmPointer = i + 6;
2327: }
2328: },
2329:
2330:
2331: PIP_STEREO_LINEAR_2 {
2332: @Override public void write (int m1) {
2333: int i = pcmPointer;
2334: int p = pcmPanLeft;
2335: if (p > 0) {
2336: int m0 = pcmDecodedData1;
2337: pcmBuffer[i ] = m0 + m1 >> 1;
2338: pcmBuffer[i + 2] = m1;
2339: } else if (p < 0) {
2340: p = (char) p;
2341: int m0 = pcmDecodedData1;
2342: pcmBuffer[i ] = (m0 + m1 >> 1) * pcmAttackCurve[p ] >> 14;
2343: pcmBuffer[i + 2] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
2344: p += 2;
2345: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2346: } else {
2347: pcmBuffer[ i ] = (
2348: pcmBuffer[i + 2] = 0);
2349: }
2350: p = pcmPanRight;
2351: if (p > 0) {
2352: int m0 = pcmDecodedData1;
2353: pcmBuffer[i + 1] = m0 + m1 >> 1;
2354: pcmBuffer[i + 3] = m1;
2355: } else if (p < 0) {
2356: p = (char) p;
2357: int m0 = pcmDecodedData1;
2358: pcmBuffer[i + 1] = (m0 + m1 >> 1) * pcmAttackCurve[p ] >> 14;
2359: pcmBuffer[i + 3] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
2360: p += 2;
2361: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2362: } else {
2363: pcmBuffer[ i + 1] = (
2364: pcmBuffer[i + 3] = 0);
2365: }
2366: pcmDecodedData1 = m1;
2367: pcmPointer = i + 4;
2368: }
2369: },
2370:
2371:
2372: PIP_STEREO_HERMITE_16 {
2373: @Override public void write (int m2) {
2374:
2375: int i = pcmPointer;
2376: int mm = pcmDecodedData3;
2377: int m0 = pcmDecodedData2;
2378: int m1 = pcmDecodedData1;
2379: int p = pcmPanLeft;
2380: if (p > 0) {
2381: pcmBuffer[i ] = -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13;
2382: pcmBuffer[i + 2] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
2383: pcmBuffer[i + 4] = -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13;
2384: pcmBuffer[i + 6] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2385: pcmBuffer[i + 8] = -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13;
2386: pcmBuffer[i + 10] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
2387: pcmBuffer[i + 12] = -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13;
2388: pcmBuffer[i + 14] = -mm + 9 * (m0 + m1) - m2 >> 4;
2389: pcmBuffer[i + 16] = -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13;
2390: pcmBuffer[i + 18] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
2391: pcmBuffer[i + 20] = -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13;
2392: pcmBuffer[i + 22] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2393: pcmBuffer[i + 24] = -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13;
2394: pcmBuffer[i + 26] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
2395: pcmBuffer[i + 28] = -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13;
2396: pcmBuffer[i + 30] = m1;
2397: } else if (p < 0) {
2398: p = (char) p;
2399: pcmBuffer[i ] = ( -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13) * pcmAttackCurve[p ] >> 14;
2400: pcmBuffer[i + 2] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p + 1] >> 14;
2401: pcmBuffer[i + 4] = ( -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13) * pcmAttackCurve[p + 2] >> 14;
2402: pcmBuffer[i + 6] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 3] >> 14;
2403: pcmBuffer[i + 8] = ( -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13) * pcmAttackCurve[p + 4] >> 14;
2404: pcmBuffer[i + 10] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 5] >> 14;
2405: pcmBuffer[i + 12] = ( -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13) * pcmAttackCurve[p + 6] >> 14;
2406: pcmBuffer[i + 14] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 7] >> 14;
2407: pcmBuffer[i + 16] = ( -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13) * pcmAttackCurve[p + 8] >> 14;
2408: pcmBuffer[i + 18] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 9] >> 14;
2409: pcmBuffer[i + 20] = ( -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13) * pcmAttackCurve[p + 10] >> 14;
2410: pcmBuffer[i + 22] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 11] >> 14;
2411: pcmBuffer[i + 24] = ( -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13) * pcmAttackCurve[p + 12] >> 14;
2412: pcmBuffer[i + 26] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 13] >> 14;
2413: pcmBuffer[i + 28] = ( -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13) * pcmAttackCurve[p + 14] >> 14;
2414: pcmBuffer[i + 30] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
2415: p += 16;
2416: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2417: } else {
2418: pcmBuffer[ i ] = (
2419: pcmBuffer[i + 2] =
2420: pcmBuffer[i + 4] =
2421: pcmBuffer[i + 6] =
2422: pcmBuffer[i + 8] =
2423: pcmBuffer[i + 10] =
2424: pcmBuffer[i + 12] =
2425: pcmBuffer[i + 14] =
2426: pcmBuffer[i + 16] =
2427: pcmBuffer[i + 18] =
2428: pcmBuffer[i + 20] =
2429: pcmBuffer[i + 22] =
2430: pcmBuffer[i + 24] =
2431: pcmBuffer[i + 26] =
2432: pcmBuffer[i + 28] =
2433: pcmBuffer[i + 30] = 0);
2434: }
2435: p = pcmPanRight;
2436: if (p > 0) {
2437: pcmBuffer[i + 1] = -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13;
2438: pcmBuffer[i + 3] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
2439: pcmBuffer[i + 5] = -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13;
2440: pcmBuffer[i + 7] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2441: pcmBuffer[i + 9] = -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13;
2442: pcmBuffer[i + 11] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
2443: pcmBuffer[i + 13] = -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13;
2444: pcmBuffer[i + 15] = -mm + 9 * (m0 + m1) - m2 >> 4;
2445: pcmBuffer[i + 17] = -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13;
2446: pcmBuffer[i + 19] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
2447: pcmBuffer[i + 21] = -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13;
2448: pcmBuffer[i + 23] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2449: pcmBuffer[i + 25] = -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13;
2450: pcmBuffer[i + 27] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
2451: pcmBuffer[i + 29] = -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13;
2452: pcmBuffer[i + 31] = m1;
2453: } else if (p < 0) {
2454: p = (char) p;
2455: pcmBuffer[i + 1] = ( -225 * mm + 8115 * m0 + 317 * m1 - 15 * m2 >> 13) * pcmAttackCurve[p ] >> 14;
2456: pcmBuffer[i + 3] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p + 1] >> 14;
2457: pcmBuffer[i + 5] = ( -507 * mm + 7553 * m0 + 1263 * m1 - 117 * m2 >> 13) * pcmAttackCurve[p + 2] >> 14;
2458: pcmBuffer[i + 7] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 3] >> 14;
2459: pcmBuffer[i + 9] = ( -605 * mm + 6567 * m0 + 2505 * m1 - 275 * m2 >> 13) * pcmAttackCurve[p + 4] >> 14;
2460: pcmBuffer[i + 11] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 5] >> 14;
2461: pcmBuffer[i + 13] = ( -567 * mm + 5301 * m0 + 3899 * m1 - 441 * m2 >> 13) * pcmAttackCurve[p + 6] >> 14;
2462: pcmBuffer[i + 15] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 7] >> 14;
2463: pcmBuffer[i + 17] = ( -441 * mm + 3899 * m0 + 5301 * m1 - 567 * m2 >> 13) * pcmAttackCurve[p + 8] >> 14;
2464: pcmBuffer[i + 19] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 9] >> 14;
2465: pcmBuffer[i + 21] = ( -275 * mm + 2505 * m0 + 6567 * m1 - 605 * m2 >> 13) * pcmAttackCurve[p + 10] >> 14;
2466: pcmBuffer[i + 23] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 11] >> 14;
2467: pcmBuffer[i + 25] = ( -117 * mm + 1263 * m0 + 7553 * m1 - 507 * m2 >> 13) * pcmAttackCurve[p + 12] >> 14;
2468: pcmBuffer[i + 27] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 13] >> 14;
2469: pcmBuffer[i + 29] = ( -15 * mm + 317 * m0 + 8115 * m1 - 225 * m2 >> 13) * pcmAttackCurve[p + 14] >> 14;
2470: pcmBuffer[i + 31] = ( m1 ) * pcmAttackCurve[p + 15] >> 14;
2471: p += 16;
2472: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2473: } else {
2474: pcmBuffer[ i + 1] = (
2475: pcmBuffer[i + 3] =
2476: pcmBuffer[i + 5] =
2477: pcmBuffer[i + 7] =
2478: pcmBuffer[i + 9] =
2479: pcmBuffer[i + 11] =
2480: pcmBuffer[i + 13] =
2481: pcmBuffer[i + 15] =
2482: pcmBuffer[i + 17] =
2483: pcmBuffer[i + 19] =
2484: pcmBuffer[i + 21] =
2485: pcmBuffer[i + 23] =
2486: pcmBuffer[i + 25] =
2487: pcmBuffer[i + 27] =
2488: pcmBuffer[i + 29] =
2489: pcmBuffer[i + 31] = 0);
2490: }
2491: pcmDecodedData3 = m0;
2492: pcmDecodedData2 = m1;
2493: pcmDecodedData1 = m2;
2494: pcmPointer = i + 32;
2495: }
2496: },
2497:
2498:
2499: PIP_STEREO_HERMITE_12 {
2500: @Override public void write (int m2) {
2501:
2502: int i = pcmPointer;
2503: int mm = pcmDecodedData3;
2504: int m0 = pcmDecodedData2;
2505: int m1 = pcmDecodedData1;
2506: int p = pcmPanLeft;
2507: if (p > 0) {
2508: pcmBuffer[i ] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32);
2509: pcmBuffer[i + 2] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
2510: pcmBuffer[i + 4] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2511: pcmBuffer[i + 6] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2512: pcmBuffer[i + 8] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32);
2513: pcmBuffer[i + 10] = -mm + 9 * (m0 + m1) - m2 >> 4;
2514: pcmBuffer[i + 12] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32);
2515: pcmBuffer[i + 14] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2516: pcmBuffer[i + 16] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2517: pcmBuffer[i + 18] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
2518: pcmBuffer[i + 20] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32);
2519: pcmBuffer[i + 22] = m1;
2520: } else if (p < 0) {
2521: p = (char) p;
2522: pcmBuffer[i ] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32) * pcmAttackCurve[p ] >> 14;
2523: pcmBuffer[i + 2] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 1] >> 14;
2524: pcmBuffer[i + 4] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7 ) * pcmAttackCurve[p + 2] >> 14;
2525: pcmBuffer[i + 6] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
2526: pcmBuffer[i + 8] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 4] >> 14;
2527: pcmBuffer[i + 10] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 5] >> 14;
2528: pcmBuffer[i + 12] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 6] >> 14;
2529: pcmBuffer[i + 14] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 7] >> 14;
2530: pcmBuffer[i + 16] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7 ) * pcmAttackCurve[p + 8] >> 14;
2531: pcmBuffer[i + 18] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 9] >> 14;
2532: pcmBuffer[i + 20] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 10] >> 14;
2533: pcmBuffer[i + 22] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
2534: p += 12;
2535: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2536: } else {
2537: pcmBuffer[ i ] = (
2538: pcmBuffer[i + 2] =
2539: pcmBuffer[i + 4] =
2540: pcmBuffer[i + 6] =
2541: pcmBuffer[i + 8] =
2542: pcmBuffer[i + 10] =
2543: pcmBuffer[i + 12] =
2544: pcmBuffer[i + 14] =
2545: pcmBuffer[i + 16] =
2546: pcmBuffer[i + 18] =
2547: pcmBuffer[i + 20] =
2548: pcmBuffer[i + 22] = 0);
2549: }
2550: p = pcmPanRight;
2551: if (p > 0) {
2552: pcmBuffer[i + 1] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32);
2553: pcmBuffer[i + 3] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
2554: pcmBuffer[i + 5] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2555: pcmBuffer[i + 7] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2556: pcmBuffer[i + 9] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32);
2557: pcmBuffer[i + 11] = -mm + 9 * (m0 + m1) - m2 >> 4;
2558: pcmBuffer[i + 13] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32);
2559: pcmBuffer[i + 15] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2560: pcmBuffer[i + 17] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2561: pcmBuffer[i + 19] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
2562: pcmBuffer[i + 21] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32);
2563: pcmBuffer[i + 23] = m1;
2564: } else if (p < 0) {
2565: p = (char) p;
2566: pcmBuffer[i + 1] = (int) (( -121 * mm + 3399 * m0 + 189 * m1 - 11 * m2) * 1242757L >> 32) * pcmAttackCurve[p ] >> 14;
2567: pcmBuffer[i + 3] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 1] >> 14;
2568: pcmBuffer[i + 5] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7 ) * pcmAttackCurve[p + 2] >> 14;
2569: pcmBuffer[i + 7] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
2570: pcmBuffer[i + 9] = (int) (( -245 * mm + 2331 * m0 + 1545 * m1 - 175 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 4] >> 14;
2571: pcmBuffer[i + 11] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 5] >> 14;
2572: pcmBuffer[i + 13] = (int) (( -175 * mm + 1545 * m0 + 2331 * m1 - 245 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 6] >> 14;
2573: pcmBuffer[i + 15] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 7] >> 14;
2574: pcmBuffer[i + 17] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7 ) * pcmAttackCurve[p + 8] >> 14;
2575: pcmBuffer[i + 19] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 9] >> 14;
2576: pcmBuffer[i + 21] = (int) (( -11 * mm + 189 * m0 + 3399 * m1 - 121 * m2) * 1242757L >> 32) * pcmAttackCurve[p + 10] >> 14;
2577: pcmBuffer[i + 23] = ( m1 ) * pcmAttackCurve[p + 11] >> 14;
2578: p += 12;
2579: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2580: } else {
2581: pcmBuffer[ i + 1] = (
2582: pcmBuffer[i + 3] =
2583: pcmBuffer[i + 5] =
2584: pcmBuffer[i + 7] =
2585: pcmBuffer[i + 9] =
2586: pcmBuffer[i + 11] =
2587: pcmBuffer[i + 13] =
2588: pcmBuffer[i + 15] =
2589: pcmBuffer[i + 17] =
2590: pcmBuffer[i + 19] =
2591: pcmBuffer[i + 21] =
2592: pcmBuffer[i + 23] = 0);
2593: }
2594: pcmDecodedData3 = m0;
2595: pcmDecodedData2 = m1;
2596: pcmDecodedData1 = m2;
2597: pcmPointer = i + 24;
2598: }
2599: },
2600:
2601:
2602: PIP_STEREO_HERMITE_8 {
2603: @Override public void write (int m2) {
2604:
2605: int i = pcmPointer;
2606: int mm = pcmDecodedData3;
2607: int m0 = pcmDecodedData2;
2608: int m1 = pcmDecodedData1;
2609: int p = pcmPanLeft;
2610: if (p > 0) {
2611: pcmBuffer[i ] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
2612: pcmBuffer[i + 2] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2613: pcmBuffer[i + 4] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
2614: pcmBuffer[i + 6] = -mm + 9 * (m0 + m1) - m2 >> 4;
2615: pcmBuffer[i + 8] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
2616: pcmBuffer[i + 10] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2617: pcmBuffer[i + 12] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
2618: pcmBuffer[i + 14] = m1;
2619: } else if (p < 0) {
2620: p = (char) p;
2621: pcmBuffer[i ] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p ] >> 14;
2622: pcmBuffer[i + 2] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 1] >> 14;
2623: pcmBuffer[i + 4] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 2] >> 14;
2624: pcmBuffer[i + 6] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 3] >> 14;
2625: pcmBuffer[i + 8] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 4] >> 14;
2626: pcmBuffer[i + 10] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 5] >> 14;
2627: pcmBuffer[i + 12] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 6] >> 14;
2628: pcmBuffer[i + 14] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
2629: p += 8;
2630: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2631: } else {
2632: pcmBuffer[ i ] = (
2633: pcmBuffer[i + 2] =
2634: pcmBuffer[i + 4] =
2635: pcmBuffer[i + 6] =
2636: pcmBuffer[i + 8] =
2637: pcmBuffer[i + 10] =
2638: pcmBuffer[i + 12] =
2639: pcmBuffer[i + 14] = 0);
2640: }
2641: p = pcmPanRight;
2642: if (p > 0) {
2643: pcmBuffer[i + 1] = -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10;
2644: pcmBuffer[i + 3] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2645: pcmBuffer[i + 5] = -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10;
2646: pcmBuffer[i + 7] = -mm + 9 * (m0 + m1) - m2 >> 4;
2647: pcmBuffer[i + 9] = -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10;
2648: pcmBuffer[i + 11] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2649: pcmBuffer[i + 13] = -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10;
2650: pcmBuffer[i + 15] = m1;
2651: } else if (p < 0) {
2652: p = (char) p;
2653: pcmBuffer[i + 1] = ( -49 * mm + 987 * m0 + 93 * m1 - 7 * m2 >> 10) * pcmAttackCurve[p ] >> 14;
2654: pcmBuffer[i + 3] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p + 1] >> 14;
2655: pcmBuffer[i + 5] = ( -75 * mm + 745 * m0 + 399 * m1 - 45 * m2 >> 10) * pcmAttackCurve[p + 2] >> 14;
2656: pcmBuffer[i + 7] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 3] >> 14;
2657: pcmBuffer[i + 9] = ( -45 * mm + 399 * m0 + 745 * m1 - 75 * m2 >> 10) * pcmAttackCurve[p + 4] >> 14;
2658: pcmBuffer[i + 11] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 5] >> 14;
2659: pcmBuffer[i + 13] = ( -7 * mm + 93 * m0 + 987 * m1 - 49 * m2 >> 10) * pcmAttackCurve[p + 6] >> 14;
2660: pcmBuffer[i + 15] = ( m1 ) * pcmAttackCurve[p + 7] >> 14;
2661: p += 8;
2662: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2663: } else {
2664: pcmBuffer[ i + 1] = (
2665: pcmBuffer[i + 3] =
2666: pcmBuffer[i + 5] =
2667: pcmBuffer[i + 7] =
2668: pcmBuffer[i + 9] =
2669: pcmBuffer[i + 11] =
2670: pcmBuffer[i + 13] =
2671: pcmBuffer[i + 15] = 0);
2672: }
2673: pcmDecodedData3 = m0;
2674: pcmDecodedData2 = m1;
2675: pcmDecodedData1 = m2;
2676: pcmPointer = i + 16;
2677: }
2678: },
2679:
2680:
2681: PIP_STEREO_HERMITE_6 {
2682: @Override public void write (int m2) {
2683:
2684: int i = pcmPointer;
2685: int mm = pcmDecodedData3;
2686: int m0 = pcmDecodedData2;
2687: int m1 = pcmDecodedData1;
2688: int p = pcmPanLeft;
2689: if (p > 0) {
2690: pcmBuffer[i ] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
2691: pcmBuffer[i + 2] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2692: pcmBuffer[i + 4] = -mm + 9 * (m0 + m1) - m2 >> 4;
2693: pcmBuffer[i + 6] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2694: pcmBuffer[i + 8] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
2695: pcmBuffer[i + 10] = m1;
2696: } else if (p < 0) {
2697: p = (char) p;
2698: pcmBuffer[i ] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p ] >> 14;
2699: pcmBuffer[i + 2] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
2700: pcmBuffer[i + 4] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 2] >> 14;
2701: pcmBuffer[i + 6] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
2702: pcmBuffer[i + 8] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 4] >> 14;
2703: pcmBuffer[i + 10] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
2704: p += 6;
2705: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2706: } else {
2707: pcmBuffer[ i ] = (
2708: pcmBuffer[i + 2] =
2709: pcmBuffer[i + 4] =
2710: pcmBuffer[i + 6] =
2711: pcmBuffer[i + 8] =
2712: pcmBuffer[i + 10] = 0);
2713: }
2714: p = pcmPanRight;
2715: if (p > 0) {
2716: pcmBuffer[i + 1] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32);
2717: pcmBuffer[i + 3] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2718: pcmBuffer[i + 5] = -mm + 9 * (m0 + m1) - m2 >> 4;
2719: pcmBuffer[i + 7] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2720: pcmBuffer[i + 9] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32);
2721: pcmBuffer[i + 11] = m1;
2722: } else if (p < 0) {
2723: p = (char) p;
2724: pcmBuffer[i + 1] = (int) (( -25 * mm + 405 * m0 + 57 * m1 - 5 * m2) * 9942054L >> 32) * pcmAttackCurve[p ] >> 14;
2725: pcmBuffer[i + 3] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
2726: pcmBuffer[i + 5] = ( -mm + 9 * (m0 + m1) - m2 >> 4 ) * pcmAttackCurve[p + 2] >> 14;
2727: pcmBuffer[i + 7] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 3] >> 14;
2728: pcmBuffer[i + 9] = (int) (( -5 * mm + 57 * m0 + 405 * m1 - 25 * m2) * 9942054L >> 32) * pcmAttackCurve[p + 4] >> 14;
2729: pcmBuffer[i + 11] = ( m1 ) * pcmAttackCurve[p + 5] >> 14;
2730: p += 6;
2731: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2732: } else {
2733: pcmBuffer[ i + 1] = (
2734: pcmBuffer[i + 3] =
2735: pcmBuffer[i + 5] =
2736: pcmBuffer[i + 7] =
2737: pcmBuffer[i + 9] =
2738: pcmBuffer[i + 11] = 0);
2739: }
2740: pcmDecodedData3 = m0;
2741: pcmDecodedData2 = m1;
2742: pcmDecodedData1 = m2;
2743: pcmPointer = i + 6;
2744: }
2745: },
2746:
2747:
2748: PIP_STEREO_HERMITE_4 {
2749: @Override public void write (int m2) {
2750:
2751: int i = pcmPointer;
2752: int mm = pcmDecodedData3;
2753: int m0 = pcmDecodedData2;
2754: int m1 = pcmDecodedData1;
2755: int p = pcmPanLeft;
2756: if (p > 0) {
2757: pcmBuffer[i ] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2758: pcmBuffer[i + 2] = -mm + 9 * (m0 + m1) - m2 >> 4;
2759: pcmBuffer[i + 4] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2760: pcmBuffer[i + 6] = m1;
2761: } else if (p < 0) {
2762: p = (char) p;
2763: pcmBuffer[i ] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p ] >> 14;
2764: pcmBuffer[i + 2] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 1] >> 14;
2765: pcmBuffer[i + 4] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 2] >> 14;
2766: pcmBuffer[i + 6] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
2767: p += 4;
2768: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2769: } else {
2770: pcmBuffer[ i ] = (
2771: pcmBuffer[i + 2] =
2772: pcmBuffer[i + 4] =
2773: pcmBuffer[i + 6] = 0);
2774: }
2775: p = pcmPanRight;
2776: if (p > 0) {
2777: pcmBuffer[i + 1] = -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7;
2778: pcmBuffer[i + 3] = -mm + 9 * (m0 + m1) - m2 >> 4;
2779: pcmBuffer[i + 5] = -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7;
2780: pcmBuffer[i + 7] = m1;
2781: } else if (p < 0) {
2782: p = (char) p;
2783: pcmBuffer[i + 1] = ( -9 * mm + 111 * m0 + 29 * m1 - 3 * m2 >> 7) * pcmAttackCurve[p ] >> 14;
2784: pcmBuffer[i + 3] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p + 1] >> 14;
2785: pcmBuffer[i + 5] = ( -3 * mm + 29 * m0 + 111 * m1 - 9 * m2 >> 7) * pcmAttackCurve[p + 2] >> 14;
2786: pcmBuffer[i + 7] = ( m1 ) * pcmAttackCurve[p + 3] >> 14;
2787: p += 4;
2788: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2789: } else {
2790: pcmBuffer[ i + 1] = (
2791: pcmBuffer[i + 3] =
2792: pcmBuffer[i + 5] =
2793: pcmBuffer[i + 7] = 0);
2794: }
2795: pcmDecodedData3 = m0;
2796: pcmDecodedData2 = m1;
2797: pcmDecodedData1 = m2;
2798: pcmPointer = i + 8;
2799: }
2800: },
2801:
2802:
2803: PIP_STEREO_HERMITE_3 {
2804: @Override public void write (int m2) {
2805:
2806: int i = pcmPointer;
2807: int mm = pcmDecodedData3;
2808: int m0 = pcmDecodedData2;
2809: int m1 = pcmDecodedData1;
2810: int p = pcmPanLeft;
2811: if (p > 0) {
2812: pcmBuffer[i ] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2813: pcmBuffer[i + 2] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2814: pcmBuffer[i + 4] = m1;
2815: } else if (p < 0) {
2816: p = (char) p;
2817: pcmBuffer[i ] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p ] >> 14;
2818: pcmBuffer[i + 2] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
2819: pcmBuffer[i + 4] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
2820: p += 3;
2821: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2822: } else {
2823: pcmBuffer[ i ] = (
2824: pcmBuffer[i + 2] =
2825: pcmBuffer[i + 4] = 0);
2826: }
2827: p = pcmPanRight;
2828: if (p > 0) {
2829: pcmBuffer[i + 1] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32);
2830: pcmBuffer[i + 3] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32);
2831: pcmBuffer[i + 5] = m1;
2832: } else if (p < 0) {
2833: p = (char) p;
2834: pcmBuffer[i + 1] = (int) (( -2 * mm + 21 * m0 + 9 * m1 - m2) * 159072863L >> 32) * pcmAttackCurve[p ] >> 14;
2835: pcmBuffer[i + 3] = (int) (( -mm + 9 * m0 + 21 * m1 - 2 * m2) * 159072863L >> 32) * pcmAttackCurve[p + 1] >> 14;
2836: pcmBuffer[i + 5] = ( m1 ) * pcmAttackCurve[p + 2] >> 14;
2837: p += 3;
2838: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2839: } else {
2840: pcmBuffer[ i + 1] = (
2841: pcmBuffer[i + 3] =
2842: pcmBuffer[i + 5] = 0);
2843: }
2844: pcmDecodedData3 = m0;
2845: pcmDecodedData2 = m1;
2846: pcmDecodedData1 = m2;
2847: pcmPointer = i + 6;
2848: }
2849: },
2850:
2851:
2852: PIP_STEREO_HERMITE_2 {
2853: @Override public void write (int m2) {
2854:
2855: int i = pcmPointer;
2856: int mm = pcmDecodedData3;
2857: int m0 = pcmDecodedData2;
2858: int m1 = pcmDecodedData1;
2859: int p = pcmPanLeft;
2860: if (p > 0) {
2861: pcmBuffer[i ] = -mm + 9 * (m0 + m1) - m2 >> 4;
2862: pcmBuffer[i + 2] = m1;
2863: } else if (p < 0) {
2864: p = (char) p;
2865: pcmBuffer[i ] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p ] >> 14;
2866: pcmBuffer[i + 2] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
2867: p += 2;
2868: pcmPanLeft = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2869: } else {
2870: pcmBuffer[ i ] = (
2871: pcmBuffer[i + 2] = 0);
2872: }
2873: p = pcmPanRight;
2874: if (p > 0) {
2875: pcmBuffer[i + 1] = -mm + 9 * (m0 + m1) - m2 >> 4;
2876: pcmBuffer[i + 3] = m1;
2877: } else if (p < 0) {
2878: p = (char) p;
2879: pcmBuffer[i + 1] = ( -mm + 9 * (m0 + m1) - m2 >> 4) * pcmAttackCurve[p ] >> 14;
2880: pcmBuffer[i + 3] = ( m1 ) * pcmAttackCurve[p + 1] >> 14;
2881: p += 2;
2882: pcmPanRight = p << -(PCM_ATTACK_RATE + 1) >= 0 ? 0x80000000 + p : p >> PCM_ATTACK_RATE + 1;
2883: } else {
2884: pcmBuffer[ i + 1] = (
2885: pcmBuffer[i + 3] = 0);
2886: }
2887: pcmDecodedData3 = m0;
2888: pcmDecodedData2 = m1;
2889: pcmDecodedData1 = m2;
2890: pcmPointer = i + 4;
2891: }
2892: };
2893:
2894: public abstract void write (int m);
2895:
2896: }
2897:
2898:
2899:
2900: }
2901:
2902:
2903: