10 32767, 32764, 32757, 32744, 32727, 32704, 32677, 32644,
11 32607, 32564, 32517, 32464, 32407, 32344, 32277, 32205,
12 32127, 32045, 31958, 31866, 31770, 31668, 31561, 31450,
13 31334, 31213, 31087, 30957, 30822, 30682, 30537, 30388,
14 30234, 30075, 29912, 29744, 29572, 29395, 29214, 29028,
15 28838, 28643, 28444, 28241, 28033, 27821, 27605, 27385,
16 27160, 26931, 26698, 26461, 26220, 25975, 25726, 25473,
17 25216, 24956, 24691, 24423, 24151, 23875, 23596, 23313,
18 23026, 22736, 22442, 22145, 21845, 21541, 21234, 20924,
19 20610, 20294, 19974, 19651, 19325, 18997, 18665, 18331,
20 17993, 17653, 17310, 16965, 16617, 16266, 15913, 15558,
21 15200, 14840, 14477, 14113, 13746, 13377, 13006, 12633,
22 12258, 11881, 11503, 11122, 10740, 10357, 9971, 9584,
23 9196, 8806, 8415, 8023, 7630, 7235, 6839, 6442,
24 6044, 5646, 5246, 4845, 4444, 4042, 3640, 3237,
25 2833, 2429, 2025, 1620, 1216, 810, 405, 0
33 Acmd* ptr = cmdBufPos;
48 if (envMixer->
motion != AL_PLAYING) {
52 if (resampler->
ratio > MAX_RATIO) {
53 resampler->
ratio = MAX_RATIO;
56 resampler->
ratio = (s32)(resampler->
ratio * UNITY_PITCH);
57 resampler->
ratio = resampler->
ratio / UNITY_PITCH;
58 finCount = resampler->
delta + resampler->
ratio * (f32)184;
59 outCount = (s32) finCount;
60 resampler->
delta = finCount - (f32) outCount;
78 looped = (decoder->
loop.end < outCount + decoder->
sample) && (decoder->
loop.count != 0);
86 nLeft = ADPCMFSIZE - decoder->
lastsam;
94 nframes = (tsam + ADPCMFSIZE - 1) >>
LFSAMPLES;
97 ptr = _decodeChunk(ptr, decoder, tsam, nbytes, outp, inp, decoder->
first);
99 outp += (decoder->
lastsam << 1);
101 outp += (ADPCMFSIZE << 1);
108 while (outCount > nSam) {
110 op = (bEnd + ((nframes + 1) << (
LFSAMPLES + 1)) + 16) & ~0x1f;
112 if (decoder->
loop.count != -1 && decoder->
loop.count != 0) {
113 decoder->
loop.count--;
115 nSam = MIN(outCount, decoder->
loop.end - decoder->
loop.start);
116 tsam = nSam - ADPCMFSIZE + decoder->
lastsam;
120 nframes = (tsam + ADPCMFSIZE - 1) >>
LFSAMPLES;
122 ptr = _decodeChunk(ptr, decoder, tsam, nbytes, op, inp, decoder->
first | A_LOOP);
123 aDMEMMove(ptr++, op + (decoder->
lastsam << 1), bEnd, nSam << 1);
126 decoder->
sample += outCount;
135 envMixer->
motion = AL_STOPPED;
138 if (nOver > nSam + nLeft) {
139 nOver = nSam + nLeft;
142 if (nOver - (nOver & 0xF) < outCount) {
144 ptr = _decodeChunk(ptr, decoder, nSam - nOver, nbytes, outp, inp, decoder->
first);
148 outp += ADPCMFSIZE << 1;
151 decoder->
sample += outCount;
161 startZero = (nLeft + nSam - nOver) << 1;
165 aClearBuffer(ptr++, startZero + outp, nOver << 1);
176 if (decoder->
loop.end < outCount + decoder->
sample && decoder->
loop.count != 0) {
181 dramAlign = dramLoc & 7;
183 n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 7), outp, dramLoc - dramAlign);
191 while (outCount > nSam){
194 if (decoder->
loop.count != -1 && decoder->
loop.count != 0) {
195 decoder->
loop.count--;
197 nSam = MIN(outCount, decoder->
loop.end - decoder->
loop.start);
200 dramAlign = dramLoc & 7;
203 dmemAlign = 8 - (op & 7);
207 n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 7), op + dmemAlign, dramLoc - dramAlign);
209 if (dramAlign != 0 || dmemAlign != 0) {
210 aDMEMMove(ptr++, op + dramAlign + dmemAlign, op, nSam * 2);
213 decoder->
sample += outCount;
214 decoder->
memin += outCount << 1;
216 nbytes = outCount << 1;
221 envMixer->
motion = AL_STOPPED;
223 if (nbytes < overFlow) {
226 if (overFlow < nbytes) {
230 dramAlign = dramLoc & 7;
232 n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 7), outp, dramLoc - dramAlign);
237 decoder->
sample += outCount;
238 decoder->
memin += outCount << 1;
240 decoder->
memin += outCount << 1;
244 startZero = (outCount << 1) - overFlow;
248 aClearBuffer(ptr++, startZero + outp, overFlow);
253 incr = (s32)(resampler->
ratio * UNITY_PITCH);
254 n_aResample(ptr++, osVirtualToPhysical(resampler->
state), resampler->
first, incr, outp, 0);
255 resampler->
first = 0;
257 if (envMixer->
first != 0) {
268 n_aSetVolume(ptr++, A_RATE, envMixer->
ltgt, envMixer->
lratm, envMixer->
lratl);
269 n_aSetVolume(ptr++, A_LEFT | A_VOL, envMixer->
cvolL, envMixer->
dryamt, envMixer->
wetamt);
270 n_aSetVolume(ptr++, A_RIGHT | A_VOL, envMixer->
rtgt, envMixer->
rratm, envMixer->
rratl);
271 n_aEnvMixer(ptr++, A_INIT, envMixer->
cvolR, osVirtualToPhysical(envMixer->
state));
273 n_aEnvMixer(ptr++, A_CONTINUE, 0, osVirtualToPhysical(envMixer->
state));
280 if (envMixer->
motion == AL_STOPPED) {
283 resampler->
delta = 0.0f;
284 resampler->
first = 1;