From be0fcded59c7895cb50e8f136a4a73aee489c186 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Sat, 23 Sep 2023 10:36:51 +0100 Subject: [PATCH] Split audio types into separate files --- Raylib-cs/types/Audio.cs | 122 --------------------------------- Raylib-cs/types/AudioStream.cs | 38 ++++++++++ Raylib-cs/types/Music.cs | 38 ++++++++++ Raylib-cs/types/Sound.cs | 21 ++++++ Raylib-cs/types/Wave.cs | 37 ++++++++++ 5 files changed, 134 insertions(+), 122 deletions(-) delete mode 100644 Raylib-cs/types/Audio.cs create mode 100644 Raylib-cs/types/AudioStream.cs create mode 100644 Raylib-cs/types/Music.cs create mode 100644 Raylib-cs/types/Sound.cs create mode 100644 Raylib-cs/types/Wave.cs diff --git a/Raylib-cs/types/Audio.cs b/Raylib-cs/types/Audio.cs deleted file mode 100644 index facf624..0000000 --- a/Raylib-cs/types/Audio.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Raylib_cs; - -/// -/// Wave type, defines audio wave data -/// -[StructLayout(LayoutKind.Sequential)] -public unsafe partial struct Wave -{ - /// - /// Number of samples - /// - public uint SampleCount; - - /// - /// Frequency (samples per second) - /// - public uint SampleRate; - - /// - /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) - /// - public uint SampleSize; - - /// - /// Number of channels (1-mono, 2-stereo) - /// - public uint Channels; - - //TODO: SPAN ? - /// - /// Buffer data pointer - /// - public void* Data; -} - -/// -/// Audio stream type
-/// NOTE: Useful to create custom audio streams not bound to a specific file -///
-[StructLayout(LayoutKind.Sequential)] -public partial struct AudioStream -{ - //TODO: convert - /// - /// Pointer to internal data(rAudioBuffer *) used by the audio system - /// - public IntPtr Buffer; - - /// - /// Pointer to internal data processor, useful for audio effects - /// - public IntPtr Processor; - - /// - /// Frequency (samples per second) - /// - public uint SampleRate; - - /// - /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) - /// - public uint SampleSize; - - /// - /// Number of channels (1-mono, 2-stereo) - /// - public uint Channels; -} - -/// -/// Sound source type -/// -[StructLayout(LayoutKind.Sequential)] -public partial struct Sound -{ - /// - /// Audio stream - /// - public AudioStream Stream; - - /// - /// Total number of frames (considering channels) - /// - public uint FrameCount; -} - -/// -/// Music stream type (audio file streaming from memory)
-/// NOTE: Anything longer than ~10 seconds should be streamed -///
-[StructLayout(LayoutKind.Sequential)] -public unsafe partial struct Music -{ - /// - /// Audio stream - /// - public AudioStream Stream; - - /// - /// Total number of samples - /// - public uint FrameCount; - - /// - /// Music looping enable - /// - public CBool Looping; - - /// - /// Type of music context (audio filetype) - /// - public int CtxType; - - //TODO span - /// - /// Audio context data, depends on type - /// - public void* CtxData; -} diff --git a/Raylib-cs/types/AudioStream.cs b/Raylib-cs/types/AudioStream.cs new file mode 100644 index 0000000..454a155 --- /dev/null +++ b/Raylib-cs/types/AudioStream.cs @@ -0,0 +1,38 @@ +using System; +using System.Runtime.InteropServices; + +namespace Raylib_cs; + +/// +/// Audio stream type
+/// NOTE: Useful to create custom audio streams not bound to a specific file +///
+[StructLayout(LayoutKind.Sequential)] +public partial struct AudioStream +{ + //TODO: convert + /// + /// Pointer to internal data(rAudioBuffer *) used by the audio system + /// + public IntPtr Buffer; + + /// + /// Pointer to internal data processor, useful for audio effects + /// + public IntPtr Processor; + + /// + /// Frequency (samples per second) + /// + public uint SampleRate; + + /// + /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) + /// + public uint SampleSize; + + /// + /// Number of channels (1-mono, 2-stereo) + /// + public uint Channels; +} diff --git a/Raylib-cs/types/Music.cs b/Raylib-cs/types/Music.cs new file mode 100644 index 0000000..d32c03d --- /dev/null +++ b/Raylib-cs/types/Music.cs @@ -0,0 +1,38 @@ +using System; +using System.Runtime.InteropServices; + +namespace Raylib_cs; + +/// +/// Music stream type (audio file streaming from memory)
+/// NOTE: Anything longer than ~10 seconds should be streamed +///
+[StructLayout(LayoutKind.Sequential)] +public unsafe partial struct Music +{ + /// + /// Audio stream + /// + public AudioStream Stream; + + /// + /// Total number of samples + /// + public uint FrameCount; + + /// + /// Music looping enable + /// + public CBool Looping; + + /// + /// Type of music context (audio filetype) + /// + public int CtxType; + + //TODO span + /// + /// Audio context data, depends on type + /// + public void* CtxData; +} diff --git a/Raylib-cs/types/Sound.cs b/Raylib-cs/types/Sound.cs new file mode 100644 index 0000000..ee40597 --- /dev/null +++ b/Raylib-cs/types/Sound.cs @@ -0,0 +1,21 @@ +using System; +using System.Runtime.InteropServices; + +namespace Raylib_cs; + +/// +/// Sound source type +/// +[StructLayout(LayoutKind.Sequential)] +public partial struct Sound +{ + /// + /// Audio stream + /// + public AudioStream Stream; + + /// + /// Total number of frames (considering channels) + /// + public uint FrameCount; +} diff --git a/Raylib-cs/types/Wave.cs b/Raylib-cs/types/Wave.cs new file mode 100644 index 0000000..ec27cf0 --- /dev/null +++ b/Raylib-cs/types/Wave.cs @@ -0,0 +1,37 @@ +using System; +using System.Runtime.InteropServices; + +namespace Raylib_cs; + +/// +/// Wave type, defines audio wave data +/// +[StructLayout(LayoutKind.Sequential)] +public unsafe partial struct Wave +{ + /// + /// Number of samples + /// + public uint SampleCount; + + /// + /// Frequency (samples per second) + /// + public uint SampleRate; + + /// + /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) + /// + public uint SampleSize; + + /// + /// Number of channels (1-mono, 2-stereo) + /// + public uint Channels; + + //TODO: SPAN ? + /// + /// Buffer data pointer + /// + public void* Data; +}