Mercurial > sdl-ios-xcode
annotate docs/man3/SDL_AudioCVT.3 @ 3100:7dc982143c06
Date: Sun, 22 Mar 2009 12:52:29 +0000
From: Luke Benstead
Subject: OpenGL 3.0 Context Creation
I've attached a patch which implements OpenGL 3.x context creation on
the latest SVN. I've added two options to SDL_GL_SetAttribute, these
are SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.
These default to 2 and 1 respectively. If the major version is less
than 3 then the current context creation method is used, otherwise the
appropriate new context creation function is called (depending on the
platform).
Sample code:
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //Without these 2 lines, SDL will create a GL 2.x context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL | SDL_FULLSCREEN );
I've implemented context creation on both Win32 and X and run basic
tests on both. This patch doesn't provide access to all the options
allowed by the new context creation (e.g. shared contexts, forward
compatible contexts) but they can be added pretty easily.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Mar 2009 10:43:53 +0000 |
parents | 546f7c1eb755 |
children | 1238da4a7112 |
rev | line source |
---|---|
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
1 .TH "SDL_AudioCVT" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" |
0 | 2 .SH "NAME" |
2283
546f7c1eb755
Merged revision 3472 from SDL 1.2, fixing bug #493
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
3 SDL_AudioCVT \- Audio Conversion Structure |
0 | 4 .SH "STRUCTURE DEFINITION" |
5 .PP | |
6 .nf | |
7 \f(CWtypedef struct{ | |
8 int needed; | |
9 Uint16 src_format; | |
10 Uint16 dest_format; | |
11 double rate_incr; | |
12 Uint8 *buf; | |
13 int len; | |
14 int len_cvt; | |
15 int len_mult; | |
16 double len_ratio; | |
17 void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); | |
18 int filter_index; | |
19 } SDL_AudioCVT;\fR | |
20 .fi | |
21 .PP | |
22 .SH "STRUCTURE DATA" | |
23 .TP 20 | |
24 \fBneeded\fR | |
25 Set to one if the conversion is possible | |
26 .TP 20 | |
27 \fBsrc_format\fR | |
28 Audio format of the source | |
29 .TP 20 | |
30 \fBdest_format\fR | |
31 Audio format of the destination | |
32 .TP 20 | |
33 \fBrate_incr\fR | |
34 Rate conversion increment | |
35 .TP 20 | |
36 \fBbuf\fR | |
37 Audio buffer | |
38 .TP 20 | |
39 \fBlen\fR | |
40 Length of the original audio buffer in bytes | |
41 .TP 20 | |
42 \fBlen_cvt\fR | |
43 Length of converted audio buffer in bytes (calculated) | |
44 .TP 20 | |
45 \fBlen_mult\fR | |
46 \fBbuf\fR must be \fBlen\fR*\fBlen_mult\fR bytes in size(calculated) | |
47 .TP 20 | |
48 \fBlen_ratio\fR | |
49 Final audio size is \fBlen\fR*\fBlen_ratio\fR | |
50 .TP 20 | |
51 \fBfilters[10](\&.\&.)\fR | |
52 Pointers to functions needed for this conversion | |
53 .TP 20 | |
54 \fBfilter_index\fR | |
55 Current conversion function | |
56 .SH "DESCRIPTION" | |
57 .PP | |
58 The \fBSDL_AudioCVT\fR is used to convert audio data between different formats\&. A \fBSDL_AudioCVT\fR structure is created with the \fI\fBSDL_BuildAudioCVT\fP\fR function, while the actual conversion is done by the \fI\fBSDL_ConvertAudio\fP\fR function\&. | |
59 .PP | |
60 Many of the fields in the \fBSDL_AudioCVT\fR structure should be considered private and their function will not be discussed here\&. | |
61 .IP "\fBUint8 *\fP\fBbuf\fR" 10This points to the audio data that will be used in the conversion\&. It is both the source and the destination, which means the converted audio data overwrites the original data\&. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure \fBbuf\fR is large enough\&. See below\&. | |
62 .IP "\fBint\fP \fBlen\fR" 10This is the length of the original audio data in bytes\&. | |
63 .IP "\fBint\fP \fBlen_mult\fR" 10As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data\&. The length of \fBbuf\fR should be \fBlen\fR*\fBlen_mult\fR\&. | |
64 .IP "\fBdouble\fP \fBlen_ratio\fR" 10When you have finished converting your audio data, you need to know how much of your audio buffer is valid\&. \fBlen\fR*\fBlen_ratio\fR is the size of the converted audio data in bytes\&. This is very similar to \fBlen_mult\fR, however when the convert audio data is shorter than the original \fBlen_mult\fR would be 1\&. \fBlen_ratio\fR, on the other hand, would be a fractional number between 0 and 1\&. | |
65 .SH "SEE ALSO" | |
66 .PP | |
67 \fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioSpec\fR\fR | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
68 ...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58 |