annotate Isolated/SoundDecoder.h @ 79:358b0bd5df43 tip

Added support for Apportable's alcSuspend()/alcResume() in BeginInterruption()/EndInterruption. You must define ALMIXER_USE_APPORTABLE_OPENAL_EXTENSIONS to compile in this support.
author Eric Wing <ewing@coronalabs.com>
date Tue, 30 Oct 2012 16:01:30 -0700
parents 398d1cb12448
children
rev   line source
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
1
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
2 /*
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
3 * This is a wrapper interface that tries to provide a similar
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
4 * front-end interface to SDL_sound.
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
5 */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
6
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
7 #ifndef SOUNDDECODER_H
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
8 #define SOUNDDECODER_H
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
9
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
10 #ifdef __cplusplus
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
11 extern "C" {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
12 #endif
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
13
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
14 #if defined(_WIN32)
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
15 #if defined(SOUND_DECODER_BUILD_LIBRARY)
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
16 #define SOUND_DECODER_DECLSPEC __declspec(dllexport)
72
398d1cb12448 Bug fix for unbalanced #if/#endif blocks. I think I broke it when removing the dllimport for Windows.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 71
diff changeset
17 #else
398d1cb12448 Bug fix for unbalanced #if/#endif blocks. I think I broke it when removing the dllimport for Windows.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 71
diff changeset
18 #define SOUND_DECODER_DECLSPEC
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
19 #endif
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
20 #else
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
21 #if defined(SOUND_DECODER_BUILD_LIBRARY)
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
22 #if defined (__GNUC__) && __GNUC__ >= 4
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
23 #define SOUND_DECODER_DECLSPEC __attribute__((visibility("default")))
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
24 #else
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
25 #define SOUND_DECODER_DECLSPEC
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
26 #endif
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
27 #else
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
28 #define SOUND_DECODER_DECLSPEC
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
29 #endif
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
30 #endif
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
31
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
32 #if defined(_WIN32)
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
33 #define SOUND_DECODER_CALL __cdecl
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
34 #else
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
35 #define SOUND_DECODER_CALL
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
36 #endif
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
37
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
38 #include <stdint.h>
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
39 #include <stddef.h>
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
40
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
41 #include "al.h" /* OpenAL */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
42
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
43 /* Compatibility defines for SDL */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
44 #define AUDIO_U8 0x0008
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
45 #define AUDIO_S8 0x8008
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
46 #define AUDIO_U16LSB 0x0010
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
47 #define AUDIO_S16LSB 0x8010
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
48 #define AUDIO_U16MSB 0x1010
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
49 #define AUDIO_S16MSB 0x9010
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
50 #define AUDIO_U16 AUDIO_U16LSB
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
51 #define AUDIO_S16 AUDIO_S16LSB
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
52
70
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
53 /* Apple defines __BIG_ENDIAN__ and __LITTLE_ENDIAN__ appropriately.
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
54 * Linux provides <endian.h>
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
55 */
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
56 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
57 #ifdef __linux__
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
58 #include <endian.h>
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
59 #if _BYTE_ORDER == _BIG_ENDIAN
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
60 #define __BIG_ENDIAN__ 1
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
61 #else
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
62 #define __LITTLE_ENDIAN__ 1
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
63 #endif
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
64 #else /* __linux __ */
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
65 #if defined(__hppa__) || \
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
66 defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
67 (defined(__MIPS__) && defined(__MISPEB__)) || \
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
68 defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
69 defined(__sparc__)
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
70
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
71 #define __BIG_ENDIAN__ 1
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
72 #else
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
73 #define __LITTLE_ENDIAN__ 1
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
74 #endif
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
75 #endif /* __linux __ */
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
76 #endif /* */
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
77
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
78
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
79 #if __BIG_ENDIAN__
70
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
80 /* #warning "Using __BIG_ENDIAN__" */
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
81 #define AUDIO_U16SYS AUDIO_U16MSB
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
82 #define AUDIO_S16SYS AUDIO_S16MSB
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
83 #elif __LITTLE_ENDIAN__
70
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
84 #define AUDIO_U16SYS AUDIO_U16LSB
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
85 #define AUDIO_S16SYS AUDIO_S16LSB
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
86 #else
70
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
87 #warning "Using __LITTLE_ENDIAN__ as fallback"
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
88 #define AUDIO_U16SYS AUDIO_U16LSB
7d63f5149d40 Enhanced endian detection code in SoundDecoder.h after reviewing ANDROID_NDK changes.
Eric Wing <ewing . public |-at-| gmail . com>
parents: 69
diff changeset
89 #define AUDIO_S16SYS AUDIO_S16LSB
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
90 #endif
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
91
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
92 struct ALmixer_RWops;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
93
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
94 typedef enum
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
95 {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
96 SOUND_SAMPLEFLAG_NONE = 0,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
97 SOUND_SAMPLEFLAG_CANSEEK = 1,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
98 SOUND_SAMPLEFLAG_EOF = 1 << 29,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
99 SOUND_SAMPLEFLAG_ERROR = 1 << 30,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
100 SOUND_SAMPLEFLAG_EAGAIN = 1 << 31
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
101 } SoundDecoder_SampleFlags;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
102
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
103 #define Sound_SampleFlags SoundDecoder_SampleFlags;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
104
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
105 typedef struct SoundDecoder_AudioInfo
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
106 {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
107 //uint16_t format; /**< Equivalent of SDL_AudioSpec.format. */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
108 ALushort format; /**< Equivalent of SDL_AudioSpec.format. */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
109 ALubyte channels;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
110 // uint8_t channels;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
111 //uint32_t rate;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
112 ALuint rate;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
113 } SoundDecoder_AudioInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
114
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
115 //#define Sound_AudioInfo SoundDecoder_AudioInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
116 typedef struct SoundDecoder_AudioInfo Sound_AudioInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
117
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
118
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
119
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
120 typedef struct SoundDecoder_DecoderInfo
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
121 {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
122 const char** extensions;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
123 const char* description;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
124 const char* author;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
125 const char* url;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
126 } SoundDecoder_DecoderInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
127
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
128 //#define Sound_DecoderInfo SoundDecoder_DecoderInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
129 typedef struct SoundDecoder_DecoderInfo Sound_DecoderInfo;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
130
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
131
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
132
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
133 typedef struct SoundDecoder_Sample
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
134 {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
135 void* opaque;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
136 const SoundDecoder_DecoderInfo* decoder;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
137 SoundDecoder_AudioInfo desired;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
138 SoundDecoder_AudioInfo actual;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
139 void *buffer;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
140 size_t buffer_size;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
141 SoundDecoder_SampleFlags flags;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
142 } SoundDecoder_Sample;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
143
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
144 //#define Sound_Sample SoundDecoder_Sample;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
145 typedef struct SoundDecoder_Sample Sound_Sample;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
146
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
147
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
148 typedef struct SoundDecoder_Version
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
149 {
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
150 int major;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
151 int minor;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
152 int patch;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
153 } SoundDecoder_Version;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
154
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
155 //#define Sound_Version SoundDecoder_Version;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
156 typedef struct SoundDecoder_Version Sound_Version;
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
157
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
158
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
159 #define SOUNDDECODER_VER_MAJOR 0
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
160 #define SOUNDDECODER_VER_MINOR 0
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
161 #define SOUNDDECODER_VER_PATCH 1
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
162
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
163 #define SOUNDDECODER_VERSION(x) \
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
164 { \
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
165 (x)->major = SOUNDDECODER_VER_MAJOR; \
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
166 (x)->minor = SOUNDDECODER_VER_MINOR; \
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
167 (x)->patch = SOUNDDECODER_VER_PATCH; \
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
168 }
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
169
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
170 #define SOUND_VERSION SOUNDDECODER_VERSION
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
171
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
172 extern SOUND_DECODER_DECLSPEC void SOUND_DECODER_CALL SoundDecoder_GetLinkedVersion(SoundDecoder_Version *ver);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
173 #define Sound_GetLinkedVersion SoundDecoder_GetLinkedVersion
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
174
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
175 extern SOUND_DECODER_DECLSPEC int SOUND_DECODER_CALL SoundDecoder_Init(void);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
176 #define Sound_Init SoundDecoder_Init
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
177
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
178 extern SOUND_DECODER_DECLSPEC void SOUND_DECODER_CALL SoundDecoder_Quit(void);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
179 #define Sound_Quit SoundDecoder_Quit
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
180
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
181
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
182 extern SOUND_DECODER_DECLSPEC const SOUND_DECODER_CALL SoundDecoder_DecoderInfo** SoundDecoder_AvailableDecoders(void);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
183 #define Sound_AvailableDecoders SoundDecoder_AvailableDecoders
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
184
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
185
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
186 extern SOUND_DECODER_DECLSPEC const char* SOUND_DECODER_CALL SoundDecoder_GetError(void);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
187 #define Sound_GetError SoundDecoder_GetError
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
188
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
189
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
190 extern SOUND_DECODER_DECLSPEC void SOUND_DECODER_CALL SoundDecoder_ClearError(void);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
191 #define Sound_ClearError SoundDecoder_ClearError
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
192
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
193
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
194
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
195 extern SOUND_DECODER_DECLSPEC SoundDecoder_Sample* SOUND_DECODER_CALL SoundDecoder_NewSample(
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
196 struct ALmixer_RWops* rw_ops,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
197 const char* ext,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
198 SoundDecoder_AudioInfo* desired,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
199 size_t buffer_size);
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
200 #define Sound_NewSample SoundDecoder_NewSample
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
201
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
202 extern SOUND_DECODER_DECLSPEC SoundDecoder_Sample* SOUND_DECODER_CALL SoundDecoder_NewSampleFromFile(const char* file_name,
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
203 SoundDecoder_AudioInfo* desired,
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
204 size_t bufferSize);
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
205 #define Sound_NewSampleFromFile SoundDecoder_NewSampleFromFile
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
206
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
207
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
208 extern SOUND_DECODER_DECLSPEC void SOUND_DECODER_CALL SoundDecoder_FreeSample(SoundDecoder_Sample* sound_sample);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
209 #define Sound_FreeSample SoundDecoder_FreeSample
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
210
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
211
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
212 extern SOUND_DECODER_DECLSPEC ptrdiff_t SOUND_DECODER_CALL SoundDecoder_GetDuration(SoundDecoder_Sample* sound_sample);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
213 #define Sound_GetDuration SoundDecoder_GetDuration
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
214
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
215 extern SOUND_DECODER_DECLSPEC int SOUND_DECODER_CALL SoundDecoder_SetBufferSize(SoundDecoder_Sample* sound_sample, size_t new_buffer_size);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
216 #define Sound_SetBufferSize SoundDecoder_SetBufferSize
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
217
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
218 extern SOUND_DECODER_DECLSPEC size_t SOUND_DECODER_CALL SoundDecoder_Decode(SoundDecoder_Sample* sound_sample);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
219 #define Sound_Decode SoundDecoder_Decode
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
220
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
221 extern SOUND_DECODER_DECLSPEC size_t SOUND_DECODER_CALL SoundDecoder_DecodeAll(SoundDecoder_Sample* sound_sample);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
222 #define Sound_DecodeAll SoundDecoder_DecodeAll
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
223
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
224 extern SOUND_DECODER_DECLSPEC int SOUND_DECODER_CALL SoundDecoder_Rewind(SoundDecoder_Sample* sound_sample);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
225 #define Sound_Rewind SoundDecoder_Rewind
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
226
56
208a9ed20087 Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
Eric Wing <ewing@anscamobile.com>
parents: 38
diff changeset
227 extern SOUND_DECODER_DECLSPEC int SOUND_DECODER_CALL SoundDecoder_Seek(SoundDecoder_Sample* sound_sample, size_t ms);
38
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
228 #define Sound_Seek SoundDecoder_Seek
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
229
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
230
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
231 /* Ends C function definitions when using C++ */
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
232 #ifdef __cplusplus
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
233 }
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
234 #endif
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
235
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
236 #endif
71b465ff0622 Added support files.
Eric Wing <ewing@anscamobile.com>
parents:
diff changeset
237