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)
103 unsigned int cmd : 8;
104 unsigned int flags : 8;
105 unsigned int gain : 16;
110 unsigned int cmd : 8;
111 unsigned int flags : 8;
112 unsigned int gain : 16;
117 unsigned int cmd : 8;
118 unsigned int flags : 8;
119 unsigned int pad1 : 16;
124 unsigned int cmd : 8;
125 unsigned int pad1 : 8;
126 unsigned int dmem : 16;
127 unsigned int pad2 : 16;
128 unsigned int count : 16;
132 unsigned int cmd : 8;
133 unsigned int pad1 : 8;
134 unsigned int pad2 : 16;
135 unsigned int inL : 16;
136 unsigned int inR : 16;
140 unsigned int cmd : 8;
141 unsigned int pad1 : 24;
146 unsigned int cmd : 8;
147 unsigned int flags : 8;
148 unsigned int pad1 : 16;
153 unsigned int cmd : 8;
154 unsigned int flags : 8;
155 unsigned int gain : 16;
156 unsigned int dmemi : 16;
157 unsigned int dmemo : 16;
161 unsigned int cmd : 8;
162 unsigned int flags : 8;
163 unsigned int dmem2 : 16;
168 unsigned int cmd : 8;
169 unsigned int flags : 8;
170 unsigned int pitch : 16;
175 unsigned int cmd : 8;
176 unsigned int flags : 8;
177 unsigned int pad1 : 16;
182 unsigned int cmd : 8;
183 unsigned int pad1 : 24;
188 unsigned int cmd : 8;
189 unsigned int pad1 : 24;
190 unsigned int pad2 : 2;
191 unsigned int number : 4;
192 unsigned int base : 24;
196 unsigned int cmd : 8;
197 unsigned int flags : 8;
198 unsigned int dmemin : 16;
199 unsigned int dmemout : 16;
200 unsigned int count : 16;
204 unsigned int cmd : 8;
205 unsigned int flags : 8;
206 unsigned int vol : 16;
207 unsigned int voltgt : 16;
208 unsigned int volrate : 16;
212 unsigned int cmd : 8;
213 unsigned int pad1 : 8;
214 unsigned int dmemin : 16;
215 unsigned int dmemout : 16;
216 unsigned int count : 16;
220 unsigned int cmd : 8;
221 unsigned int pad1 : 8;
222 unsigned int count : 16;
227 unsigned int cmd : 8;
228 unsigned int pad1 : 8;
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) | _SHIFTL(g, 0, 16)); \
364 _a->words.w1 = (uintptr_t) (s); \
372#define aClearBuffer(pkt, d, c) \
374 Acmd* _a = (Acmd*) pkt; \
376 _a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
377 _a->words.w1 = (uintptr_t) (c); \
405#define aEnvMixer(pkt, f, s) \
407 Acmd* _a = (Acmd*) pkt; \
409 _a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
410 _a->words.w1 = (uintptr_t) (s); \
424#define aInterleave(pkt, l, r) \
426 Acmd* _a = (Acmd*) pkt; \
428 _a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
429 _a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
441#define aLoadBuffer(pkt, s) \
443 Acmd* _a = (Acmd*) pkt; \
445 _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
446 _a->words.w1 = (uintptr_t) (s); \
463#define aMix(pkt, f, g, i, o) \
465 Acmd* _a = (Acmd*) pkt; \
467 _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | _SHIFTL(g, 0, 16)); \
468 _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
472#define aPan(pkt, f, d, s) \
474 Acmd* _a = (Acmd*) pkt; \
476 _a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | _SHIFTL(d, 0, 16)); \
477 _a->words.w1 = (uintptr_t) (s); \
513#define aResample(pkt, f, p, s) \
515 Acmd* _a = (Acmd*) pkt; \
517 _a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) | _SHIFTL(p, 0, 16)); \
518 _a->words.w1 = (uintptr_t) (s); \
530#define aSaveBuffer(pkt, s) \
532 Acmd* _a = (Acmd*) pkt; \
534 _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
535 _a->words.w1 = (uintptr_t) (s); \
544#define aSegment(pkt, s, b) \
546 Acmd* _a = (Acmd*) pkt; \
548 _a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
549 _a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
556#define aSetBuffer(pkt, f, i, o, c) \
558 Acmd* _a = (Acmd*) pkt; \
560 _a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | _SHIFTL(i, 0, 16)); \
561 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
568#define aSetVolume(pkt, f, v, t, r) \
570 Acmd* _a = (Acmd*) pkt; \
572 _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | _SHIFTL(v, 0, 16)); \
573 _a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
582#define aSetLoop(pkt, a) \
584 Acmd* _a = (Acmd*) pkt; \
585 _a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
586 _a->words.w1 = (uintptr_t) (a); \
599#define aDMEMMove(pkt, i, o, c) \
601 Acmd* _a = (Acmd*) pkt; \
603 _a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
604 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
615#define aLoadADPCM(pkt, c, d) \
617 Acmd* _a = (Acmd*) pkt; \
619 _a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
620 _a->words.w1 = (uintptr_t) (d); \
631#define aSetVolume32(pkt, f, v, tr) \
633 Acmd* _a = (Acmd*) pkt; \
635 _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | _SHIFTL(v, 0, 16)); \
636 _a->words.w1 = (uintptr_t) (tr); \
639#if defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU)
673#define aS8Dec(pkt, f, s) \
675 Acmd* _a = (Acmd*) pkt; \
677 _a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(f, 16, 8); \
678 _a->words.w1 = (uintptr_t) (s); \
691#define aAddMixer(pkt, s, d, c) \
693 Acmd* _a = (Acmd*) pkt; \
695 _a->words.w0 = (_SHIFTL(A_ADDMIXER, 24, 8) | _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(0x7fff, 0, 16)); \
696 _a->words.w1 = (_SHIFTL(s, 16, 16) | _SHIFTL(d, 0, 16)); \
706#define aLoadBuffer(pkt, s, d, c) \
708 Acmd* _a = (Acmd*) pkt; \
710 _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8) | _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(d, 0, 16); \
711 _a->words.w1 = (uintptr_t) (s); \
721#define aSaveBuffer(pkt, s, d, c) \
723 Acmd* _a = (Acmd*) pkt; \
725 _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8) | _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(s, 0, 16); \
726 _a->words.w1 = (uintptr_t) (d); \
735#define aDuplicate(pkt, s, d, c) \
737 Acmd* _a = (Acmd*) pkt; \
739 _a->words.w0 = (_SHIFTL(A_DUPLICATE, 24, 8) | _SHIFTL(c, 16, 8) | _SHIFTL(s, 0, 16)); \
740 _a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \
756#define aDMEMMove2(pkt, t, i, o, c) \
758 Acmd* _a = (Acmd*) pkt; \
760 _a->words.w0 = _SHIFTL(A_DMEMMOVE2, 24, 8) | _SHIFTL(t, 16, 8) | _SHIFTL(i, 0, 16); \
761 _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
781#define aResampleZoh(pkt, pitch, startFract) \
783 Acmd* _a = (Acmd*) pkt; \
785 _a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | _SHIFTL(pitch, 0, 16)); \
786 _a->words.w1 = _SHIFTL(startFract, 0, 16); \
795#define aDownsampleHalf(pkt, nSamples, i, o) \
797 Acmd* _a = (Acmd*) pkt; \
799 _a->words.w0 = (_SHIFTL(A_DOWNSAMPLE_HALF, 24, 8) | _SHIFTL(nSamples, 0, 16)); \
800 _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
814#define aMix(pkt, g, i, o, c) \
816 Acmd* _a = (Acmd*) pkt; \
818 _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(g, 0, 16)); \
819 _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
825#define aEnvSetup1(pkt, initialVolReverb, rampReverb, rampLeft, rampRight) \
827 Acmd* _a = (Acmd*) pkt; \
829 _a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | _SHIFTL(initialVolReverb, 16, 8) | _SHIFTL(rampReverb, 0, 16)); \
830 _a->words.w1 = _SHIFTL(rampLeft, 16, 16) | _SHIFTL(rampRight, 0, 16); \
836#define aEnvSetup2(pkt, initialVolLeft, initialVolRight) \
838 Acmd* _a = (Acmd*) pkt; \
840 _a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
841 _a->words.w1 = _SHIFTL(initialVolLeft, 16, 16) | _SHIFTL(initialVolRight, 0, 16); \
870#define aEnvMixer(pkt, inBuf, nSamples, swapReverb, negLeft, negRight, dryLeft, dryRight, wetLeft, wetRight) \
872 Acmd* _a = (Acmd*) pkt; \
874 _a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL((inBuf) >> 4, 16, 8) | _SHIFTL(nSamples, 8, 8)) | \
875 _SHIFTL(swapReverb, 2, 1) | _SHIFTL(negLeft, 1, 1) | _SHIFTL(negRight, 0, 1); \
876 _a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | _SHIFTL((dryRight) >> 4, 16, 8) | \
877 _SHIFTL((wetLeft) >> 4, 8, 8) | _SHIFTL((wetRight) >> 4, 0, 8); \
924#define aFilter(pkt, f, countOrBuf, addr) \
926 Acmd* _a = (Acmd*) pkt; \
928 _a->words.w0 = _SHIFTL(A_FILTER, 24, 8) | _SHIFTL((f), 16, 8) | _SHIFTL((countOrBuf), 0, 16); \
929 _a->words.w1 = (uintptr_t) (addr); \
941#define aHiLoGain(pkt, g, buflen, i) \
943 Acmd* _a = (Acmd*) pkt; \
945 _a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | _SHIFTL((g), 16, 8) | _SHIFTL((buflen), 0, 16); \
946 _a->words.w1 = _SHIFTL((i), 16, 16); \
959#define aUnknown25(pkt, f, c, o, i) \
961 Acmd* _a = (Acmd*) pkt; \
963 _a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | _SHIFTL((f), 16, 8) | _SHIFTL((c), 0, 16)); \
964 _a->words.w1 = _SHIFTL((o), 16, 16) | _SHIFTL((i), 0, 16); \