Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenAL extensions #602

Merged
merged 2 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Silk.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Silk.NET.OpenXR.Extensions.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TriangleNET6", "src\Lab\Experiments\TriangleNET6\TriangleNET6.csproj", "{477046D2-AF81-4E2B-83BD-20176A971FDD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.OpenAL.Tests", "src\OpenAL\Silk.NET.OpenAL.Tests\Silk.NET.OpenAL.Tests.csproj", "{514DED00-4DA3-46D1-B2E8-10CE826CD52D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -2705,6 +2707,18 @@ Global
{477046D2-AF81-4E2B-83BD-20176A971FDD}.Release|x64.Build.0 = Release|Any CPU
{477046D2-AF81-4E2B-83BD-20176A971FDD}.Release|x86.ActiveCfg = Release|Any CPU
{477046D2-AF81-4E2B-83BD-20176A971FDD}.Release|x86.Build.0 = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|x64.ActiveCfg = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|x64.Build.0 = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|x86.ActiveCfg = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Debug|x86.Build.0 = Debug|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|Any CPU.Build.0 = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|x64.ActiveCfg = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|x64.Build.0 = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|x86.ActiveCfg = Release|Any CPU
{514DED00-4DA3-46D1-B2E8-10CE826CD52D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2924,6 +2938,7 @@ Global
{AE5A7BBD-E303-46C4-9DDC-29E80C9128F5} = {90471225-AC23-424E-B62E-F6EC4C6ECAC0}
{0D1E5AD9-E329-4B84-A5FE-FC1EE33BF038} = {90471225-AC23-424E-B62E-F6EC4C6ECAC0}
{477046D2-AF81-4E2B-83BD-20176A971FDD} = {39B598E9-44BA-4A61-A1BB-7C543734DBA6}
{514DED00-4DA3-46D1-B2E8-10CE826CD52D} = {081E7761-B200-4DBF-8950-941464DECACE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F5273D7F-3334-48DF-94E3-41AE6816CD4D}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Silk.NET.Core/Native/NativeAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class NativeAPI : NativeApiContainer
public INativeContext Context { get; }

/// <inheritdoc />
protected NativeAPI(INativeContext ctx)
public NativeAPI(INativeContext ctx)
: base(ctx)
{
Context = ctx;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Silk.NET.Core/Native/NativeApiContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public abstract class NativeApiContainer : IDisposable
protected readonly INativeContext _ctx;
private IVTable _vTable;

protected NativeApiContainer(INativeContext ctx)
public NativeApiContainer(INativeContext ctx)
{
_ctx = ctx;
// Virtual member call should be fine unless we have a rogue implementer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Silk.NET.OpenAL.Extensions.Creative
/// <summary>
/// Exposes the functions of the Effects Extension.
/// </summary>
[Extension("AL_EXT_EFX")]
[Extension("ALC_EXT_EFX")] // the ALC_ prefix is misleading
[NativeApi(Prefix = "al")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You sure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely positive, it's frustrating and makes me sick to my stomach that this is correct but having looked over the official headers and based on feedback from our users this is correct.

public partial class EffectExtension : NativeExtension<AL>
{
/// <inheritdoc cref="ExtensionBase" />
protected EffectExtension(INativeContext ctx)
public EffectExtension(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Silk.NET.OpenAL.Extensions.Creative
/// <summary>
/// Exposes the context-related functions of the Effects Extension.
/// </summary>
[Extension("AL_EXT_EFX")]
[Extension("ALC_EXT_EFX")]
[NativeApi(Prefix = "alc")]
public partial class EffectExtensionContext : NativeExtension<AL>
public partial class EffectExtensionContext : NativeExtension<ALContext>
{
/// <inheritdoc cref="ExtensionBase" />
protected EffectExtensionContext(INativeContext ctx)
public EffectExtensionContext(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Silk.NET.OpenAL.Extensions.Creative
public partial class EnumerateAll : ContextExtensionBase
{
/// <inheritdoc cref="ExtensionBase" />
protected EnumerateAll(INativeContext ctx)
public EnumerateAll(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace Silk.NET.OpenAL.Extensions.Creative
/// <summary>
/// Exposes the multi-channel buffers extension by Creative Labs.
/// </summary>
[Extension("AL_EXT_EFX")]
[Extension("AL_EXT_MCFORMATS")]
[NativeApi(Prefix = "al")]
public partial class MultiChannelBuffers : FormatExtensionBase<MultiChannelBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected MultiChannelBuffers(INativeContext ctx)
public MultiChannelBuffers(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class XRam : NativeExtension<AL>
private readonly int _ramSize;

/// <inheritdoc cref="NativeLibraryBase" />
protected XRam(INativeContext ctx)
public XRam(INativeContext ctx)
: base(ctx)
{
_bufferStorageModeAutomatic = GetEnumValue("AL_STORAGE_AUTOMATIC");
Expand All @@ -38,6 +38,7 @@ protected XRam(INativeContext ctx)
}

/// <inheritdoc />
[NativeApi(Prefix = "al")]
public partial int GetInteger(int param);

/// <inheritdoc />
Expand Down Expand Up @@ -199,8 +200,11 @@ private BufferStorageMode GetEnumForValue(int value)
}

[return: UnmanagedType(UnmanagedType.I4)]
[NativeApi(Prefix = "al")]
public partial bool IsExtensionPresent(string name);
[NativeApi(Prefix = "al")]
public partial nint GetProcAddress(string name);
[NativeApi(Prefix = "al")]
public partial int GetEnumValue(string name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class ALAWFormat : FormatExtensionBase<ALAWBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected ALAWFormat(INativeContext ctx)
public ALAWFormat(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class Capture : ContextExtensionBase
{
/// <inheritdoc cref="ExtensionBase" />
protected Capture(INativeContext ctx)
public Capture(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class CaptureEnumerationEnumeration : ContextExtensionBase
{
/// <inheritdoc cref="ExtensionBase" />
protected CaptureEnumerationEnumeration(INativeContext ctx)
public CaptureEnumerationEnumeration(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class DoubleFormat : FormatExtensionBase<DoubleBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected DoubleFormat(INativeContext ctx)
public DoubleFormat(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class FloatFormat : FormatExtensionBase<FloatBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected FloatFormat(INativeContext ctx)
public FloatFormat(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Silk.NET.OpenAL.Native.Extensions.EXT
public partial class IMA4Format : FormatExtensionBase<IMA4BufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected IMA4Format(INativeContext ctx)
public IMA4Format(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class MP3Format : FormatExtensionBase<MP3BufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected MP3Format(INativeContext ctx)
public MP3Format(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class MULAWFormat : FormatExtensionBase<MULAWBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected MULAWFormat(INativeContext ctx)
public MULAWFormat(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Silk.NET.OpenAL.Extensions.EXT
public partial class VorbisFormat : FormatExtensionBase<VorbisBufferFormat>
{
/// <inheritdoc cref="ExtensionBase" />
protected VorbisFormat(INativeContext ctx)
public VorbisFormat(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Silk.NET.OpenAL.Extensions.Enumeration
public partial class Enumeration : ContextExtensionBase
{
/// <inheritdoc cref="ExtensionBase" />
protected Enumeration(INativeContext ctx)
public Enumeration(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Silk.NET.Core.Attributes;
using Silk.NET.Core.Contexts;
using Silk.NET.Core.Native;

Expand All @@ -10,10 +11,11 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// Exposes the public API of the OpenAL Soft Deferred Updates extension.
/// </summary>
[NativeApi(Prefix = "al")]
[Extension("AL_SOFT_deferred_updates")]
public partial class DeferredUpdates : NativeExtension<AL>
{
/// <inheritdoc cref="ExtensionBase" />
protected DeferredUpdates(INativeContext ctx)
public DeferredUpdates(INativeContext ctx)
: base(ctx)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// <summary>
/// A list of valid <see cref="IntPtr" /> <see cref="IStateSoft.GetPointer" /> parameters.
/// </summary>
public enum StatePointer
public enum SoftEventsPointer
{
/// <summary>
/// Gets a pointer to the set event callback function.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Silk.NET.OpenAL.Extensions.Soft
{
public enum SoftGainClampBoolean
{
/// <summary>
/// Determines whether or not the state has a gain limit set.
/// </summary>
HasGainLimit = 0x200E
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// A list of valid <see cref="double" /> <see cref="IStateSoft.GetDouble" /> parameters. These enumeration members
/// are defined as extensions in the OpenAL Soft library.
/// </summary>
public enum SoftStateDouble
public enum SoftGainClampDouble
{
/// <summary>
/// Gets the gain limit of the context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// A list of valid <see cref="double" /> <see cref="IStateSoft.GetFloat" /> parameters. These enumeration members
/// are defined as extensions in the OpenAL Soft library.
/// </summary>
public enum SoftStateFloat
public enum SoftGainClampFloat
{
/// <summary>
/// Gets the gain limit of the context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// A list of valid <see cref="bool" /> parameters for <see cref="IStateSoft.GetBoolean" />. These enumeration members
/// are defined as extensions in the OpenAL Soft library.
/// </summary>
public enum SoftStateBoolean
public enum SoftSourceResamplerBoolean
{
/// <summary>
/// Determines whether or not the state has a gain limit set.
/// </summary>
HasGainLimit = 0x200E,

/// <summary>
/// Determines whether or not the context has resamplers. Typically, this is always true.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Silk.NET.OpenAL.Extensions.Soft
/// <summary>
/// A list of valid <see cref="int" /> <see cref="IStateSoft.GetInteger" /> parameters.
/// </summary>
public enum SoftStateInteger
public enum SoftSourceResamplerInteger
{
/// <summary>
/// Gets the number of available resamplers.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Silk.NET.OpenAL.Extensions.Soft
{
/// <summary>
/// Strings for the AL_SOFT_source_resampler extension.
/// </summary>
public enum SoftSourceResamplerString
{
/// <summary>
/// The name of the resampler.
/// </summary>
ResamplerName = 0x1213
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Silk.NET.Core.Attributes;
using Silk.NET.Core.Contexts;
using Silk.NET.Core.Native;

namespace Silk.NET.OpenAL.Extensions.Soft
{
/// <summary>
/// Exposes the public API of functions added by OpenAL Soft.
/// </summary>
[NativeApi(Prefix = "al")]
[Extension("AL_SOFT_events")]
public partial class SoftEvents : NativeExtension<AL>
{
/// <inheritdoc cref="ExtensionBase" />
public SoftEvents(INativeContext ctx)
: base(ctx)
{
}

/// <inheritdoc />
[NativeApi(EntryPoint = "GetPointerSOFT")]
public partial nint GetPointer(SoftEventsPointer param);
}
}
Loading