comparison tools/ppl.c @ 809:eba3b87f3f84

Add some separate macros for 64/32 precision fixed point types.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 14 May 2014 21:28:14 +0300
parents f066e9dccf29
children daebbf28953d
comparison
equal deleted inserted replaced
808:f8126fa1df9b 809:eba3b87f3f84
259 { 259 {
260 int yh = y1 - y0 - 2; 260 int yh = y1 - y0 - 2;
261 if (yh < 10 || chn == NULL) 261 if (yh < 10 || chn == NULL)
262 return; 262 return;
263 263
264 int xc, ym = y0 + (y1 - y0) / 2, vol = FP_GETH(chn->chVolume); 264 int xc, ym = y0 + (y1 - y0) / 2, vol = FP_GETH32(chn->chVolume);
265 int pitch = screen->pitch / sizeof(Uint32); 265 int pitch = screen->pitch / sizeof(Uint32);
266 int len = FP_GETH(chn->chSize); 266 int len = FP_GETH32(chn->chSize);
267 DMFixedPoint offs = chn->chPos; 267 DMFixedPoint offs = chn->chPos;
268 Uint32 coln = dmCol(0.0, 0.8, 0.0), colx = dmCol(1.0, 0, 0); 268 Uint32 coln = dmCol(0.0, 0.8, 0.0), colx = dmCol(1.0, 0, 0);
269 Uint32 *pix = screen->pixels; 269 Uint32 *pix = screen->pixels;
270 Sint16 *data = chn->chData; 270 Sint16 *data = chn->chData;
271 271
280 280
281 if (chn->chDirection) 281 if (chn->chDirection)
282 { 282 {
283 for (xc = x0 + 1; xc < x1 - 1; xc++) 283 for (xc = x0 + 1; xc < x1 - 1; xc++)
284 { 284 {
285 if (FP_GETH(offs) >= len) 285 if (FP_GETH32(offs) >= len)
286 break; 286 break;
287 Sint16 val = ym + (data[FP_GETH(offs)] * yh * vol) / (65535 * 255); 287 Sint16 val = ym + (data[FP_GETH32(offs)] * yh * vol) / (65535 * 255);
288 pix[xc + val * pitch] = coln; 288 pix[xc + val * pitch] = coln;
289 FP_ADD(offs, chn->chDeltaO); 289 FP_ADD(offs, chn->chDeltaO);
290 } 290 }
291 } 291 }
292 else 292 else
293 { 293 {
294 for (xc = x0 + 1; xc < x1 - 1; xc++) 294 for (xc = x0 + 1; xc < x1 - 1; xc++)
295 { 295 {
296 if (FP_GETH(offs) < 0) 296 if (FP_GETH32(offs) < 0)
297 break; 297 break;
298 Sint16 val = ym + (data[FP_GETH(offs)] * yh * vol) / (65535 * 255); 298 Sint16 val = ym + (data[FP_GETH32(offs)] * yh * vol) / (65535 * 255);
299 pix[xc + val * pitch] = coln; 299 pix[xc + val * pitch] = coln;
300 FP_SUB(offs, chn->chDeltaO); 300 FP_SUB(offs, chn->chDeltaO);
301 } 301 }
302 } 302 }
303 } 303 }