Mercurial > almixer_isolated
annotate Isolated/SoundDecoder_Internal.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 | be97ae4f30c0 |
children |
rev | line source |
---|---|
38 | 1 #ifndef SOUNDDECODER_INTERNAL_H |
2 #define SOUNDDECODER_INTERNAL_H | |
3 | |
4 #include <stdio.h> | |
5 #include "al.h" /* OpenAL */ | |
6 #include "ALmixer_RWops.h" | |
7 | |
8 #ifdef __cplusplus | |
9 extern "C" { | |
10 #endif | |
11 | |
12 | |
13 typedef struct SoundDecoder_DecoderFunctions | |
14 { | |
15 const SoundDecoder_DecoderInfo info; | |
16 int (*init)(void); | |
17 void (*quit)(void); | |
18 int (*open)(SoundDecoder_Sample *sample, const char *ext); | |
19 void (*close)(SoundDecoder_Sample *sample); | |
20 size_t (*read)(SoundDecoder_Sample *sample); | |
21 int (*rewind)(SoundDecoder_Sample *sample); | |
22 int (*seek)(SoundDecoder_Sample *sample, size_t ms); | |
23 } SoundDecoder_DecoderFunctions; | |
24 | |
25 typedef struct SoundDecoder_DecoderFunctions Sound_DecoderFunctions; | |
26 | |
27 | |
28 | |
29 typedef struct SoundDecoder_SampleInternal | |
30 { | |
31 ALmixer_RWops *rw; | |
32 const SoundDecoder_DecoderFunctions *funcs; | |
33 void *buffer; | |
34 size_t buffer_size; | |
35 void *decoder_private; | |
36 ptrdiff_t total_time; | |
37 } SoundDecoder_SampleInternal; | |
38 | |
39 typedef struct SoundDecoder_SampleInternal Sound_SampleInternal; | |
40 | |
41 #define BAIL_MACRO(e, r) { SoundDecoder_SetError(e); return r; } | |
42 #define BAIL_IF_MACRO(c, e, r) if (c) { SoundDecoder_SetError(e); return r; } | |
43 #define ERR_OUT_OF_MEMORY "Out of memory" | |
44 #define ERR_NOT_INITIALIZED "SoundDecoder not initialized" | |
45 #define ERR_UNSUPPORTED_FORMAT "Unsupported codec" | |
46 #define ERR_NULL_SAMPLE "Sound sample is NULL" | |
47 #define ERR_PREVIOUS_SAMPLE_ERROR "Cannot operate on sample due to previous error" | |
48 #define ERR_ALREADY_AT_EOF_ERROR "Cannot operate on sample because already at EOF" | |
49 | |
69
be97ae4f30c0
Changed use of ANDROID_NDK to __ANDROID__ since it seems to be standard.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
38
diff
changeset
|
50 #ifdef __ANDROID__ |
38 | 51 |
52 /* This macro crashes when a format string is used. | |
53 * Provide a real function instead. | |
54 #include <android/log.h> | |
55 #define SNDDBG(x) __android_log_print(ANDROID_LOG_INFO, "Corona", x); | |
56 */ | |
57 /* Android doesn't seem to understand the 'restrict' qualifier. */ | |
58 int SoundDecoder_DebugPrint(const char* format, ...); | |
59 #define SNDDBG(x) SoundDecoder_DebugPrint x | |
60 | |
61 #else | |
62 | |
63 #if (defined DEBUG_CHATTER) | |
64 #define SNDDBG(x) printf x | |
65 #else | |
66 #define SNDDBG(x) | |
67 #endif | |
68 | |
69 #endif | |
70 | |
71 void SoundDecoder_SetError(const char* err_str, ...); | |
72 #define __Sound_SetError SoundDecoder_SetError | |
73 | |
74 int SoundDecoder_strcasecmp(const char *x, const char *y); | |
75 #define __Sound_strcasecmp SoundDecoder_strcasecmp | |
76 | |
77 /* Ends C function definitions when using C++ */ | |
78 #ifdef __cplusplus | |
79 } | |
80 #endif | |
81 | |
82 | |
83 #endif | |
84 |