Loading...
Searching...
No Matches
Go to the documentation of this file.
42#define A_INTERLEAVE 13
45#if !(defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU))
58#define A_RESAMPLE_ZOH 6
61#define A_DOWNSAMPLE_HALF 17
81#define A_CONTINUE 0x00
96#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
104 unsigned int flags:8;
105 unsigned int gain:16;
111 unsigned int flags:8;
112 unsigned int gain:16;
118 unsigned int flags:8;
119 unsigned int pad1:16;
126 unsigned int dmem:16;
127 unsigned int pad2:16;
128 unsigned int count:16;
134 unsigned int pad2:16;
141 unsigned int pad1:24;
147 unsigned int flags:8;
148 unsigned int pad1:16;
154 unsigned int flags:8;
155 unsigned int gain:16;
156 unsigned int dmemi:16;
157 unsigned int dmemo:16;
162 unsigned int flags:8;
163 unsigned int dmem2:16;
169 unsigned int flags:8;
170 unsigned int pitch:16;
176 unsigned int flags:8;
177 unsigned int pad1:16;
183 unsigned int pad1:24;
189 unsigned int pad1:24;
191 unsigned int number:4;
192 unsigned int base:24;
197 unsigned int flags:8;
198 unsigned int dmemin:16;
199 unsigned int dmemout:16;
200 unsigned int count:16;
205 unsigned int flags:8;
207 unsigned int voltgt:16;
208 unsigned int volrate:16;
214 unsigned int dmemin:16;
215 unsigned int dmemout:16;
216 unsigned int count:16;
222 unsigned int count:16;
229 unsigned int pad2:16;
244#if IS_BIG_ENDIAN && !IS_64_BIT
247 Aclearbuff clearbuff;
249 Ainterleave interleave;
259 Aloadadpcm loadadpcm;
263 long long int force_union_align;
269typedef short ADPCM_STATE[16];
274typedef short POLEF_STATE[4];
279typedef short RESAMPLE_STATE[16];
284#define UNITY_PITCH 0x8000
285#define MAX_RATIO 1.99996
290typedef short ENVMIX_STATE[40];
348#define aADPCMdec(pkt, f, s) \
350 Acmd *_a = (Acmd *)pkt; \
352 _a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
353 _a->words.w1 = (uintptr_t)(s); \
359#define aPoleFilter(pkt, f, g, s) \
361 Acmd *_a = (Acmd *)pkt; \
363 _a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
364 _SHIFTL(g, 0, 16)); \
365 _a->words.w1 = (uintptr_t)(s); \
373#define aClearBuffer(pkt, d, c) \
375 Acmd *_a = (Acmd *)pkt; \
377 _a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
378 _a->words.w1 = (uintptr_t)(c); \
406#define aEnvMixer(pkt, f, s) \
408 Acmd *_a = (Acmd *)pkt; \
410 _a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
411 _a->words.w1 = (uintptr_t)(s); \
425#define aInterleave(pkt, l, r) \
427 Acmd *_a = (Acmd *)pkt; \
429 _a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
430 _a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
442#define aLoadBuffer(pkt, s) \
444 Acmd *_a = (Acmd *)pkt; \
446 _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
447 _a->words.w1 = (uintptr_t)(s); \
464#define aMix(pkt, f, g, i, o) \
466 Acmd *_a = (Acmd *)pkt; \
468 _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
469 _SHIFTL(g, 0, 16)); \
470 _a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
474#define aPan(pkt, f, d, s) \
476 Acmd *_a = (Acmd *)pkt; \
478 _a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
479 _SHIFTL(d, 0, 16)); \
480 _a->words.w1 = (uintptr_t)(s); \
516#define aResample(pkt, f, p, s) \
518 Acmd *_a = (Acmd *)pkt; \
520 _a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
521 _SHIFTL(p, 0, 16)); \
522 _a->words.w1 = (uintptr_t)(s); \
534#define aSaveBuffer(pkt, s) \
536 Acmd *_a = (Acmd *)pkt; \
538 _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
539 _a->words.w1 = (uintptr_t)(s); \
548#define aSegment(pkt, s, b) \
550 Acmd *_a = (Acmd *)pkt; \
552 _a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
553 _a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
560#define aSetBuffer(pkt, f, i, o, c) \
562 Acmd *_a = (Acmd *)pkt; \
564 _a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
565 _SHIFTL(i, 0, 16)); \
566 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
573#define aSetVolume(pkt, f, v, t, r) \
575 Acmd *_a = (Acmd *)pkt; \
577 _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
578 _SHIFTL(v, 0, 16)); \
579 _a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
588#define aSetLoop(pkt, a) \
590 Acmd *_a = (Acmd *)pkt; \
591 _a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
592 _a->words.w1 = (uintptr_t)(a); \
605#define aDMEMMove(pkt, i, o, c) \
607 Acmd *_a = (Acmd *)pkt; \
609 _a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
610 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
621#define aLoadADPCM(pkt, c, d) \
623 Acmd *_a = (Acmd *)pkt; \
625 _a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
626 _a->words.w1 = (uintptr_t) (d); \
637#define aSetVolume32(pkt, f, v, tr) \
639 Acmd *_a = (Acmd *)pkt; \
641 _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
642 _SHIFTL(v, 0, 16)); \
643 _a->words.w1 = (uintptr_t)(tr); \
646#if defined(VERSION_SH) || defined(VERSION_US) || defined (VERSION_EU)
680#define aS8Dec(pkt, f, s) \
682 Acmd *_a = (Acmd *)pkt; \
684 _a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(f, 16, 8); \
685 _a->words.w1 = (uintptr_t)(s); \
698#define aAddMixer(pkt, s, d, c) \
700 Acmd *_a = (Acmd *)pkt; \
702 _a->words.w0 = (_SHIFTL(A_ADDMIXER, 24, 8) | \
703 _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(0x7fff, 0, 16)); \
704 _a->words.w1 = (_SHIFTL(s, 16, 16) | _SHIFTL(d, 0, 16)); \
714#define aLoadBuffer(pkt, s, d, c) \
716 Acmd *_a = (Acmd *)pkt; \
718 _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8) | \
719 _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(d, 0, 16); \
720 _a->words.w1 = (uintptr_t)(s); \
730#define aSaveBuffer(pkt, s, d, c) \
732 Acmd *_a = (Acmd *)pkt; \
734 _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8) | \
735 _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(s, 0, 16); \
736 _a->words.w1 = (uintptr_t)(d); \
745#define aDuplicate(pkt, s, d, c) \
747 Acmd *_a = (Acmd *)pkt; \
749 _a->words.w0 = (_SHIFTL(A_DUPLICATE, 24, 8) | \
750 _SHIFTL(c, 16, 8) | _SHIFTL(s, 0, 16)); \
751 _a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \
767#define aDMEMMove2(pkt, t, i, o, c) \
769 Acmd *_a = (Acmd *)pkt; \
771 _a->words.w0 = _SHIFTL(A_DMEMMOVE2, 24, 8) | \
772 _SHIFTL(t, 16, 8) | _SHIFTL(i, 0, 16); \
773 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
793#define aResampleZoh(pkt, pitch, startFract) \
795 Acmd *_a = (Acmd *)pkt; \
797 _a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \
798 _SHIFTL(pitch, 0, 16)); \
799 _a->words.w1 = _SHIFTL(startFract, 0, 16); \
808#define aDownsampleHalf(pkt, nSamples, i, o) \
810 Acmd *_a = (Acmd *)pkt; \
812 _a->words.w0 = (_SHIFTL(A_DOWNSAMPLE_HALF, 24, 8) | \
813 _SHIFTL(nSamples, 0, 16)); \
814 _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
828#define aMix(pkt, g, i, o, c) \
830 Acmd *_a = (Acmd *)pkt; \
832 _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | \
833 _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(g, 0, 16)); \
834 _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
840#define aEnvSetup1(pkt, initialVolReverb, rampReverb, rampLeft, rampRight) \
842 Acmd *_a = (Acmd *)pkt; \
844 _a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \
845 _SHIFTL(initialVolReverb, 16, 8) | \
846 _SHIFTL(rampReverb, 0, 16)); \
847 _a->words.w1 = _SHIFTL(rampLeft, 16, 16) | \
848 _SHIFTL(rampRight, 0, 16); \
854#define aEnvSetup2(pkt, initialVolLeft, initialVolRight) \
856 Acmd *_a = (Acmd *)pkt; \
858 _a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
859 _a->words.w1 = _SHIFTL(initialVolLeft, 16, 16) | \
860 _SHIFTL(initialVolRight, 0, 16); \
889#define aEnvMixer(pkt, inBuf, nSamples, swapReverb, negLeft, negRight, \
890 dryLeft, dryRight, wetLeft, wetRight) \
892 Acmd *_a = (Acmd *)pkt; \
894 _a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | \
895 _SHIFTL((inBuf) >> 4, 16, 8) | \
896 _SHIFTL(nSamples, 8, 8)) | \
897 _SHIFTL(swapReverb, 2, 1) | _SHIFTL(negLeft, 1, 1) |\
898 _SHIFTL(negRight, 0, 1); \
899 _a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | \
900 _SHIFTL((dryRight) >> 4, 16, 8) | \
901 _SHIFTL((wetLeft) >> 4, 8, 8) | \
902 _SHIFTL((wetRight) >> 4, 0, 8); \
949#define aFilter(pkt, f, countOrBuf, addr) \
951 Acmd *_a = (Acmd *)pkt; \
953 _a->words.w0 = _SHIFTL(A_FILTER, 24, 8) | _SHIFTL((f), 16, 8) | \
954 _SHIFTL((countOrBuf), 0, 16); \
955 _a->words.w1 = (uintptr_t)(addr); \
967#define aHiLoGain(pkt, g, buflen, i) \
969 Acmd *_a = (Acmd *)pkt; \
971 _a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | \
972 _SHIFTL((g), 16, 8) | _SHIFTL((buflen), 0, 16); \
973 _a->words.w1 = _SHIFTL((i), 16, 16); \
986#define aUnknown25(pkt, f, c, o, i) \
988 Acmd *_a = (Acmd *)pkt; \
990 _a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | \
991 _SHIFTL((f), 16, 8) | _SHIFTL((c), 0, 16)); \
992 _a->words.w1 = _SHIFTL((o), 16, 16) | _SHIFTL((i), 0, 16); \