Mercurial > sdl-ios-xcode
annotate src/audio/SDL_sysaudio.h @ 641:df178851293b
Date: 28 Jun 2003 22:42:52 +0100
From: Alan Swanson
Subject: Re: [SDL] New XFree 4.3 Video Mode Patch
I have a wee amendment that moves the qsort in set_best_resolution
to only occur after failing to find an exact match only. This would
make absolutely sure we get a user set mode.
While I've never had any problems for my normal resolutions (1280x1024,
1024x768, 800x600 & 640,480) while closely examining the output from
qsort I've noticed it doesn't seem to sort the modes fully. These is
one definite wrong at 1152x768 and a few that just look wrong to me.
From a program (attached) I made to examine this more easily. X has
sorted its mode list using the same method as ours (plus frequency),
and our user modes get inserted without any other movement.
On the patch I've made I've also changed cmpmodes to sort on vertical
resolution and then horizontal. Ie vertical is now most significant
bit.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 28 Jun 2003 21:52:26 +0000 |
parents | 550bccdf04bd |
children | 594422ab8f9f |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
148
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_sysaudio_h | |
29 #define _SDL_sysaudio_h | |
30 | |
31 #include "SDL_mutex.h" | |
32 #include "SDL_thread.h" | |
33 | |
34 /* The SDL audio driver */ | |
35 typedef struct SDL_AudioDevice SDL_AudioDevice; | |
36 | |
37 /* Define the SDL audio driver structure */ | |
38 #define _THIS SDL_AudioDevice *_this | |
39 #ifndef _STATUS | |
40 #define _STATUS SDL_status *status | |
41 #endif | |
42 struct SDL_AudioDevice { | |
43 /* * * */ | |
44 /* The name of this audio driver */ | |
45 const char *name; | |
46 | |
47 /* * * */ | |
48 /* The description of this audio driver */ | |
49 const char *desc; | |
50 | |
51 /* * * */ | |
52 /* Public driver functions */ | |
53 int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); | |
54 void (*ThreadInit)(_THIS); /* Called by audio thread at start */ | |
55 void (*WaitAudio)(_THIS); | |
56 void (*PlayAudio)(_THIS); | |
57 Uint8 *(*GetAudioBuf)(_THIS); | |
58 void (*WaitDone)(_THIS); | |
59 void (*CloseAudio)(_THIS); | |
60 | |
61 /* * * */ | |
322
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
62 /* Lock / Unlock functions added for the Mac port */ |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
63 void (*LockAudio)(_THIS); |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
64 void (*UnlockAudio)(_THIS); |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
65 |
fd93a09655e3
The audio lock and unlock functions are now a part of the driver.
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
66 /* * * */ |
0 | 67 /* Data common to all devices */ |
68 | |
69 /* The current audio specification (shared with audio thread) */ | |
70 SDL_AudioSpec spec; | |
71 | |
72 /* An audio conversion block for audio format emulation */ | |
73 SDL_AudioCVT convert; | |
74 | |
75 /* Current state flags */ | |
76 int enabled; | |
77 int paused; | |
78 int opened; | |
79 | |
80 /* Fake audio buffer for when the audio hardware is busy */ | |
81 Uint8 *fake_stream; | |
82 | |
83 /* A semaphore for locking the mixing buffers */ | |
84 SDL_mutex *mixer_lock; | |
85 | |
86 /* A thread to feed the audio device */ | |
87 SDL_Thread *thread; | |
88 Uint32 threadid; | |
89 | |
90 /* * * */ | |
91 /* Data private to this driver */ | |
92 struct SDL_PrivateAudioData *hidden; | |
93 | |
94 /* * * */ | |
95 /* The function used to dispose of this structure */ | |
96 void (*free)(_THIS); | |
97 }; | |
98 #undef _THIS | |
99 | |
100 typedef struct AudioBootStrap { | |
101 const char *name; | |
102 const char *desc; | |
103 int (*available)(void); | |
104 SDL_AudioDevice *(*create)(int devindex); | |
105 } AudioBootStrap; | |
106 | |
121
43febd46d49d
Name changed from OBSD to OPENBSD_AUDIO
Sam Lantinga <slouken@libsdl.org>
parents:
94
diff
changeset
|
107 #ifdef OPENBSD_AUDIO_SUPPORT |
43febd46d49d
Name changed from OBSD to OPENBSD_AUDIO
Sam Lantinga <slouken@libsdl.org>
parents:
94
diff
changeset
|
108 extern AudioBootStrap OPENBSD_AUDIO_bootstrap; |
94
ae6e6b73333f
Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents:
68
diff
changeset
|
109 #endif |
0 | 110 #ifdef OSS_SUPPORT |
111 extern AudioBootStrap DSP_bootstrap; | |
112 extern AudioBootStrap DMA_bootstrap; | |
113 #endif | |
114 #ifdef ALSA_SUPPORT | |
115 extern AudioBootStrap ALSA_bootstrap; | |
116 #endif | |
148
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
117 #ifdef SUNAUDIO_SUPPORT |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
118 extern AudioBootStrap SUNAUDIO_bootstrap; |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
119 #endif |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
120 #ifdef DMEDIA_SUPPORT |
8758b8d42cd9
Audio subsystem no longer assumes sun audio API on UNIX systems
Sam Lantinga <slouken@libsdl.org>
parents:
121
diff
changeset
|
121 extern AudioBootStrap DMEDIA_bootstrap; |
35
d3bc792e136d
Added detection of Open Sound System on Solaris x86
Sam Lantinga <slouken@lokigames.com>
parents:
21
diff
changeset
|
122 #endif |
0 | 123 #ifdef ARTSC_SUPPORT |
124 extern AudioBootStrap ARTSC_bootstrap; | |
125 #endif | |
126 #ifdef ESD_SUPPORT | |
127 extern AudioBootStrap ESD_bootstrap; | |
128 #endif | |
129 #ifdef NAS_SUPPORT | |
130 extern AudioBootStrap NAS_bootstrap; | |
131 #endif | |
132 #ifdef ENABLE_DIRECTX | |
133 extern AudioBootStrap DSOUND_bootstrap; | |
134 #endif | |
135 #ifdef ENABLE_WINDIB | |
136 extern AudioBootStrap WAVEOUT_bootstrap; | |
137 #endif | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
138 #ifdef _AIX |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
139 extern AudioBootStrap Paud_bootstrap; |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
140 #endif |
0 | 141 #ifdef __BEOS__ |
142 extern AudioBootStrap BAUDIO_bootstrap; | |
143 #endif | |
144 #if defined(macintosh) || TARGET_API_MAC_CARBON | |
145 extern AudioBootStrap SNDMGR_bootstrap; | |
146 #endif | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
147 #ifdef ENABLE_AHI |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
148 extern AudioBootStrap AHI_bootstrap; |
0 | 149 #endif |
398
d219b0e02f5f
Added Atari audio support (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
322
diff
changeset
|
150 #ifdef MINTAUDIO_SUPPORT |
d219b0e02f5f
Added Atari audio support (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
322
diff
changeset
|
151 extern AudioBootStrap MINTAUDIO_bootstrap; |
d219b0e02f5f
Added Atari audio support (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
322
diff
changeset
|
152 #endif |
68
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
153 #ifdef DISKAUD_SUPPORT |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
154 extern AudioBootStrap DISKAUD_bootstrap; |
ac6645260d31
Added an audio driver that writes to disk (thanks Ryan!)
Sam Lantinga <slouken@lokigames.com>
parents:
37
diff
changeset
|
155 #endif |
509
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
156 #ifdef ENABLE_DC |
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
157 extern AudioBootStrap DCAUD_bootstrap; |
dad72daf44b3
Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
398
diff
changeset
|
158 #endif |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
159 #ifdef DRENDERER_SUPPORT |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
160 extern AudioBootStrap DRENDERER_bootstrap; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
509
diff
changeset
|
161 #endif |
0 | 162 |
163 /* This is the current audio device */ | |
164 extern SDL_AudioDevice *current_audio; | |
165 | |
166 #endif /* _SDL_sysaudio_h */ |