]> icculus.org git repositories - btb/d2x.git/blob - main/old/rbtest.c
Import of d2x-0.0.8
[btb/d2x.git] / main / old / rbtest.c
1 #include <stdio.h>
2
3 #include "dpmi.h"
4 #include "timer.h"
5 #include "key.h"
6 #include "error.h"
7 #include "rbaudio.h"
8
9
10 int main()
11 {
12         fix fsecs;
13         int oldmin=-1, oldsec=-1;
14
15         error_init(NULL, NULL);
16         dpmi_init(0);
17         timer_init();
18         key_init();
19         RBAInit();
20         RBARegisterCD();
21         RBAPlayTrack(2);
22
23         fsecs = timer_get_fixed_seconds();
24         do
25         {
26                 int min, sec, frame;
27                 long headloc;
28
29                 if ((timer_get_fixed_seconds() - fsecs) >= F2_0) {
30                         headloc = RBAGetHeadLoc(&min, &sec, &frame);
31                         printf("Head loc: %d (%d:%d:%d)\n", headloc, min, sec, frame);
32                         if (min==oldmin && sec==oldsec) {
33                                 printf("\nRepeating track..\n");
34                                 RBAPlayTrack(2);
35                         }
36                         oldmin = min; oldsec = sec;
37                         fsecs = timer_get_fixed_seconds();
38                 }
39                 if (key_inkey()) {
40                         RBAStop();
41                         printf("\nCD stopped.\n");
42                         break;
43                 }
44         }
45         while (1); 
46
47         key_close();
48         timer_close();
49
50         return 0;
51 }
52 ΓΏ