Annotation of researchv10no/cmd/2500/fn.c, revision 1.1.1.1

1.1       root        1: #include       "hdr.h"
                      2: 
                      3: static Time clock;
                      4: extern debug;
                      5: 
                      6: two(s, a, b)
                      7:        char *s;
                      8: {
                      9:        cmd(0, s, (char *)0, "%c%c", a, b);
                     10: }
                     11: 
                     12: three(s, a, b, c)
                     13:        char *s;
                     14: {
                     15:        cmd(0, s, (char *)0, "%c%c%c", a, b, c);
                     16: }
                     17: 
                     18: four(s, a, b, c, d)
                     19:        char *s;
                     20: {
                     21:        cmd(0, s, (char *)0, "%c%c%c%c", a, b, c, d);
                     22: }
                     23: 
                     24: swait()
                     25: {
                     26:        if(debug)
                     27:                return;
                     28:        while((status1(2)&2) == 0)
                     29:                sleep(1);
                     30: }
                     31: 
                     32: frame(n)
                     33: {
                     34:        three("playback ff/sel", 0x41, 0x38, n);
                     35:        three("rec ff/sel", 0x41, 0x39, n);
                     36: }
                     37: 
                     38: snap(n)
                     39: {
                     40:        upclock(n);
                     41:        printclock();
                     42:        if(debug)
                     43:                return;
                     44:        while(n-- > 0){
                     45:                two("snap", 0x20, 0x65);
                     46:                while(status1(1)&2)
                     47:                        sleep(1);
                     48:                while((status1(0xA)&8) == 0)
                     49:                        sleep(1);
                     50:                two("step fwd", 0x20, 0x14);
                     51:                while((status1(0xA)&0x8) == 0)
                     52:                        sleep(1);
                     53:        }
                     54: }
                     55: 
                     56: cue(t)
                     57:        Time t;
                     58: {
                     59:        cmd(0, "cue", (char *)0, "%c%c%t%c", 0x25, 0x31, t, 0x01);
                     60:        clock = t;
                     61:        printclock();
                     62: }
                     63: 
                     64: prerollt(t)
                     65:        Time t;
                     66: {
                     67:        cmd(0, "preroll", (char *)0, "%c%c%t%c", 0x44, 0x31, t, 0x01);
                     68: }
                     69: 
                     70: loop(t0, t1, fps)
                     71:        Time t0, t1;
                     72: {
                     73:        int n, n1;
                     74:         double speed, p, p1;
                     75:         extern double log10(), pow();
                     76: 
                     77:         if(fps > 1500) fps = 1500;
                     78:         speed = fps/30.0;
                     79:         n = 32*(2+log10(speed));
                     80:        p = pow(10.,n/32.-2);
                     81:        p1 = pow(10.,(n+1)/32.-2);
                     82:        n1 = 256 * (speed - p) / ( p1 - p );
                     83:        if(n1<0)
                     84:                Fprint(2,"can't happen! loop: fps=%d n=%d n1=%d\n",fps,n,n1);
                     85:        cue(t0);
                     86:        sleep(1);
                     87:        {
                     88:                swait();
                     89:                four("var fwd", 0x21, 0x12, n, n1);
                     90:                while(timecmp(gettime(), t1) < 0)
                     91:                        sleep(1);
                     92:                two("stop", 0x20, 0x00);
                     93:                four("var rev", 0x22, 0x22, n, n1);
                     94:                while(timecmp(t0, gettime()) < 0)
                     95:                        sleep(1);
                     96:                two("stop", 0x20, 0x00);
                     97:        }
                     98: }
                     99: 
                    100: view(t0, t1)
                    101:        Time t0, t1;
                    102: {
                    103:        int fps=64.;
                    104: 
                    105:        cue(t0);
                    106:        sleep(1);
                    107:        {
                    108:                swait();
                    109:                three("var fwd", 0x21, 0x12, fps);
                    110:                while(timecmp(gettime(), t1) < 0)
                    111:                        sleep(1);
                    112:                two("stop", 0x20, 0x00);
                    113:        }
                    114:        cue(t0);
                    115:        sleep(1);
                    116: }
                    117: 
                    118: locenable()
                    119: {
                    120:        if(two("local enable", 0x00, 0x1D) == 0)
                    121:                print("local enabled\n");
                    122: }
                    123: 
                    124: insert(t, n)
                    125:        Time t;
                    126: {
                    127:        two("", 0x40, 0x41);            /* AUTO ON */
                    128:        three("", 0x41, 0x30, 0x58);    /* INS, SYNC/VIDEO */
                    129:        three("", 0x41, 0x36, 0);               /* timer mode to TCR */
                    130:        cmd(0, "", (char *)0, "%c%c%t", 0x44, 0x14, t);
                    131:        taddfr(&t, n);
                    132:        cmd(0, "", (char *)0, "%c%c%t", 0x44, 0x15, t);
                    133:        two("", 0x20, 0x30);            /* PREROLL */
                    134:        while((status1(1)&0x20) == 0)
                    135:                ;                       /* loop until stopped */
                    136:        two("", 0x20, 0x42);            /* AUTO EDIT */
                    137:        while((status1(1)&0x20) == 0)
                    138:                ;                       /* loop until stopped */
                    139:        three("", 0x41, 0x30, 0x00);    /* INS, SYNC/VIDEO off */
                    140:        two("", 0x40, 0x40);            /* AUTO OFF */
                    141: }
                    142: 
                    143: editset(t0, t1, chmask)
                    144:        Time t0, t1;
                    145: {
                    146:        two("", 0x40, 0x41);            /* AUTO ON */
                    147:        three("", 0x41, 0x30, 0x40|chmask);     /* INS chmask */
                    148:        three("", 0x41, 0x36, 0);               /* timer mode to TCR */
                    149:        cmd(0, "", (char *)0, "%c%c%t", 0x44, 0x14, t0);
                    150:        cmd(0, "", (char *)0, "%c%c%t", 0x44, 0x15, t1);
                    151:        two("", 0x20, 0x30);            /* PREROLL */
                    152:        while((status1(1)&0x20) == 0)
                    153:                ;                       /* loop until stopped */
                    154: }
                    155: 
                    156: editgo()
                    157: {
                    158:        two("", 0x20, 0x42);            /* AUTO EDIT */
                    159:        while((status1(1)&0x20) == 0)
                    160:                ;                       /* loop until stopped */
                    161:        three("", 0x41, 0x30, 0x00);    /* INS off */
                    162:        two("", 0x40, 0x40);            /* AUTO OFF */
                    163: }
                    164: 
                    165: still(t)
                    166:        Time t;
                    167: {
                    168:        three("still mode", 0x41, 0x3F, 0x01);  /* STILL */
                    169:        cue(t);
                    170:        swait();
                    171: }
                    172: 
                    173: upclock(n)
                    174:        int n;
                    175: {
                    176:        /* this won't work if n is big, since Time uses shorts */
                    177:        clock.f += n;
                    178:        while( clock.f >= 30 ){
                    179:                clock.f -= 30;
                    180:                clock.s += 1;
                    181:        }
                    182:        while( clock.s >= 60 ){
                    183:                clock.s -= 60;
                    184:                clock.m += 1;
                    185:        }
                    186:        while( clock.m >= 60 ){
                    187:                clock.m -= 60;
                    188:                clock.h += 1;
                    189:        }
                    190: }
                    191: 
                    192: printclock()
                    193: {
                    194:        Fprint(logfd,"# time ");
                    195:        if( clock.h != 0 )
                    196:                Fprint(logfd,"%d.",clock.h);
                    197:        Fprint(logfd,"%d.%d.%d\n",clock.m,clock.s,clock.f);
                    198: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.