2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-04-05 11:19:39 -04:00

Changed MusicData back to IntPtr.

- MusicData struct is not easy to marshall. The struct layout changes based on what file formats
raylib is compiled with.
This commit is contained in:
ChrisDill 2019-07-14 12:11:07 +01:00 committed by Chris Dill
parent 87c9be0884
commit 1bb0a35c54

View File

@ -311,11 +311,6 @@ namespace Raylib
public int format; // Audio format specifier public int format; // Audio format specifier
} }
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public partial struct MusicData
{
}
// Audio stream type // Audio stream type
// NOTE: Useful to create custom audio streams not bound to a specific file // NOTE: Useful to create custom audio streams not bound to a specific file
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
@ -329,7 +324,7 @@ namespace Raylib
public uint source; // Audio source id public uint source; // Audio source id
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public uint[] buffers; // Audio buffers (double buffering) public uint[] buffers; // Audio buffers (double buffering)
} }
// Head-Mounted-Display device parameters // Head-Mounted-Display device parameters
@ -346,15 +341,16 @@ namespace Raylib
public float interpupillaryDistance; // HMD IPD (distance between pupils) in meters public float interpupillaryDistance; // HMD IPD (distance between pupils) in meters
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public float[] lensDistortionValues; // HMD lens distortion constant parameters public float[] lensDistortionValues; // HMD lens distortion constant parameters
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public float[] chromaAbCorrection; // HMD chromatic aberration correction parameters public float[] chromaAbCorrection; // HMD chromatic aberration correction parameters
} }
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// Enumerators Definition // Enumerators Definition
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// System config flags // System config flags
// NOTE: Used for bit masks // NOTE: Used for bit masks
public enum ConfigFlag public enum ConfigFlag
@ -2444,56 +2440,56 @@ namespace Raylib
// Load music stream from file // Load music stream from file
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern MusicData LoadMusicStream(string fileName); public static extern IntPtr LoadMusicStream(string fileName);
// Unload music stream // Unload music stream
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadMusicStream(MusicData music); public static extern void UnloadMusicStream(IntPtr music);
// Start music playing // Start music playing
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void PlayMusicStream(MusicData music); public static extern void PlayMusicStream(IntPtr music);
// Updates buffers for music streaming // Updates buffers for music streaming
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdateMusicStream(MusicData music); public static extern void UpdateMusicStream(IntPtr music);
// Stop music playing // Stop music playing
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void StopMusicStream(MusicData music); public static extern void StopMusicStream(IntPtr music);
// Pause music playing // Pause music playing
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void PauseMusicStream(MusicData music); public static extern void PauseMusicStream(IntPtr music);
// Resume playing paused music // Resume playing paused music
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ResumeMusicStream(MusicData music); public static extern void ResumeMusicStream(IntPtr music);
// Check if music is playing // Check if music is playing
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)] [return: MarshalAs(UnmanagedType.I1)]
public static extern bool IsMusicPlaying(MusicData music); public static extern bool IsMusicPlaying(IntPtr music);
// Set volume for music (1.0 is max level) // Set volume for music (1.0 is max level)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMusicVolume(MusicData music, float volume); public static extern void SetMusicVolume(IntPtr music, float volume);
// Set pitch for a music (1.0 is base level) // Set pitch for a music (1.0 is base level)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMusicPitch(MusicData music, float pitch); public static extern void SetMusicPitch(IntPtr music, float pitch);
// Set music loop count (loop repeats) // Set music loop count (loop repeats)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetMusicLoopCount(MusicData music, int count); public static extern void SetMusicLoopCount(IntPtr music, int count);
// Get music time length (in seconds) // Get music time length (in seconds)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetMusicTimeLength(MusicData music); public static extern float GetMusicTimeLength(IntPtr music);
// Get current music time played (in seconds) // Get current music time played (in seconds)
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetMusicTimePlayed(MusicData music); public static extern float GetMusicTimePlayed(IntPtr music);
// AudioStream management functions // AudioStream management functions