[14] | 1 | /* |
---|
| 2 | * This file should be #included as the first header in all *.c files. |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #if !defined(ALUT_INTERNAL_H) |
---|
| 6 | #define ALUT_INTERNAL_H |
---|
| 7 | |
---|
| 8 | #if HAVE_CONFIG_H |
---|
| 9 | #include "config.h" |
---|
| 10 | #endif |
---|
| 11 | |
---|
| 12 | #include <stdlib.h> |
---|
| 13 | |
---|
| 14 | #if HAVE_STDINT_H |
---|
| 15 | #include <stdint.h> |
---|
| 16 | #elif _MSC_VER < 1300 |
---|
| 17 | typedef char int8_t; |
---|
| 18 | typedef unsigned char uint8_t; |
---|
| 19 | typedef short int16_t; |
---|
| 20 | typedef unsigned short uint16_t; |
---|
| 21 | typedef int int32_t; |
---|
| 22 | typedef unsigned int uint32_t; |
---|
| 23 | #elif HAVE_BASETSD_H |
---|
| 24 | #include <basetsd.h> |
---|
| 25 | typedef INT8 int8_t; |
---|
| 26 | typedef UINT8 uint8_t; |
---|
| 27 | typedef INT16 int16_t; |
---|
| 28 | typedef UINT16 uint16_t; |
---|
| 29 | typedef INT32 int32_t; |
---|
| 30 | typedef UINT32 uint32_t; |
---|
| 31 | #else |
---|
| 32 | #error Do not know sized types on this platform |
---|
| 33 | #endif |
---|
| 34 | |
---|
| 35 | typedef int16_t Int16BigEndian; |
---|
| 36 | typedef uint16_t UInt16LittleEndian; |
---|
| 37 | typedef int32_t Int32BigEndian; |
---|
| 38 | typedef uint32_t UInt32LittleEndian; |
---|
| 39 | |
---|
| 40 | #if HAVE___ATTRIBUTE__ |
---|
| 41 | #define UNUSED(x) x __attribute__((unused)) |
---|
| 42 | #else |
---|
| 43 | #define UNUSED(x) x |
---|
| 44 | #endif |
---|
| 45 | |
---|
| 46 | #include <AL/alut.h> |
---|
| 47 | |
---|
| 48 | #define AU_HEADER_SIZE 24 |
---|
| 49 | |
---|
| 50 | /* see: http://en.wikipedia.org/wiki/Au_file_format, G.72x are missing */ |
---|
| 51 | enum AUEncoding |
---|
| 52 | { |
---|
| 53 | AU_ULAW_8 = 1, /* 8-bit ISDN u-law */ |
---|
| 54 | AU_PCM_8 = 2, /* 8-bit linear PCM (signed) */ |
---|
| 55 | AU_PCM_16 = 3, /* 16-bit linear PCM (signed, big-endian) */ |
---|
| 56 | AU_PCM_24 = 4, /* 24-bit linear PCM */ |
---|
| 57 | AU_PCM_32 = 5, /* 32-bit linear PCM */ |
---|
| 58 | AU_FLOAT_32 = 6, /* 32-bit IEEE floating point */ |
---|
| 59 | AU_FLOAT_64 = 7, /* 64-bit IEEE floating point */ |
---|
| 60 | AU_ALAW_8 = 27 /* 8-bit ISDN a-law */ |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | /* in alutCodec.c */ |
---|
| 64 | typedef ALvoid *Codec (ALvoid *data, size_t length, ALint numChannels, |
---|
| 65 | ALint bitsPerSample, ALfloat sampleFrequency); |
---|
| 66 | extern Codec _alutCodecLinear; |
---|
| 67 | extern Codec _alutCodecPCM8s; |
---|
| 68 | extern Codec _alutCodecPCM16; |
---|
| 69 | extern Codec _alutCodecULaw; |
---|
| 70 | extern Codec _alutCodecALaw; |
---|
| 71 | |
---|
| 72 | /* in alutError.c */ |
---|
| 73 | extern void _alutSetError (ALenum err); |
---|
| 74 | |
---|
| 75 | /* in alutInit.c */ |
---|
| 76 | extern ALboolean _alutSanityCheck (void); |
---|
| 77 | |
---|
| 78 | /* in alutInputStream.c */ |
---|
| 79 | typedef struct InputStream_struct InputStream; |
---|
| 80 | extern InputStream *_alutInputStreamConstructFromFile (const char *fileName); |
---|
| 81 | extern InputStream *_alutInputStreamConstructFromMemory (const ALvoid *data, |
---|
| 82 | size_t length); |
---|
| 83 | extern const char *_alutInputStreamGetFileName (const InputStream *stream); |
---|
| 84 | extern size_t _alutInputStreamGetRemainingLength (const InputStream *stream); |
---|
| 85 | extern ALboolean _alutInputStreamDestroy (InputStream *stream); |
---|
| 86 | extern ALboolean _alutInputStreamEOF (InputStream *stream); |
---|
| 87 | extern ALvoid *_alutInputStreamRead (InputStream *stream, size_t length); |
---|
| 88 | extern ALboolean _alutInputStreamSkip (InputStream *stream, |
---|
| 89 | size_t numBytesToSkip); |
---|
| 90 | extern ALboolean _alutInputStreamReadUInt16LE (InputStream *stream, |
---|
| 91 | UInt16LittleEndian *value); |
---|
| 92 | extern ALboolean _alutInputStreamReadInt32BE (InputStream *stream, |
---|
| 93 | Int32BigEndian *value); |
---|
| 94 | extern ALboolean _alutInputStreamReadUInt32LE (InputStream *stream, |
---|
| 95 | UInt32LittleEndian *value); |
---|
| 96 | |
---|
| 97 | /* in alutLoader.c */ |
---|
| 98 | extern ALuint _alutCreateBufferFromInputStream (InputStream *stream); |
---|
| 99 | extern void *_alutLoadMemoryFromInputStream (InputStream *stream, |
---|
| 100 | ALenum *format, ALsizei *size, |
---|
| 101 | ALfloat *frequency); |
---|
| 102 | |
---|
| 103 | /* in alutOutputStream.c */ |
---|
| 104 | typedef struct OutputStream_struct OutputStream; |
---|
| 105 | extern OutputStream *_alutOutputStreamConstruct (size_t maximumLength); |
---|
| 106 | extern ALboolean _alutOutputStreamDestroy (OutputStream *stream); |
---|
| 107 | extern void *_alutOutputStreamGetData (OutputStream *stream); |
---|
| 108 | extern size_t _alutOutputStreamGetLength (OutputStream *stream); |
---|
| 109 | extern ALboolean _alutOutputStreamWriteInt16BE (OutputStream *stream, |
---|
| 110 | Int16BigEndian value); |
---|
| 111 | extern ALboolean _alutOutputStreamWriteInt32BE (OutputStream *stream, |
---|
| 112 | Int32BigEndian value); |
---|
| 113 | |
---|
| 114 | /* in alutUtil.c */ |
---|
| 115 | extern ALvoid *_alutMalloc (size_t size); |
---|
| 116 | extern ALboolean _alutFormatConstruct (ALint numChannels, ALint bitsPerSample, |
---|
| 117 | ALenum *format); |
---|
| 118 | extern ALboolean _alutFormatGetNumChannels (ALenum format, |
---|
| 119 | ALint *numChannels); |
---|
| 120 | extern ALboolean _alutFormatGetBitsPerSample (ALenum format, |
---|
| 121 | ALint *bitsPerSample); |
---|
| 122 | |
---|
| 123 | /* in alutWaveform.c */ |
---|
| 124 | typedef struct BufferData_struct BufferData; |
---|
| 125 | extern BufferData *_alutBufferDataConstruct (ALvoid *data, size_t length, |
---|
| 126 | ALint numChannels, |
---|
| 127 | ALint bitsPerSample, |
---|
| 128 | ALfloat sampleFrequency); |
---|
| 129 | extern ALboolean _alutBufferDataDestroy (BufferData *bufferData); |
---|
| 130 | extern void _alutBufferDataDetachData (BufferData *bufferData); |
---|
| 131 | extern ALvoid *_alutBufferDataGetData (const BufferData *bufferData); |
---|
| 132 | extern size_t _alutBufferDataGetLength (const BufferData *bufferData); |
---|
| 133 | extern ALfloat _alutBufferDataGetSampleFrequency (const BufferData |
---|
| 134 | *bufferData); |
---|
| 135 | extern ALboolean _alutGetFormat (const BufferData *bufferData, |
---|
| 136 | ALenum *format); |
---|
| 137 | extern ALuint _alutPassBufferData (BufferData *bufferData); |
---|
| 138 | |
---|
| 139 | #endif /* not ALUT_INTERNAL_H */ |
---|