coastline 0.0.4
Loading...
Searching...
No Matches
wavechunks.h
Go to the documentation of this file.
1#ifndef COASTLINE_EAR_WAVECHUNKS_H
2#define COASTLINE_EAR_WAVECHUNKS_H
3
4#include <stdint.h>
5
6#if TGR_PLATFORM == TGR_PLATFORM_WIN
7#include <windows.h>
8// Multimedia declarations require the core Windows SDK types first.
9#include <mmreg.h>
10#include <mmsystem.h>
11#else
12#include <stdio.h>
13
14#include "common/types.h"
15#endif
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#if TGR_PLATFORM == TGR_PLATFORM_WIN
24typedef IMAADPCMWAVEFORMAT EarImaAdpcmWaveFormat;
26#else
28typedef struct EarRiffChunk {
29 DWORD ckid;
30 DWORD cksize;
31 DWORD fccType;
32 DWORD dwDataOffset;
33 DWORD dwFlags;
35
37#if defined(_MSC_VER)
38#pragma pack(push, 1)
39#pragma warning(push)
40#pragma warning(disable : 5030)
41#endif
42typedef struct [[gnu::packed]] EarWaveFormat {
43 WORD wFormatTag;
44 WORD nChannels;
45 DWORD nSamplesPerSec;
46 DWORD nAvgBytesPerSec;
47 WORD nBlockAlign;
48 WORD wBitsPerSample;
49 WORD cbSize;
51
53typedef struct [[gnu::packed]] EarImaAdpcmWaveFormat {
54 EarWaveFormat wfx;
55 WORD wSamplesPerBlock;
57#if defined(_MSC_VER)
58#pragma warning(pop)
59#pragma pack(pop)
60#endif
61#ifdef __cplusplus
62static_assert(sizeof(EarWaveFormat) == 18);
63static_assert(sizeof(EarImaAdpcmWaveFormat) == 20);
64#endif
65
67typedef struct EarRiffFile EarRiffFile;
68typedef EarRiffFile *EarWaveFile;
69
71#define EAR_RIFF_FIND_CHUNK 0x10
72
79EarRiffFile *EarRiffOpenPath(const char *path);
80
88EarRiffFile *EarRiffOpenMemory(const void *data, LONG size);
89
95void EarRiffClose(EarRiffFile *file);
96
105LONG EarRiffRead(EarRiffFile *file, void *buffer, LONG bytes);
106
115LONG EarRiffSeek(EarRiffFile *file, LONG offset, int origin);
116
128UINT EarRiffDescend(EarRiffFile *file, EarRiffChunk *chunk, const EarRiffChunk *parent, UINT flags);
129
137UINT EarRiffAscend(EarRiffFile *file, const EarRiffChunk *chunk);
138#endif
139
141#define EAR_RIFF_ID 0x46464952
143#define EAR_WAVE_ID 0x45564157
145#define EAR_FORMAT_CHUNK_ID 0x20746d66
147#define EAR_DATA_CHUNK_ID 0x61746164
149#define EAR_WAVE_FORMAT_PCM 1
151#define EAR_WAVE_FORMAT_IMA_ADPCM 0x11
152
158extern EarRiffChunk g_RiffWaveChunk;
163extern EarRiffChunk g_WaveDataChunk;
168extern EarRiffChunk g_WaveFormatChunk;
173extern uint16_t g_earMaximumStreamingBufferBytes;
175
176#ifdef __cplusplus
177}
178#endif
179
180#endif /* COASTLINE_EAR_WAVECHUNKS_H */
typedef HMMIO
The integer and floating-point types of the console, for headers shared with Windows.
WAVEFORMATEX EarWaveFormat
Definition wavechunks.h:23
MMCKINFO EarRiffChunk
Definition wavechunks.h:22
IMAADPCMWAVEFORMAT EarImaAdpcmWaveFormat
Definition wavechunks.h:24
HMMIO EarWaveFile
Definition wavechunks.h:25
typedef DWORD
typedef LONG
typedef UINT
typedef WORD