ref: a3edc4c2416e94486f5408436baf26d37d210535
parent: d8def1dec261a9b7990fbf391ddc7b44e8ebd8ec
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Mar 5 05:41:16 EST 2021
moddec: seek fast
--- a/examples/moddec.c
+++ b/examples/moddec.c
@@ -63,7 +63,7 @@
sysfatal("unknown/invalid mod");
if((t = (char*)duh_get_tag(f, "TITLE")) != nil && *t)
fprint(2, "%s\n", t);
- ren = duh_start_sigrenderer(f, 0, 2, 0);
+ ren = duh_start_sigrenderer(f, 0, 2, pos*100000.0*SRATE/65536.0);
itren = duh_get_it_sigrenderer(ren);
dumb_it_set_loop_callback(itren, dumb_it_callback_terminate, nil);
dumb_it_set_xm_speed_zero_callback(itren, dumb_it_callback_terminate, nil);
@@ -73,16 +73,10 @@
n = 0;
for(;;){
- if(pos > 0.0){
- pos -= (double)n / SRATE;
- n = MIN(pos*SRATE, Nsamp);
- if(n < 1)
- pos = 0.0;
- }
n = duh_render_int(ren, &samp, &nsamp, 16, 0, 1.0, 65536.0f/SRATE, MAX(n, Nsamp), b);
if(n <= 0)
break;
- if(pos <= 0.0 && write(1, b, n*2*2) != n*2*2)
+ if(write(1, b, n*2*2) != n*2*2)
break;
}