mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-01-03 21:15:37 +00:00
Fix my terrible LoadWAV signature
This commit is contained in:
parent
5966578e82
commit
0287457930
18
src/SDL2.cs
18
src/SDL2.cs
|
@ -7223,36 +7223,30 @@ namespace SDL2
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int SDL_GetNumAudioDrivers();
|
public static extern int SDL_GetNumAudioDrivers();
|
||||||
|
|
||||||
/* audio_buf will refer to a malloc()'d byte buffer */
|
/* audio_buf refers to a malloc()'d buffer, IntPtr to an SDL_AudioSpec* */
|
||||||
/* THIS IS AN RWops FUNCTION! */
|
/* THIS IS AN RWops FUNCTION! */
|
||||||
[DllImport(nativeLibName, EntryPoint = "SDL_LoadWAV_RW", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "SDL_LoadWAV_RW", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_SDL_LoadWAV_RW(
|
private static extern IntPtr INTERNAL_SDL_LoadWAV_RW(
|
||||||
IntPtr src,
|
IntPtr src,
|
||||||
int freesrc,
|
int freesrc,
|
||||||
ref SDL_AudioSpec spec,
|
out SDL_AudioSpec spec,
|
||||||
out IntPtr audio_buf,
|
out IntPtr audio_buf,
|
||||||
out uint audio_len
|
out uint audio_len
|
||||||
);
|
);
|
||||||
public static SDL_AudioSpec SDL_LoadWAV(
|
public static IntPtr SDL_LoadWAV(
|
||||||
string file,
|
string file,
|
||||||
ref SDL_AudioSpec spec,
|
out SDL_AudioSpec spec,
|
||||||
out IntPtr audio_buf,
|
out IntPtr audio_buf,
|
||||||
out uint audio_len
|
out uint audio_len
|
||||||
) {
|
) {
|
||||||
SDL_AudioSpec result;
|
|
||||||
IntPtr rwops = SDL_RWFromFile(file, "rb");
|
IntPtr rwops = SDL_RWFromFile(file, "rb");
|
||||||
IntPtr result_ptr = INTERNAL_SDL_LoadWAV_RW(
|
return INTERNAL_SDL_LoadWAV_RW(
|
||||||
rwops,
|
rwops,
|
||||||
1,
|
1,
|
||||||
ref spec,
|
out spec,
|
||||||
out audio_buf,
|
out audio_buf,
|
||||||
out audio_len
|
out audio_len
|
||||||
);
|
);
|
||||||
result = (SDL_AudioSpec) Marshal.PtrToStructure(
|
|
||||||
result_ptr,
|
|
||||||
typeof(SDL_AudioSpec)
|
|
||||||
);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
Loading…
Reference in a new issue