annotate SDL_sound_internal.h @ 453:b9856ba6fb4e

Updated comments on supported files to include Speex.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 13 Sep 2003 20:35:24 +0000
parents 5b00e43ec23c
children 3e705c9180e5 50bb9a6cebfe
rev   line source
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 * SDL_sound -- An abstract sound format decoding API.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 * Copyright (C) 2001 Ryan C. Gordon.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 * version 2.1 of the License, or (at your option) any later version.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 * Lesser General Public License for more details.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18 */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 * Internal function/structure declaration. Do NOT include in your
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22 * application.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 *
184
47cc2de2ae36 Changed reference to "LICENSE" file to "COPYING".
Ryan C. Gordon <icculus@icculus.org>
parents: 143
diff changeset
24 * Please see the file COPYING in the source's root directory.
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29 #ifndef _INCLUDE_SDL_SOUND_INTERNAL_H_
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 #define _INCLUDE_SDL_SOUND_INTERNAL_H_
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 #ifndef __SDL_SOUND_INTERNAL__
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 #error Do not include this header from your applications.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34 #endif
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36 #include "SDL.h"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37
401
c42ac9ee2ce4 Fixed "inline" keyword to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 387
diff changeset
38 /* SDL 1.2.4 defines this, but better safe than sorry. */
c42ac9ee2ce4 Fixed "inline" keyword to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 387
diff changeset
39 #if (!defined(__inline__))
c42ac9ee2ce4 Fixed "inline" keyword to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 387
diff changeset
40 # define __inline__
301
ca43129df299 Visual C fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 223
diff changeset
41 #endif
ca43129df299 Visual C fixes.
Ryan C. Gordon <icculus@icculus.org>
parents: 223
diff changeset
42
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
43 #if (defined DEBUG_CHATTER)
62
b13fafb976be Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents: 42
diff changeset
44 #define SNDDBG(x) printf x
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
45 #else
62
b13fafb976be Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents: 42
diff changeset
46 #define SNDDBG(x)
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
47 #endif
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
48
377
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
49 #if HAVE_ASSERT_H
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
50 # include <assert.h>
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
51 #endif
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
52
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
53 #ifdef _WIN32_WCE
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
54 extern char *strrchr(const char *s, int c);
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
55 # ifdef NDEBUG
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
56 # define assert(x)
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
57 # else
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
58 # define assert(x) if(!x) { fprintf(stderr,"Assertion failed in %s, line %s.\n",__FILE__,__LINE__); fclose(stderr); fclose(stdout); exit(1); }
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
59 # endif
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
60 #endif
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
61
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
62
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
63 #if (!defined assert) /* if all else fails. */
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
64 # define assert(x)
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
65 #endif
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
66
cbb15ecf423a WinCE (PocketPC) patches from Tyler.
Ryan C. Gordon <icculus@icculus.org>
parents: 340
diff changeset
67
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
68 typedef struct __SOUND_DECODERFUNCTIONS__
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69 {
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70 /* This is a block of info about your decoder. See SDL_sound.h. */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71 const Sound_DecoderInfo info;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
73 /*
42
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
74 * This is called during the Sound_Init() function. Use this to
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
75 * set up any global state that your decoder needs, such as
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
76 * initializing an external library, etc.
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
77 *
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
78 * Return non-zero if initialization is successful, zero if there's
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
79 * a fatal error. If this method fails, then this decoder is
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
80 * flagged as unavailable until SDL_sound() is shut down and
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
81 * reinitialized, in which case this method will be tried again.
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
82 *
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
83 * Note that the decoders quit() method won't be called if this
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
84 * method fails, so if you can't intialize, you'll have to clean
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
85 * up the half-initialized state in this method.
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
86 */
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
87 int (*init)(void);
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
88
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
89 /*
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
90 * This is called during the Sound_Quit() function. Use this to
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
91 * clean up any global state that your decoder has used during its
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
92 * lifespan.
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
93 */
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
94 void (*quit)(void);
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
95
2b63642fb6ff Removed MULTIPLE_STREAMS_PER_RWOPS and added init() and quit() methods to
Ryan C. Gordon <icculus@icculus.org>
parents: 39
diff changeset
96 /*
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 * Returns non-zero if (sample) has a valid fileformat that this
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98 * driver can handle. Zero if this driver can NOT handle the data.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
99 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
100 * Extension, which may be NULL, is just a hint as to the form of
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 * data that is being passed in. Most decoders should determine if
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
102 * they can handle the data by the data itself, but others, like
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
103 * the raw data handler, need this hint to know if they should
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 * accept the data in the first place.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
106 * (sample)'s (opaque) field should be cast to a Sound_SampleInternal
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
107 * pointer:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
109 * Sound_SampleInternal *internal;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
110 * internal = (Sound_SampleInternal *) sample->opaque;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
111 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
112 * Certain fields of sample will be filled in for the decoder before
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
113 * this call, and others should be filled in by the decoder. Some
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
114 * fields are offlimits, and should NOT be modified. The list:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
115 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
116 * in Sound_SampleInternal section:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
117 * Sound_Sample *next; (offlimits)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
118 * Sound_Sample *prev; (offlimits)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
119 * SDL_RWops *rw; (can use, but do NOT close it)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
120 * const Sound_DecoderFunctions *funcs; (that's this structure)
143
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
121 * Sound_AudioCVT sdlcvt; (offlimits)
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
122 * void *buffer; (offlimits until read() method)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
123 * Uint32 buffer_size; (offlimits until read() method)
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
124 * void *decoder_private; (read and write access)
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
125 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
126 * in rest of Sound_Sample:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
127 * void *opaque; (this was internal section, above)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
128 * const Sound_DecoderInfo *decoder; (read only)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
129 * Sound_AudioInfo desired; (read only, usually not needed here)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
130 * Sound_AudioInfo actual; (please fill this in)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
131 * void *buffer; (offlimits)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
132 * Uint32 buffer_size; (offlimits)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
133 * Sound_SampleFlags flags; (set appropriately)
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
134 */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
135 int (*open)(Sound_Sample *sample, const char *ext);
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
136
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
137 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
138 * Clean up. SDL_sound is done with this sample, so the decoder should
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
139 * clean up any resources it allocated. Anything that wasn't
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
140 * explicitly allocated by the decoder should be LEFT ALONE, since
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
141 * the higher-level SDL_sound layer will clean up its own mess.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
142 */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
143 void (*close)(Sound_Sample *sample);
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 * Get more data from (sample). The decoder should get a pointer to
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
147 * the internal structure...
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
148 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
149 * Sound_SampleInternal *internal;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
150 * internal = (Sound_SampleInternal *) sample->opaque;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
151 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
152 * ...and then start decoding. Fill in up to internal->buffer_size
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
153 * bytes of decoded sound in the space pointed to by
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
154 * internal->buffer. The encoded data is read in from internal->rw.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
155 * Data should be decoded in the format specified during the
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
156 * decoder's open() method in the sample->actual field. The
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
157 * conversion to the desired format is done at a higher level.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
158 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
159 * The return value is the number of bytes decoded into
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
160 * internal->buffer, which can be no more than internal->buffer_size,
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
161 * but can be less. If it is less, you should set a state flag:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
162 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
163 * If there's just no more data (end of file, etc), then do:
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
164 * sample->flags |= SOUND_SAMPLEFLAG_EOF;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
165 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
166 * If there's an unrecoverable error, then do:
387
fb519e6028e3 Changed all the Sound_SetError() calls to __Sound_SetError (or BAIL*_MACRO)
Ryan C. Gordon <icculus@icculus.org>
parents: 377
diff changeset
167 * __Sound_SetError(ERR_EXPLAIN_WHAT_WENT_WRONG);
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
168 * sample->flags |= SOUND_SAMPLEFLAG_ERROR;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
169 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
170 * If there's more data, but you'd have to block for considerable
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
171 * amounts of time to get at it, or there's a recoverable error,
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
172 * then do:
387
fb519e6028e3 Changed all the Sound_SetError() calls to __Sound_SetError (or BAIL*_MACRO)
Ryan C. Gordon <icculus@icculus.org>
parents: 377
diff changeset
173 * __Sound_SetError(ERR_EXPLAIN_WHAT_WENT_WRONG);
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
174 * sample->flags |= SOUND_SAMPLEFLAG_EAGAIN;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
175 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
176 * SDL_sound will not call your read() method for any samples with
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
177 * SOUND_SAMPLEFLAG_EOF or SOUND_SAMPLEFLAG_ERROR set. The
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
178 * SOUND_SAMPLEFLAG_EAGAIN flag is reset before each call to this
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
179 * method.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
180 */
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
181 Uint32 (*read)(Sound_Sample *sample);
223
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
182
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
183 /*
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
184 * Reset the decoding to the beginning of the stream. Nonzero on
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
185 * success, zero on failure.
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
186 *
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
187 * The purpose of this method is to allow for higher efficiency than
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
188 * an application could get by just recreating the sample externally;
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
189 * not only do they not have to reopen the RWops, reallocate buffers,
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
190 * and potentially pass the data through several rejecting decoders,
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
191 * but certain decoders will not have to recreate their existing
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
192 * state (search for metadata, etc) since they already know they
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
193 * have a valid audio stream with a given set of characteristics.
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
194 *
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
195 * The decoder is responsible for calling seek() on the associated
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
196 * SDL_RWops. A failing call to seek() should be the ONLY reason that
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
197 * this method should ever fail!
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
198 */
249186e31431 Sound_Rewind() support code.
Ryan C. Gordon <icculus@icculus.org>
parents: 184
diff changeset
199 int (*rewind)(Sound_Sample *sample);
306
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
200
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
201 /*
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
202 * Reposition the decoding to an arbitrary point. Nonzero on
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
203 * success, zero on failure.
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
204 *
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
205 * The purpose of this method is to allow for higher efficiency than
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
206 * an application could get by just rewinding the sample and
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
207 * decoding to a given point.
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
208 *
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
209 * The decoder is responsible for calling seek() on the associated
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
210 * SDL_RWops.
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
211 *
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
212 * If there is an error, try to recover so that the next read will
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
213 * continue as if nothing happened.
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
214 */
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
215 int (*seek)(Sound_Sample *sample, Uint32 ms);
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
216 } Sound_DecoderFunctions;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
217
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
218
143
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
219 /* A structure to hold a set of audio conversion filters and buffers */
340
5a72981b8cba Added optional, experimental audio conversion routines by Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents: 322
diff changeset
220 #if (defined SOUND_USE_ALTCVT)
5a72981b8cba Added optional, experimental audio conversion routines by Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents: 322
diff changeset
221 #include "alt_audio_convert.h"
5a72981b8cba Added optional, experimental audio conversion routines by Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents: 322
diff changeset
222 #else
143
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
223 typedef struct Sound_AudioCVT
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
224 {
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
225 int needed; /* Set to 1 if conversion possible */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
226 Uint16 src_format; /* Source audio format */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
227 Uint16 dst_format; /* Target audio format */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
228 double rate_incr; /* Rate conversion increment */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
229 Uint8 *buf; /* Buffer to hold entire audio data */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
230 int len; /* Length of original audio buffer */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
231 int len_cvt; /* Length of converted audio buffer */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
232 int len_mult; /* buffer must be len*len_mult big */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
233 double len_ratio; /* Given len, final size is len*len_ratio */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
234 void (*filters[20])(struct Sound_AudioCVT *cvt, Uint16 *format);
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
235 int filter_index; /* Current audio conversion function */
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
236 } Sound_AudioCVT;
340
5a72981b8cba Added optional, experimental audio conversion routines by Frank Ranostaj.
Ryan C. Gordon <icculus@icculus.org>
parents: 322
diff changeset
237 #endif
143
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
238
441
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
239 extern SNDDECLSPEC int Sound_BuildAudioCVT(Sound_AudioCVT *cvt,
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
240 Uint16 src_format, Uint8 src_channels, Uint32 src_rate,
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
241 Uint16 dst_format, Uint8 dst_channels, Uint32 dst_rate,
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
242 Uint32 dst_size);
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
243
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
244 extern SNDDECLSPEC int Sound_ConvertAudio(Sound_AudioCVT *cvt);
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
245
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
246
5b00e43ec23c Patches to make SDL_sound more Visual C happy.
Ryan C. Gordon <icculus@icculus.org>
parents: 401
diff changeset
247
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
248 typedef struct __SOUND_SAMPLEINTERNAL__
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
249 {
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
250 Sound_Sample *next;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
251 Sound_Sample *prev;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
252 SDL_RWops *rw;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
253 const Sound_DecoderFunctions *funcs;
143
3e60862fbd76 Start of audio converter work.
Ryan C. Gordon <icculus@icculus.org>
parents: 107
diff changeset
254 Sound_AudioCVT sdlcvt;
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
255 void *buffer;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
256 Uint32 buffer_size;
12
2888101dcf98 Added _D(()) macro, decoder_private field, and changed read() method from
Ryan C. Gordon <icculus@icculus.org>
parents: 4
diff changeset
257 void *decoder_private;
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
258 } Sound_SampleInternal;
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
259
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
260
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
261 /* error messages... */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
262 #define ERR_IS_INITIALIZED "Already initialized"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
263 #define ERR_NOT_INITIALIZED "Not initialized"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
264 #define ERR_INVALID_ARGUMENT "Invalid argument"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
265 #define ERR_OUT_OF_MEMORY "Out of memory"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
266 #define ERR_NOT_SUPPORTED "Operation not supported"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
267 #define ERR_UNSUPPORTED_FORMAT "Sound format unsupported"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
268 #define ERR_NOT_A_HANDLE "Not a file handle"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
269 #define ERR_NO_SUCH_FILE "No such file"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
270 #define ERR_PAST_EOF "Past end of file"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
271 #define ERR_IO_ERROR "I/O error"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
272 #define ERR_COMPRESSION "(De)compression error"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
273 #define ERR_PREV_ERROR "Previous decoding already caused an error"
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
274 #define ERR_PREV_EOF "Previous decoding already triggered EOF"
306
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
275 #define ERR_CANNOT_SEEK "Sample is not seekable"
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
276
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
277 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
278 * Call this to set the message returned by Sound_GetError().
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
279 * Please only use the ERR_* constants above, or add new constants to the
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
280 * above group, but I want these all in one place.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
281 *
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
282 * Calling this with a NULL argument is a safe no-op.
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
283 */
306
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
284 void __Sound_SetError(const char *err);
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
285
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
286 /*
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
287 * Call this to convert milliseconds to an actual byte position, based on
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
288 * audio data characteristics.
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
289 */
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
290 Uint32 __Sound_convertMsToBytePos(Sound_AudioInfo *info, Uint32 ms);
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
291
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
292 /*
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
293 * Use this if you need a cross-platform stricmp().
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
294 */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
295 int __Sound_strcasecmp(const char *x, const char *y);
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
296
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
297
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
298 /* These get used all over for lessening code clutter. */
306
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
299 #define BAIL_MACRO(e, r) { __Sound_SetError(e); return r; }
c97be6e1bd27 Added framework for Sound_Seek() support.
Ryan C. Gordon <icculus@icculus.org>
parents: 301
diff changeset
300 #define BAIL_IF_MACRO(c, e, r) if (c) { __Sound_SetError(e); return r; }
4
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
301
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
302
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
303
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
304
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
305 /*--------------------------------------------------------------------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
306 /*--------------------------------------------------------------------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
307 /*------------ ----------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
308 /*------------ You MUST implement the following functions ----------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
309 /*------------ if porting to a new platform. ----------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
310 /*------------ (see platform/unix.c for an example) ----------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
311 /*------------ ----------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
312 /*--------------------------------------------------------------------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
313 /*--------------------------------------------------------------------------*/
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
314
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
315
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
316 /* (None, right now.) */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
317
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
318
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
319 #ifdef __cplusplus
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
320 extern "C" {
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
321 #endif
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
322
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
323 #endif /* defined _INCLUDE_SDL_SOUND_INTERNAL_H_ */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
324
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
325 /* end of SDL_sound_internal.h ... */
341cea3e13c6 Initial add.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
326