From c202ba42eaf9271f18b39280628bfc9b054eb0e7 Mon Sep 17 00:00:00 2001 From: "MINI\\jairo" Date: Sat, 28 Jun 2025 08:12:51 -0500 Subject: [PATCH] Add CS generated files for SDL_mixer --- .github/workflows/deploy.yml | 1 + SDL3-CS.sln | 6 + SDL3-CS/Properties/AssemblyInfo.cs | 1 + SDL3-CS/generate_bindings.py | 11 +- SDL3_mixer-CS/SDL3_mixer-CS.csproj | 94 ++++ .../SDL3_mixer/ClangSharp/SDL_mixer.g.cs | 444 ++++++++++++++++++ SDL3_mixer-CS/SDL3_mixer/SDL_mixer.cs | 13 + 7 files changed, 568 insertions(+), 2 deletions(-) create mode 100644 SDL3_mixer-CS/SDL3_mixer-CS.csproj create mode 100644 SDL3_mixer-CS/SDL3_mixer/ClangSharp/SDL_mixer.g.cs create mode 100644 SDL3_mixer-CS/SDL3_mixer/SDL_mixer.cs diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6bdcaf8..3177107 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,6 +33,7 @@ jobs: dotnet pack SDL3-CS/SDL3-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts dotnet pack SDL3_image-CS/SDL3_image-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts dotnet pack SDL3_ttf-CS/SDL3_ttf-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts + dotnet pack SDL3_mixer-CS/SDL3_mixer-CS.csproj -c Release /p:Version=$(git describe --exact-match --tags HEAD) -o artifacts - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/SDL3-CS.sln b/SDL3-CS.sln index ae0c151..63301ae 100644 --- a/SDL3-CS.sln +++ b/SDL3-CS.sln @@ -29,6 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_ttf-CS", "SDL3_ttf-CS\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SDL3_image-CS", "SDL3_image-CS\SDL3_image-CS.csproj", "{A0D6FC5F-BA26-4298-ABF0-234D2481E323}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3_mixer-CS", "SDL3_mixer-CS\SDL3_mixer-CS.csproj", "{421748C4-B51F-4B00-9637-566DBFD96E02}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -67,6 +69,10 @@ Global {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Debug|Any CPU.Build.0 = Debug|Any CPU {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0D6FC5F-BA26-4298-ABF0-234D2481E323}.Release|Any CPU.Build.0 = Release|Any CPU + {421748C4-B51F-4B00-9637-566DBFD96E02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {421748C4-B51F-4B00-9637-566DBFD96E02}.Debug|Any CPU.Build.0 = Debug|Any CPU + {421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.ActiveCfg = Release|Any CPU + {421748C4-B51F-4B00-9637-566DBFD96E02}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SDL3-CS/Properties/AssemblyInfo.cs b/SDL3-CS/Properties/AssemblyInfo.cs index 1572169..addb6e2 100644 --- a/SDL3-CS/Properties/AssemblyInfo.cs +++ b/SDL3-CS/Properties/AssemblyInfo.cs @@ -8,3 +8,4 @@ using System.Runtime.CompilerServices; // Allow access to internal CodeGen members (e.g. NativeTypeNameAttribute, etc.) for SDL sister projects: [assembly: InternalsVisibleTo("SDL3_ttf-CS")] [assembly: InternalsVisibleTo("SDL3_image-CS")] +[assembly: InternalsVisibleTo("SDL3_mixer-CS")] diff --git a/SDL3-CS/generate_bindings.py b/SDL3-CS/generate_bindings.py index 092cca3..ba1a941 100644 --- a/SDL3-CS/generate_bindings.py +++ b/SDL3-CS/generate_bindings.py @@ -36,11 +36,12 @@ unsafe_prefix = "Unsafe_" repository_root = pathlib.Path(__file__).resolve().parents[1] SDL_lib_root = "External" -SDL_libs = ["SDL", "SDL_image", "SDL_ttf"] +SDL_libs = ["SDL", "SDL_image", "SDL_ttf", "SDL_mixer"] SDL_lib_include_root = { "SDL3": SDL_lib_root + "/SDL/include", "SDL3_image": SDL_lib_root + "/SDL_image/include", - "SDL3_ttf": SDL_lib_root + "/SDL_ttf/include" + "SDL3_ttf": SDL_lib_root + "/SDL_ttf/include", + "SDL3_mixer": SDL_lib_root + "/SDL_mixer/include", } SDL3_header_base = "SDL3" # base folder of header files @@ -173,11 +174,16 @@ headers = [ add("SDL3_image/SDL_image.h"), add("SDL3_ttf/SDL_ttf.h"), add("SDL3_ttf/SDL_textengine.h"), + add("SDL3_mixer/SDL_mixer.h"), ] def prepare_sdl_source(): for lib in SDL_libs: + subprocess.run([ + "git", "config", "--global", "--add", "safe.directory", + repository_root / SDL_lib_root / lib + ]) subprocess.run([ "git", "reset", @@ -267,6 +273,7 @@ base_command = [ "--include-directory", repository_root / SDL_lib_include_root["SDL3"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_image"], "--include-directory", repository_root / SDL_lib_include_root["SDL3_ttf"], + "--include-directory", repository_root / SDL_lib_include_root["SDL3_mixer"], "--namespace", "SDL", "--remap", diff --git a/SDL3_mixer-CS/SDL3_mixer-CS.csproj b/SDL3_mixer-CS/SDL3_mixer-CS.csproj new file mode 100644 index 0000000..a7906d7 --- /dev/null +++ b/SDL3_mixer-CS/SDL3_mixer-CS.csproj @@ -0,0 +1,94 @@ + + + + net8.0 + SDL + enable + true + $(NoWarn);SYSLIB1054;CA1401 + + + + ppy Pty Ltd + ppy Pty Ltd + Copyright (c) 2024 ppy Pty Ltd + ppy.SDL3_mixer-CS + ppy.SDL3_mixer-CS + Automated release. + MIT + https://github.com/ppy/SDL3-CS + README_nuget.md + https://github.com/ppy/SDL3-CS + + + + + + + + + + + + + + runtimes/win-x64/native + true + + + runtimes/win-arm64/native + true + + + runtimes/win-x86/native + true + + + runtimes/osx-x64/native + true + + + runtimes/osx-arm64/native + true + + + runtimes/linux-x64/native + true + + + runtimes/linux-x86/native + true + + + runtimes/linux-arm64/native + true + + + runtimes/linux-arm/native + true + + + + + diff --git a/SDL3_mixer-CS/SDL3_mixer/ClangSharp/SDL_mixer.g.cs b/SDL3_mixer-CS/SDL3_mixer/ClangSharp/SDL_mixer.g.cs new file mode 100644 index 0000000..ae7b778 --- /dev/null +++ b/SDL3_mixer-CS/SDL3_mixer/ClangSharp/SDL_mixer.g.cs @@ -0,0 +1,444 @@ +/* + + C# bindings for Simple DirectMedia Layer. + Original copyright notice of input files: + + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace SDL +{ + public unsafe partial struct Mix_Chunk + { + public int allocated; + + [NativeTypeName("Uint8 *")] + public byte* abuf; + + [NativeTypeName("Uint32")] + public uint alen; + + [NativeTypeName("Uint8")] + public byte volume; + } + + public enum Mix_Fading + { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN, + } + + public enum Mix_MusicType + { + MUS_NONE, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_FLAC, + MUS_OPUS, + MUS_WAVPACK, + MUS_GME, + } + + public partial struct Mix_Music + { + } + + public static unsafe partial class SDL3_mixer + { + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_Version(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("MIX_InitFlags")] + public static extern uint Mix_Init([NativeTypeName("MIX_InitFlags")] uint flags); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_Quit(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_OpenAudio(SDL_AudioDeviceID devid, [NativeTypeName("const SDL_AudioSpec *")] SDL_AudioSpec* spec); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_PauseAudio(int pause_on); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_QuerySpec(int* frequency, SDL_AudioFormat* format, int* channels); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_AllocateChannels(int numchans); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Chunk* Mix_LoadWAV_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Chunk* Mix_LoadWAV([NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Music* Mix_LoadMUS([NativeTypeName("const char *")] byte* file); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Music* Mix_LoadMUS_IO(SDL_IOStream* src, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Music* Mix_LoadMUSType_IO(SDL_IOStream* src, Mix_MusicType type, [NativeTypeName("bool")] SDLBool closeio); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Chunk* Mix_QuickLoad_WAV([NativeTypeName("Uint8 *")] byte* mem); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Chunk* Mix_QuickLoad_RAW([NativeTypeName("Uint8 *")] byte* mem, [NativeTypeName("Uint32")] uint len); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_FreeChunk(Mix_Chunk* chunk); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_FreeMusic(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GetNumChunkDecoders(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetChunkDecoder(int index); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_HasChunkDecoder([NativeTypeName("const char *")] byte* name); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GetNumMusicDecoders(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicDecoder(int index); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_HasMusicDecoder([NativeTypeName("const char *")] byte* name); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_MusicType Mix_GetMusicType([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicTitle([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicTitleTag([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicArtistTag([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicAlbumTag([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetMusicCopyrightTag([NativeTypeName("const Mix_Music *")] Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_SetPostMix([NativeTypeName("Mix_MixCallback")] delegate* unmanaged[Cdecl] mix_func, [NativeTypeName("void*")] IntPtr arg); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_HookMusic([NativeTypeName("Mix_MixCallback")] delegate* unmanaged[Cdecl] mix_func, [NativeTypeName("void*")] IntPtr arg); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_HookMusicFinished([NativeTypeName("Mix_MusicFinishedCallback")] delegate* unmanaged[Cdecl] music_finished); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("void*")] + public static extern IntPtr Mix_GetMusicHookData(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_ChannelFinished([NativeTypeName("Mix_ChannelFinishedCallback")] delegate* unmanaged[Cdecl] channel_finished); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_RegisterEffect(int chan, [NativeTypeName("Mix_EffectFunc_t")] delegate* unmanaged[Cdecl] f, [NativeTypeName("Mix_EffectDone_t")] delegate* unmanaged[Cdecl] d, [NativeTypeName("void*")] IntPtr arg); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_UnregisterEffect(int channel, [NativeTypeName("Mix_EffectFunc_t")] delegate* unmanaged[Cdecl] f); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_UnregisterAllEffects(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetPanning(int channel, [NativeTypeName("Uint8")] byte left, [NativeTypeName("Uint8")] byte right); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetPosition(int channel, [NativeTypeName("Sint16")] short angle, [NativeTypeName("Uint8")] byte distance); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetDistance(int channel, [NativeTypeName("Uint8")] byte distance); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetReverseStereo(int channel, int flip); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_ReserveChannels(int num); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_GroupChannel(int which, int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_GroupChannels(int from, int to, int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GroupAvailable(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GroupCount(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GroupOldest(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GroupNewer(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_PlayChannel(int channel, Mix_Chunk* chunk, int loops); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_PlayChannelTimed(int channel, Mix_Chunk* chunk, int loops, int ticks); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_PlayMusic(Mix_Music* music, int loops); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_FadeInMusic(Mix_Music* music, int loops, int ms); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_FadeInMusicPos(Mix_Music* music, int loops, int ms, double position); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_FadeInChannel(int channel, Mix_Chunk* chunk, int loops, int ms); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_FadeInChannelTimed(int channel, Mix_Chunk* chunk, int loops, int ms, int ticks); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_Volume(int channel, int volume); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_VolumeChunk(Mix_Chunk* chunk, int volume); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_VolumeMusic(int volume); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GetMusicVolume(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_MasterVolume(int volume); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_HaltChannel(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_HaltGroup(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_HaltMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_ExpireChannel(int channel, int ticks); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_FadeOutChannel(int which, int ms); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_FadeOutGroup(int tag, int ms); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_FadeOutMusic(int ms); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Fading Mix_FadingMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Fading Mix_FadingChannel(int which); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_Pause(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_PauseGroup(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_Resume(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_ResumeGroup(int tag); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_Paused(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_PauseMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_ResumeMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_RewindMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_PausedMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_ModMusicJumpToOrder(int order); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_StartTrack(Mix_Music* music, int track); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_GetNumTracks(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetMusicPosition(double position); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double Mix_GetMusicPosition(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double Mix_MusicDuration(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double Mix_GetMusicLoopStartTime(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double Mix_GetMusicLoopEndTime(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern double Mix_GetMusicLoopLengthTime(Mix_Music* music); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int Mix_Playing(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_PlayingMusic(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetSoundFonts([NativeTypeName("const char *")] byte* paths); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetSoundFonts(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_EachSoundFont([NativeTypeName("Mix_EachSoundFontCallback")] delegate* unmanaged[Cdecl] function, [NativeTypeName("void*")] IntPtr data); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("bool")] + public static extern SDLBool Mix_SetTimidityCfg([NativeTypeName("const char *")] byte* path); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern byte* Mix_GetTimidityCfg(); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern Mix_Chunk* Mix_GetChunk(int channel); + + [DllImport("SDL3_mixer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void Mix_CloseAudio(); + + [NativeTypeName("#define SDL_MIXER_MAJOR_VERSION 3")] + public const int SDL_MIXER_MAJOR_VERSION = 3; + + [NativeTypeName("#define SDL_MIXER_MINOR_VERSION 0")] + public const int SDL_MIXER_MINOR_VERSION = 0; + + [NativeTypeName("#define SDL_MIXER_MICRO_VERSION 0")] + public const int SDL_MIXER_MICRO_VERSION = 0; + + [NativeTypeName("#define SDL_MIXER_VERSION SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_MICRO_VERSION)")] + public const int SDL_MIXER_VERSION = ((3) * 1000000 + (0) * 1000 + (0)); + + [NativeTypeName("#define MIX_INIT_FLAC 0x00000001")] + public const int MIX_INIT_FLAC = 0x00000001; + + [NativeTypeName("#define MIX_INIT_MOD 0x00000002")] + public const int MIX_INIT_MOD = 0x00000002; + + [NativeTypeName("#define MIX_INIT_MP3 0x00000008")] + public const int MIX_INIT_MP3 = 0x00000008; + + [NativeTypeName("#define MIX_INIT_OGG 0x00000010")] + public const int MIX_INIT_OGG = 0x00000010; + + [NativeTypeName("#define MIX_INIT_MID 0x00000020")] + public const int MIX_INIT_MID = 0x00000020; + + [NativeTypeName("#define MIX_INIT_OPUS 0x00000040")] + public const int MIX_INIT_OPUS = 0x00000040; + + [NativeTypeName("#define MIX_INIT_WAVPACK 0x00000080")] + public const int MIX_INIT_WAVPACK = 0x00000080; + + [NativeTypeName("#define MIX_CHANNELS 8")] + public const int MIX_CHANNELS = 8; + + [NativeTypeName("#define MIX_DEFAULT_FREQUENCY 44100")] + public const int MIX_DEFAULT_FREQUENCY = 44100; + + [NativeTypeName("#define MIX_DEFAULT_CHANNELS 2")] + public const int MIX_DEFAULT_CHANNELS = 2; + + [NativeTypeName("#define MIX_MAX_VOLUME 128")] + public const int MIX_MAX_VOLUME = 128; + + [NativeTypeName("#define MIX_CHANNEL_POST (-2)")] + public const int MIX_CHANNEL_POST = (-2); + + [NativeTypeName("#define MIX_EFFECTSMAXSPEED \"MIX_EFFECTSMAXSPEED\"")] + public static ReadOnlySpan MIX_EFFECTSMAXSPEED => "MIX_EFFECTSMAXSPEED"u8; + } +} diff --git a/SDL3_mixer-CS/SDL3_mixer/SDL_mixer.cs b/SDL3_mixer-CS/SDL3_mixer/SDL_mixer.cs new file mode 100644 index 0000000..0dff368 --- /dev/null +++ b/SDL3_mixer-CS/SDL3_mixer/SDL_mixer.cs @@ -0,0 +1,13 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using static SDL.SDL3; + +namespace SDL +{ + public static unsafe partial class SDL3_mixer + { + [Constant] + public static readonly SDL_AudioFormat MIX_DEFAULT_FORMAT = SDL_AUDIO_S16; + } +}