-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound.js
69 lines (64 loc) · 1.85 KB
/
sound.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const {
e,
ref,
Struct,
en,
push_export
} = require('./api');
e.SOUND_VER_MAJOR = 2;
e.SOUND_VER_MINOR = 0;
e.SOUND_VER_PATCH = 1;
e.SOUND_SAMPLEFLAG_NONE = en(0);
e.SOUND_SAMPLEFLAG_CANSEEK = en(1);
e.SOUND_SAMPLEFLAG_EOF = en(1 << 29);
e.SOUND_SAMPLEFLAG_ERROR = en(1 << 30);
e.SOUND_SAMPLEFLAG_EAGAIN = en(1 << 31);
e.Sound_AudioInfo = Struct({
format: 'Uint8',
channels: 'Uint16',
rate: 'Uint32'
});
e.Sound_DecoderInfo = Struct({
extensions: ref.refType('string'),
description: 'string',
author: 'string',
url: 'string'
});
e.Sound_Sample = Struct({
opaque: 'void*',
decoder: ref.refType(e.Sound_DecoderInfo),
desired: e.Sound_AudioInfo,
actual: e.Sound_AudioInfo,
buffer: 'void*',
buffer_size: 'Uint32',
flags: 'int'
});
e.Sound_Version = Struct({
major: 'int',
minor: 'int',
patch: 'int'
});
e.SOUND_VERSION = function(X) {
X.major = e.SOUND_VER_MAJOR;
X.minor = e.SOUND_VER_MINOR;
X.patch = e.SOUND_VER_PATCH;
return X;
}
exports.library_exports = {
'Sound_GetLinkedVersion': ['void', ['void*']],
'Sound_Init': ['int', []],
'Sound_Quit': ['int', []],
'Sound_AvailableDecoders': [ref.refType(ref.refType(e.Sound_DecoderInfo)), []],
'Sound_GetError': ['string', []],
'Sound_ClearError': ['void', []],
'Sound_NewSample': [ref.refType(e.Sound_Sample), ['void*', 'string', 'void*', 'Uint32']],
'Sound_NewSampleFromMem': [ref.refType(e.Sound_Sample), ['Uint8*', 'Uint32', 'string', 'void*', 'Uint32']],
'Sound_NewSampleFromFile': [ref.refType(e.Sound_Sample), ['string', 'void*', 'Uint32']],
'Sound_FreeSample': ['void', ['void*']],
'Sound_GetDuration': ['int32', ['void*']],
'Sound_SetBufferSize': ['int', ['void*', 'Uint32']],
'Sound_Decode': ['Uint32', ['void*']],
'Sound_DecodeAll': ['Uint32', ['void*']],
'Sound_Rewind': ['int', ['void*']],
'Sound_GetDuration': ['int', ['void*', 'Uint32']]
};