comparison oxl.h @ 0:0e4f2da58161

Initial import.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 15 Mar 2013 05:00:01 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0e4f2da58161
1 /********************
2
3 OCSALiB, the revolutionary -- version 0.0.1alpha
4
5 (c) viznut/ocsa '98 vheikkil@hytti.uku.fi
6
7 use it the way you like, i don't care :)
8
9 ***************/
10
11 typedef struct {int r,g,b; } rgb;
12
13 extern void oxl_setpalette(rgb *pal);
14 extern void oxl_doframe(char *vscr);
15 extern int oxl_timer(void);
16 extern void oxl_doaudio(int*(player()));
17 extern void oxl_init_video(void);
18 extern void oxl_init_audio(int rowtix);
19 extern void oxl_init_timer(void);
20 extern void oxl_end(void);
21
22 extern int AUFREQ, TIKLGT;
23
24 /*x.
25
26 Just in case you _may_ want to use this in your own proggie (urgh)
27 let's put some documentation here :)
28
29 ** FUNCTIONS **
30
31 void oxl_setpalette(rgb *pal)
32
33 pal is a table containing three ints (r,g,b) for every color.
34 the values vary 0..255.
35
36 void oxl_doframe(char *vscr)
37
38 blits the contents of the offscreen buffer to the screen.
39 the size of the buffer is BUFW * BUFH * 8 bits.
40
41 int oxl_timer(void)
42
43 the current timer value. the number of timer ticks per second is
44 defined by the DEMOHZ constant.
45
46 void oxl_doaudio(int*(player()));
47
48 fills the audio output buffers up to 50%.
49
50 player is a user-specified function returning a pointer to some raw
51 audio data (e.g. the mixer output for the next row of a pattern)
52
53 the first int of the data is the length of the rest (in ints).
54
55 the buffer is int* but the data is 16bit unsigned. values going out
56 of the range 0..65535 will be clipped.
57
58 AUFREQ specifies the output frequency.
59
60 void oxl_init_video(void);
61
62 adjusts the display for the demo.
63 oxl_doframe and oxl_setpalette need this.
64
65 void oxl_init_audio(int rowtix);
66
67 inits the audio stuff, possibly changing the value of AUFREQ.
68 rowtix is the maximum length (in ticks) of an audio chunk produced
69 by int*(player()). (the 'physical length' in samples is therefore
70 rowtix*AUFREQ/DEMOHZ)
71
72 oxl_doaudio needs this. does nothing if nosound.
73
74 void oxl_init_timer(void);
75
76 starts the timer. oxl_timer needs this.
77
78 with sounds on, the timing is actually based on the byte counter of
79 the sound device but put this in your code anyway.
80
81 void oxl_end(void);
82
83 closes the multimedia subsystems. these things should be done
84 automatically when the program terminates, so you really don't need
85 this function.
86
87 ** CONSTANTS REQUIRED **
88
89 AUDIO (0/1)
90 VIDEO (vga/X11)
91 BUFW, BUFH (buffer size)
92 DEMOHZ (timer ticks per second)
93
94 ** THINGS TO DO **
95
96 - A guard process that tries to keep up the audio even if the main
97 loop is frozen. (e.g. if the svgalib screen is not active or if
98 you move the window in X)
99
100 - Make sure the window start address is properly aligned for the
101 maximum performance.
102
103 - Do not calculate the contents of the buffer if the screen/window
104 is not visible.
105
106 - A variable palette size: if the palette fits in the end of the
107 default colormap, we have to be able to use it instead of rudely
108 using a private map.
109
110 - Support for visual depths other than 8bpp.
111
112 - Support for 16-bit multimedia sound systems. Stereo?
113
114 - mSDoS support (for dummies)
115
116 - AAlib support
117
118 - An automatical reselection of X11 gfx mode to best fit the size of
119 the buffer.
120
121 - X fullscreen mode
122
123 - X rootwindow mode
124
125 - Etc etc... but still trying to keep it in a relevant size ;)
126
127 .x*/