@dayme/bunraylib 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -11
- package/package.json +11 -3
- package/src/Raylib.ts +58 -3678
- package/src/c/common.h +0 -2
- package/src/constants.ts +2 -2
- package/src/index.ts +6 -6
- package/src/main.c +0 -1
- package/src/main.d.ts +1 -1
- package/src/modules/audio/AudioModule.ts +197 -0
- package/src/modules/audio/symbols.ts +70 -0
- package/src/{c/audio.c → modules/audio/wrapper.c} +40 -80
- package/src/modules/camera/CameraModule.ts +239 -0
- package/src/modules/camera/symbols.ts +49 -0
- package/src/modules/camera/wrapper.c +141 -0
- package/src/modules/collision/CollisionModule.ts +363 -0
- package/src/modules/collision/symbols.ts +149 -0
- package/src/modules/collision/wrapper.c +176 -0
- package/src/modules/color/ColorModule.ts +65 -0
- package/src/modules/color/symbols.ts +26 -0
- package/src/modules/color/wrapper.c +16 -0
- package/src/modules/draw3d/Draw3DModule.ts +441 -0
- package/src/modules/draw3d/symbols.ts +199 -0
- package/src/modules/draw3d/wrapper.c +202 -0
- package/src/modules/font/FontModule.ts +250 -0
- package/src/modules/font/symbols.ts +46 -0
- package/src/{c/font.c → modules/font/wrapper.c} +50 -70
- package/src/modules/image/ImageModule.ts +451 -0
- package/src/{symbols/image.ts → modules/image/symbols.ts} +15 -12
- package/src/{c/image.c → modules/image/wrapper.c} +23 -45
- package/src/modules/input/InputModule.ts +160 -0
- package/src/modules/input/symbols.ts +54 -0
- package/src/modules/input/wrapper.c +31 -0
- package/src/modules/model/ModelModule.ts +228 -0
- package/src/{symbols/model.ts → modules/model/symbols.ts} +17 -14
- package/src/{c/model.c → modules/model/wrapper.c} +30 -30
- package/src/modules/shader/ShaderModule.ts +78 -0
- package/src/{symbols/shader.ts → modules/shader/symbols.ts} +3 -1
- package/src/{c/shader.c → modules/shader/wrapper.c} +11 -1
- package/src/modules/shapes/ShapesModule.ts +687 -0
- package/src/modules/shapes/symbols.ts +161 -0
- package/src/modules/shapes/wrapper.c +183 -0
- package/src/modules/texture/TextureModule.ts +190 -0
- package/src/{symbols/texture.ts → modules/texture/symbols.ts} +15 -9
- package/src/{c/texture.c → modules/texture/wrapper.c} +7 -22
- package/src/modules/window/WindowModule.ts +248 -0
- package/src/modules/window/symbols.ts +85 -0
- package/src/modules/window/wrapper.c +39 -0
- package/src/symbols.ts +87 -47
- package/src/utils.ts +63 -15
- package/src/c/camera.c +0 -161
- package/src/c/collision.c +0 -176
- package/src/c/color.c +0 -100
- package/src/c/draw3d.c +0 -222
- package/src/c/filesystem.c +0 -36
- package/src/c/input.c +0 -85
- package/src/c/shapes.c +0 -283
- package/src/c/window.c +0 -150
- package/src/symbols/audio.ts +0 -64
- package/src/symbols/camera.ts +0 -46
- package/src/symbols/collision.ts +0 -116
- package/src/symbols/color.ts +0 -22
- package/src/symbols/draw3d.ts +0 -137
- package/src/symbols/filesystem.ts +0 -30
- package/src/symbols/font.ts +0 -40
- package/src/symbols/input.ts +0 -51
- package/src/symbols/shapes.ts +0 -92
- package/src/symbols/window.ts +0 -83
package/src/c/common.h
CHANGED
package/src/constants.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Raylib } from
|
|
2
|
-
export { configure, getSymbols } from
|
|
3
|
-
export type { RaylibConfig } from
|
|
4
|
-
export { cstr, color } from
|
|
1
|
+
export { Raylib } from './Raylib';
|
|
2
|
+
export { configure, getSymbols } from './symbols';
|
|
3
|
+
export type { RaylibConfig } from './symbols';
|
|
4
|
+
export { cstr, color } from './utils';
|
|
5
5
|
export type {
|
|
6
6
|
CameraProjection,
|
|
7
7
|
Vec2,
|
|
@@ -25,5 +25,5 @@ export type {
|
|
|
25
25
|
ModelAnimation,
|
|
26
26
|
RayCollision,
|
|
27
27
|
GlyphInfo,
|
|
28
|
-
} from
|
|
29
|
-
export * from
|
|
28
|
+
} from './types';
|
|
29
|
+
export * from './constants';
|
package/src/main.c
CHANGED
package/src/main.d.ts
CHANGED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { getSymbols } from '../../symbols';
|
|
2
|
+
import { cstr, f, i } from '../../utils';
|
|
3
|
+
import type { Wave, Sound, Music, AudioStream } from '../../types';
|
|
4
|
+
const r = () => getSymbols();
|
|
5
|
+
|
|
6
|
+
export class AudioModule {
|
|
7
|
+
static initAudioDevice(): void {
|
|
8
|
+
r().symbols.InitAudioDevice();
|
|
9
|
+
}
|
|
10
|
+
static closeAudioDevice(): void {
|
|
11
|
+
r().symbols.CloseAudioDevice();
|
|
12
|
+
}
|
|
13
|
+
static isAudioDeviceReady(): boolean {
|
|
14
|
+
return r().symbols.IsAudioDeviceReady();
|
|
15
|
+
}
|
|
16
|
+
static setMasterVolume(volume: number): void {
|
|
17
|
+
r().symbols.SetMasterVolume(f(volume));
|
|
18
|
+
}
|
|
19
|
+
static getMasterVolume(): number {
|
|
20
|
+
return r().symbols.GetMasterVolume();
|
|
21
|
+
}
|
|
22
|
+
static loadWave(fileName: string): Wave {
|
|
23
|
+
return r().symbols.LoadWaveW(cstr(fileName));
|
|
24
|
+
}
|
|
25
|
+
static loadWaveFromMemory(fileType: string, fileData: Uint8Array, dataSize: number): Wave {
|
|
26
|
+
return r().symbols.LoadWaveFromMemoryW(cstr(fileType), fileData, i(dataSize));
|
|
27
|
+
}
|
|
28
|
+
static isWaveValid(wave: Wave): boolean {
|
|
29
|
+
return r().symbols.IsWaveValidW(i(wave));
|
|
30
|
+
}
|
|
31
|
+
static unloadWave(wave: Wave): void {
|
|
32
|
+
r().symbols.UnloadWaveW(i(wave));
|
|
33
|
+
}
|
|
34
|
+
static exportWave(wave: Wave, fileName: string): boolean {
|
|
35
|
+
return r().symbols.ExportWaveW(i(wave), cstr(fileName));
|
|
36
|
+
}
|
|
37
|
+
static exportWaveAsCode(wave: Wave, fileName: string): boolean {
|
|
38
|
+
return r().symbols.ExportWaveAsCodeW(i(wave), cstr(fileName));
|
|
39
|
+
}
|
|
40
|
+
static waveCopy(wave: Wave): Wave {
|
|
41
|
+
return r().symbols.WaveCopyW(i(wave));
|
|
42
|
+
}
|
|
43
|
+
static waveCrop(wave: Wave, initFrame: number, finalFrame: number): void {
|
|
44
|
+
r().symbols.WaveCropW(i(wave), i(initFrame), i(finalFrame));
|
|
45
|
+
}
|
|
46
|
+
static waveFormat(wave: Wave, sampleRate: number, sampleSize: number, channels: number): void {
|
|
47
|
+
r().symbols.WaveFormatW(i(wave), i(sampleRate), i(sampleSize), i(channels));
|
|
48
|
+
}
|
|
49
|
+
static loadSound(fileName: string): Sound {
|
|
50
|
+
return r().symbols.LoadSoundW(cstr(fileName));
|
|
51
|
+
}
|
|
52
|
+
static loadSoundFromWave(wave: Wave): Sound {
|
|
53
|
+
return r().symbols.LoadSoundFromWaveW(i(wave));
|
|
54
|
+
}
|
|
55
|
+
static loadSoundAlias(source: Sound): Sound {
|
|
56
|
+
return r().symbols.LoadSoundAliasW(i(source));
|
|
57
|
+
}
|
|
58
|
+
static isSoundValid(sound: Sound): boolean {
|
|
59
|
+
return r().symbols.IsSoundValidW(i(sound));
|
|
60
|
+
}
|
|
61
|
+
static unloadSound(sound: Sound): void {
|
|
62
|
+
r().symbols.UnloadSoundW(i(sound));
|
|
63
|
+
}
|
|
64
|
+
static unloadSoundAlias(alias: Sound): void {
|
|
65
|
+
r().symbols.UnloadSoundAliasW(i(alias));
|
|
66
|
+
}
|
|
67
|
+
static playSound(sound: Sound): void {
|
|
68
|
+
r().symbols.PlaySoundW(i(sound));
|
|
69
|
+
}
|
|
70
|
+
static stopSound(sound: Sound): void {
|
|
71
|
+
r().symbols.StopSoundW(i(sound));
|
|
72
|
+
}
|
|
73
|
+
static pauseSound(sound: Sound): void {
|
|
74
|
+
r().symbols.PauseSoundW(i(sound));
|
|
75
|
+
}
|
|
76
|
+
static resumeSound(sound: Sound): void {
|
|
77
|
+
r().symbols.ResumeSoundW(i(sound));
|
|
78
|
+
}
|
|
79
|
+
static isSoundPlaying(sound: Sound): boolean {
|
|
80
|
+
return r().symbols.IsSoundPlayingW(i(sound));
|
|
81
|
+
}
|
|
82
|
+
static setSoundVolume(sound: Sound, volume: number): void {
|
|
83
|
+
r().symbols.SetSoundVolumeW(i(sound), f(volume));
|
|
84
|
+
}
|
|
85
|
+
static setSoundPitch(sound: Sound, pitch: number): void {
|
|
86
|
+
r().symbols.SetSoundPitchW(i(sound), f(pitch));
|
|
87
|
+
}
|
|
88
|
+
static setSoundPan(sound: Sound, pan: number): void {
|
|
89
|
+
r().symbols.SetSoundPanW(i(sound), f(pan));
|
|
90
|
+
}
|
|
91
|
+
static loadMusicStream(fileName: string): Music {
|
|
92
|
+
return r().symbols.LoadMusicStreamW(cstr(fileName));
|
|
93
|
+
}
|
|
94
|
+
static loadMusicStreamFromMemory(fileType: string, data: Uint8Array, dataSize: number): Music {
|
|
95
|
+
return r().symbols.LoadMusicStreamFromMemoryW(cstr(fileType), data, i(dataSize));
|
|
96
|
+
}
|
|
97
|
+
static isMusicValid(music: Music): boolean {
|
|
98
|
+
return r().symbols.IsMusicValidW(i(music));
|
|
99
|
+
}
|
|
100
|
+
static unloadMusicStream(music: Music): void {
|
|
101
|
+
r().symbols.UnloadMusicStreamW(i(music));
|
|
102
|
+
}
|
|
103
|
+
static playMusicStream(music: Music): void {
|
|
104
|
+
r().symbols.PlayMusicStreamW(i(music));
|
|
105
|
+
}
|
|
106
|
+
static isMusicStreamPlaying(music: Music): boolean {
|
|
107
|
+
return r().symbols.IsMusicStreamPlayingW(i(music));
|
|
108
|
+
}
|
|
109
|
+
static updateMusicStream(music: Music): void {
|
|
110
|
+
r().symbols.UpdateMusicStreamW(i(music));
|
|
111
|
+
}
|
|
112
|
+
static stopMusicStream(music: Music): void {
|
|
113
|
+
r().symbols.StopMusicStreamW(i(music));
|
|
114
|
+
}
|
|
115
|
+
static pauseMusicStream(music: Music): void {
|
|
116
|
+
r().symbols.PauseMusicStreamW(i(music));
|
|
117
|
+
}
|
|
118
|
+
static resumeMusicStream(music: Music): void {
|
|
119
|
+
r().symbols.ResumeMusicStreamW(i(music));
|
|
120
|
+
}
|
|
121
|
+
static seekMusicStream(music: Music, position: number): void {
|
|
122
|
+
r().symbols.SeekMusicStreamW(i(music), f(position));
|
|
123
|
+
}
|
|
124
|
+
static setMusicVolume(music: Music, volume: number): void {
|
|
125
|
+
r().symbols.SetMusicVolumeW(i(music), f(volume));
|
|
126
|
+
}
|
|
127
|
+
static setMusicPitch(music: Music, pitch: number): void {
|
|
128
|
+
r().symbols.SetMusicPitchW(i(music), f(pitch));
|
|
129
|
+
}
|
|
130
|
+
static setMusicPan(music: Music, pan: number): void {
|
|
131
|
+
r().symbols.SetMusicPanW(i(music), f(pan));
|
|
132
|
+
}
|
|
133
|
+
static getMusicTimeLength(music: Music): number {
|
|
134
|
+
return r().symbols.GetMusicTimeLengthW(i(music));
|
|
135
|
+
}
|
|
136
|
+
static getMusicTimePlayed(music: Music): number {
|
|
137
|
+
return r().symbols.GetMusicTimePlayedW(i(music));
|
|
138
|
+
}
|
|
139
|
+
static loadAudioStream(sampleRate: number, sampleSize: number, channels: number): AudioStream {
|
|
140
|
+
return r().symbols.LoadAudioStreamW(i(sampleRate), i(sampleSize), i(channels));
|
|
141
|
+
}
|
|
142
|
+
static isAudioStreamValid(stream: AudioStream): boolean {
|
|
143
|
+
return r().symbols.IsAudioStreamValidW(i(stream));
|
|
144
|
+
}
|
|
145
|
+
static unloadAudioStream(stream: AudioStream): void {
|
|
146
|
+
r().symbols.UnloadAudioStreamW(i(stream));
|
|
147
|
+
}
|
|
148
|
+
static isAudioStreamProcessed(stream: AudioStream): boolean {
|
|
149
|
+
return r().symbols.IsAudioStreamProcessedW(i(stream));
|
|
150
|
+
}
|
|
151
|
+
static playAudioStream(stream: AudioStream): void {
|
|
152
|
+
r().symbols.PlayAudioStreamW(i(stream));
|
|
153
|
+
}
|
|
154
|
+
static pauseAudioStream(stream: AudioStream): void {
|
|
155
|
+
r().symbols.PauseAudioStreamW(i(stream));
|
|
156
|
+
}
|
|
157
|
+
static resumeAudioStream(stream: AudioStream): void {
|
|
158
|
+
r().symbols.ResumeAudioStreamW(i(stream));
|
|
159
|
+
}
|
|
160
|
+
static isAudioStreamPlaying(stream: AudioStream): boolean {
|
|
161
|
+
return r().symbols.IsAudioStreamPlayingW(i(stream));
|
|
162
|
+
}
|
|
163
|
+
static stopAudioStream(stream: AudioStream): void {
|
|
164
|
+
r().symbols.StopAudioStreamW(i(stream));
|
|
165
|
+
}
|
|
166
|
+
static setAudioStreamVolume(stream: AudioStream, volume: number): void {
|
|
167
|
+
r().symbols.SetAudioStreamVolumeW(i(stream), f(volume));
|
|
168
|
+
}
|
|
169
|
+
static setAudioStreamPitch(stream: AudioStream, pitch: number): void {
|
|
170
|
+
r().symbols.SetAudioStreamPitchW(i(stream), f(pitch));
|
|
171
|
+
}
|
|
172
|
+
static setAudioStreamPan(stream: AudioStream, pan: number): void {
|
|
173
|
+
r().symbols.SetAudioStreamPanW(i(stream), f(pan));
|
|
174
|
+
}
|
|
175
|
+
static setAudioStreamBufferSizeDefault(size: number): void {
|
|
176
|
+
r().symbols.SetAudioStreamBufferSizeDefault(i(size));
|
|
177
|
+
}
|
|
178
|
+
static loadWaveSamples(wave: Wave): number {
|
|
179
|
+
return r().symbols.LoadWaveSamplesW(wave) as unknown as number;
|
|
180
|
+
}
|
|
181
|
+
static unloadWaveSamples(ptr: number): void {
|
|
182
|
+
r().symbols.UnloadWaveSamplesW(ptr as unknown as Buffer);
|
|
183
|
+
}
|
|
184
|
+
static updateSound(sound: Sound, data: Buffer | Uint8Array, frameCount: number): void {
|
|
185
|
+
r().symbols.UpdateSoundW(i(sound), data, i(frameCount));
|
|
186
|
+
}
|
|
187
|
+
static updateAudioStream(
|
|
188
|
+
stream: AudioStream,
|
|
189
|
+
data: Buffer | Uint8Array,
|
|
190
|
+
frameCount: number,
|
|
191
|
+
): void {
|
|
192
|
+
r().symbols.UpdateAudioStreamW(i(stream), data, i(frameCount));
|
|
193
|
+
}
|
|
194
|
+
static setAudioStreamCallback(stream: AudioStream, callback: number): void {
|
|
195
|
+
r().symbols.SetAudioStreamCallbackW(i(stream), callback as unknown as Buffer);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { FFIType } from 'bun:ffi';
|
|
2
|
+
const { i32, f32, bool } = FFIType;
|
|
3
|
+
|
|
4
|
+
export const audioDirectSymbols = {
|
|
5
|
+
InitAudioDevice: { args: [], returns: FFIType.void },
|
|
6
|
+
CloseAudioDevice: { args: [], returns: FFIType.void },
|
|
7
|
+
IsAudioDeviceReady: { args: [], returns: bool },
|
|
8
|
+
SetMasterVolume: { args: [f32], returns: FFIType.void },
|
|
9
|
+
GetMasterVolume: { args: [], returns: f32 },
|
|
10
|
+
SetAudioStreamBufferSizeDefault: { args: [i32], returns: FFIType.void },
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const audioWrapperSymbols = {
|
|
14
|
+
LoadWaveW: { args: [FFIType.cstring], returns: i32 },
|
|
15
|
+
LoadWaveFromMemoryW: { args: [FFIType.cstring, FFIType.ptr, i32], returns: i32 },
|
|
16
|
+
IsWaveValidW: { args: [i32], returns: FFIType.bool },
|
|
17
|
+
UnloadWaveW: { args: [i32], returns: FFIType.void },
|
|
18
|
+
ExportWaveW: { args: [i32, FFIType.cstring], returns: FFIType.bool },
|
|
19
|
+
ExportWaveAsCodeW: { args: [i32, FFIType.cstring], returns: FFIType.bool },
|
|
20
|
+
WaveCopyW: { args: [i32], returns: i32 },
|
|
21
|
+
WaveCropW: { args: [i32, i32, i32], returns: FFIType.void },
|
|
22
|
+
WaveFormatW: { args: [i32, i32, i32, i32], returns: FFIType.void },
|
|
23
|
+
LoadSoundW: { args: [FFIType.cstring], returns: i32 },
|
|
24
|
+
LoadSoundFromWaveW: { args: [i32], returns: i32 },
|
|
25
|
+
LoadSoundAliasW: { args: [i32], returns: i32 },
|
|
26
|
+
IsSoundValidW: { args: [i32], returns: FFIType.bool },
|
|
27
|
+
UnloadSoundW: { args: [i32], returns: FFIType.void },
|
|
28
|
+
UnloadSoundAliasW: { args: [i32], returns: FFIType.void },
|
|
29
|
+
PlaySoundW: { args: [i32], returns: FFIType.void },
|
|
30
|
+
StopSoundW: { args: [i32], returns: FFIType.void },
|
|
31
|
+
PauseSoundW: { args: [i32], returns: FFIType.void },
|
|
32
|
+
ResumeSoundW: { args: [i32], returns: FFIType.void },
|
|
33
|
+
IsSoundPlayingW: { args: [i32], returns: FFIType.bool },
|
|
34
|
+
SetSoundVolumeW: { args: [i32, f32], returns: FFIType.void },
|
|
35
|
+
SetSoundPitchW: { args: [i32, f32], returns: FFIType.void },
|
|
36
|
+
SetSoundPanW: { args: [i32, f32], returns: FFIType.void },
|
|
37
|
+
LoadMusicStreamW: { args: [FFIType.cstring], returns: i32 },
|
|
38
|
+
LoadMusicStreamFromMemoryW: { args: [FFIType.cstring, FFIType.ptr, i32], returns: i32 },
|
|
39
|
+
IsMusicValidW: { args: [i32], returns: FFIType.bool },
|
|
40
|
+
UnloadMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
41
|
+
PlayMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
42
|
+
IsMusicStreamPlayingW: { args: [i32], returns: FFIType.bool },
|
|
43
|
+
UpdateMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
44
|
+
StopMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
45
|
+
PauseMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
46
|
+
ResumeMusicStreamW: { args: [i32], returns: FFIType.void },
|
|
47
|
+
SeekMusicStreamW: { args: [i32, f32], returns: FFIType.void },
|
|
48
|
+
SetMusicVolumeW: { args: [i32, f32], returns: FFIType.void },
|
|
49
|
+
SetMusicPitchW: { args: [i32, f32], returns: FFIType.void },
|
|
50
|
+
SetMusicPanW: { args: [i32, f32], returns: FFIType.void },
|
|
51
|
+
GetMusicTimeLengthW: { args: [i32], returns: f32 },
|
|
52
|
+
GetMusicTimePlayedW: { args: [i32], returns: f32 },
|
|
53
|
+
LoadAudioStreamW: { args: [i32, i32, i32], returns: i32 },
|
|
54
|
+
IsAudioStreamValidW: { args: [i32], returns: FFIType.bool },
|
|
55
|
+
UnloadAudioStreamW: { args: [i32], returns: FFIType.void },
|
|
56
|
+
IsAudioStreamProcessedW: { args: [i32], returns: FFIType.bool },
|
|
57
|
+
PlayAudioStreamW: { args: [i32], returns: FFIType.void },
|
|
58
|
+
PauseAudioStreamW: { args: [i32], returns: FFIType.void },
|
|
59
|
+
ResumeAudioStreamW: { args: [i32], returns: FFIType.void },
|
|
60
|
+
IsAudioStreamPlayingW: { args: [i32], returns: FFIType.bool },
|
|
61
|
+
StopAudioStreamW: { args: [i32], returns: FFIType.void },
|
|
62
|
+
SetAudioStreamVolumeW: { args: [i32, f32], returns: FFIType.void },
|
|
63
|
+
SetAudioStreamPitchW: { args: [i32, f32], returns: FFIType.void },
|
|
64
|
+
SetAudioStreamPanW: { args: [i32, f32], returns: FFIType.void },
|
|
65
|
+
LoadWaveSamplesW: { args: [i32], returns: FFIType.ptr },
|
|
66
|
+
UnloadWaveSamplesW: { args: [FFIType.ptr], returns: FFIType.void },
|
|
67
|
+
UpdateSoundW: { args: [i32, FFIType.ptr, i32], returns: FFIType.void },
|
|
68
|
+
UpdateAudioStreamW: { args: [i32, FFIType.ptr, i32], returns: FFIType.void },
|
|
69
|
+
SetAudioStreamCallbackW: { args: [i32, FFIType.ptr], returns: FFIType.void },
|
|
70
|
+
} as const;
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
#include "common.h"
|
|
2
|
-
|
|
3
|
-
void InitAudioDeviceW() {
|
|
4
|
-
InitAudioDevice();
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
void CloseAudioDeviceW() {
|
|
8
|
-
CloseAudioDevice();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
bool IsAudioDeviceReadyW() {
|
|
12
|
-
return IsAudioDeviceReady();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
void SetMasterVolumeW(int volume) {
|
|
16
|
-
float f;
|
|
17
|
-
memcpy(&f, &volume, sizeof(float));
|
|
18
|
-
SetMasterVolume(f);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
int GetMasterVolumeW() {
|
|
22
|
-
float f = GetMasterVolume();
|
|
23
|
-
int i;
|
|
24
|
-
memcpy(&i, &f, sizeof(float));
|
|
25
|
-
return i;
|
|
26
|
-
}
|
|
1
|
+
#include "../../c/common.h"
|
|
27
2
|
|
|
28
3
|
int LoadWaveW(const char* fileName) {
|
|
29
4
|
int slot = waveAlloc();
|
|
@@ -143,25 +118,19 @@ bool IsSoundPlayingW(int id) {
|
|
|
143
118
|
return IsSoundPlaying(soundRegistry[id]);
|
|
144
119
|
}
|
|
145
120
|
|
|
146
|
-
void SetSoundVolumeW(int id,
|
|
121
|
+
void SetSoundVolumeW(int id, float volume) {
|
|
147
122
|
if (id < 0 || id >= MAX_SOUNDS || !soundUsed[id]) return;
|
|
148
|
-
|
|
149
|
-
memcpy(&f, &volume, sizeof(float));
|
|
150
|
-
SetSoundVolume(soundRegistry[id], f);
|
|
123
|
+
SetSoundVolume(soundRegistry[id], volume);
|
|
151
124
|
}
|
|
152
125
|
|
|
153
|
-
void SetSoundPitchW(int id,
|
|
126
|
+
void SetSoundPitchW(int id, float pitch) {
|
|
154
127
|
if (id < 0 || id >= MAX_SOUNDS || !soundUsed[id]) return;
|
|
155
|
-
|
|
156
|
-
memcpy(&f, &pitch, sizeof(float));
|
|
157
|
-
SetSoundPitch(soundRegistry[id], f);
|
|
128
|
+
SetSoundPitch(soundRegistry[id], pitch);
|
|
158
129
|
}
|
|
159
130
|
|
|
160
|
-
void SetSoundPanW(int id,
|
|
131
|
+
void SetSoundPanW(int id, float pan) {
|
|
161
132
|
if (id < 0 || id >= MAX_SOUNDS || !soundUsed[id]) return;
|
|
162
|
-
|
|
163
|
-
memcpy(&f, &pan, sizeof(float));
|
|
164
|
-
SetSoundPan(soundRegistry[id], f);
|
|
133
|
+
SetSoundPan(soundRegistry[id], pan);
|
|
165
134
|
}
|
|
166
135
|
|
|
167
136
|
int LoadMusicStreamW(const char* fileName) {
|
|
@@ -219,48 +188,34 @@ void ResumeMusicStreamW(int id) {
|
|
|
219
188
|
ResumeMusicStream(musicRegistry[id]);
|
|
220
189
|
}
|
|
221
190
|
|
|
222
|
-
void SeekMusicStreamW(int id,
|
|
191
|
+
void SeekMusicStreamW(int id, float position) {
|
|
223
192
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return;
|
|
224
|
-
|
|
225
|
-
memcpy(&f, &position, sizeof(float));
|
|
226
|
-
SeekMusicStream(musicRegistry[id], f);
|
|
193
|
+
SeekMusicStream(musicRegistry[id], position);
|
|
227
194
|
}
|
|
228
195
|
|
|
229
|
-
void SetMusicVolumeW(int id,
|
|
196
|
+
void SetMusicVolumeW(int id, float volume) {
|
|
230
197
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return;
|
|
231
|
-
|
|
232
|
-
memcpy(&f, &volume, sizeof(float));
|
|
233
|
-
SetMusicVolume(musicRegistry[id], f);
|
|
198
|
+
SetMusicVolume(musicRegistry[id], volume);
|
|
234
199
|
}
|
|
235
200
|
|
|
236
|
-
void SetMusicPitchW(int id,
|
|
201
|
+
void SetMusicPitchW(int id, float pitch) {
|
|
237
202
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return;
|
|
238
|
-
|
|
239
|
-
memcpy(&f, &pitch, sizeof(float));
|
|
240
|
-
SetMusicPitch(musicRegistry[id], f);
|
|
203
|
+
SetMusicPitch(musicRegistry[id], pitch);
|
|
241
204
|
}
|
|
242
205
|
|
|
243
|
-
void SetMusicPanW(int id,
|
|
206
|
+
void SetMusicPanW(int id, float pan) {
|
|
244
207
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return;
|
|
245
|
-
|
|
246
|
-
memcpy(&f, &pan, sizeof(float));
|
|
247
|
-
SetMusicPan(musicRegistry[id], f);
|
|
208
|
+
SetMusicPan(musicRegistry[id], pan);
|
|
248
209
|
}
|
|
249
210
|
|
|
250
|
-
|
|
211
|
+
float GetMusicTimeLengthW(int id) {
|
|
251
212
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return 0;
|
|
252
|
-
|
|
253
|
-
int i;
|
|
254
|
-
memcpy(&i, &f, sizeof(float));
|
|
255
|
-
return i;
|
|
213
|
+
return GetMusicTimeLength(musicRegistry[id]);
|
|
256
214
|
}
|
|
257
215
|
|
|
258
|
-
|
|
216
|
+
float GetMusicTimePlayedW(int id) {
|
|
259
217
|
if (id < 0 || id >= MAX_MUSIC || !musicUsed[id]) return 0;
|
|
260
|
-
|
|
261
|
-
int i;
|
|
262
|
-
memcpy(&i, &f, sizeof(float));
|
|
263
|
-
return i;
|
|
218
|
+
return GetMusicTimePlayed(musicRegistry[id]);
|
|
264
219
|
}
|
|
265
220
|
|
|
266
221
|
int LoadAudioStreamW(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels) {
|
|
@@ -311,29 +266,19 @@ void StopAudioStreamW(int id) {
|
|
|
311
266
|
StopAudioStream(audioStreamRegistry[id]);
|
|
312
267
|
}
|
|
313
268
|
|
|
314
|
-
void SetAudioStreamVolumeW(int id,
|
|
269
|
+
void SetAudioStreamVolumeW(int id, float volume) {
|
|
315
270
|
if (id < 0 || id >= MAX_AUDIOSTREAMS || !audioStreamUsed[id]) return;
|
|
316
|
-
|
|
317
|
-
memcpy(&f, &volume, sizeof(float));
|
|
318
|
-
SetAudioStreamVolume(audioStreamRegistry[id], f);
|
|
271
|
+
SetAudioStreamVolume(audioStreamRegistry[id], volume);
|
|
319
272
|
}
|
|
320
273
|
|
|
321
|
-
void SetAudioStreamPitchW(int id,
|
|
274
|
+
void SetAudioStreamPitchW(int id, float pitch) {
|
|
322
275
|
if (id < 0 || id >= MAX_AUDIOSTREAMS || !audioStreamUsed[id]) return;
|
|
323
|
-
|
|
324
|
-
memcpy(&f, &pitch, sizeof(float));
|
|
325
|
-
SetAudioStreamPitch(audioStreamRegistry[id], f);
|
|
276
|
+
SetAudioStreamPitch(audioStreamRegistry[id], pitch);
|
|
326
277
|
}
|
|
327
278
|
|
|
328
|
-
void SetAudioStreamPanW(int id,
|
|
279
|
+
void SetAudioStreamPanW(int id, float pan) {
|
|
329
280
|
if (id < 0 || id >= MAX_AUDIOSTREAMS || !audioStreamUsed[id]) return;
|
|
330
|
-
|
|
331
|
-
memcpy(&f, &pan, sizeof(float));
|
|
332
|
-
SetAudioStreamPan(audioStreamRegistry[id], f);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
void SetAudioStreamBufferSizeDefaultW(int size) {
|
|
336
|
-
SetAudioStreamBufferSizeDefault(size);
|
|
281
|
+
SetAudioStreamPan(audioStreamRegistry[id], pan);
|
|
337
282
|
}
|
|
338
283
|
|
|
339
284
|
float* LoadWaveSamplesW(int waveId) {
|
|
@@ -342,3 +287,18 @@ float* LoadWaveSamplesW(int waveId) {
|
|
|
342
287
|
}
|
|
343
288
|
|
|
344
289
|
void UnloadWaveSamplesW(float* samples) { UnloadWaveSamples(samples); }
|
|
290
|
+
|
|
291
|
+
void UpdateSoundW(int soundId, const void* data, int frameCount) {
|
|
292
|
+
if (soundId < 0 || soundId >= MAX_SOUNDS || !soundUsed[soundId]) return;
|
|
293
|
+
UpdateSound(soundRegistry[soundId], data, frameCount);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
void UpdateAudioStreamW(int streamId, const void* data, int frameCount) {
|
|
297
|
+
if (streamId < 0 || streamId >= MAX_AUDIOSTREAMS || !audioStreamUsed[streamId]) return;
|
|
298
|
+
UpdateAudioStream(audioStreamRegistry[streamId], data, frameCount);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
void SetAudioStreamCallbackW(int streamId, void* callback) {
|
|
302
|
+
if (streamId < 0 || streamId >= MAX_AUDIOSTREAMS || !audioStreamUsed[streamId]) return;
|
|
303
|
+
SetAudioStreamCallback(audioStreamRegistry[streamId], (AudioCallback)callback);
|
|
304
|
+
}
|