diff --git a/src/NPlug.Proxy/NPlug.Proxy.msbuildproj b/src/NPlug.Proxy/NPlug.Proxy.msbuildproj index 905012e..f3c759a 100644 --- a/src/NPlug.Proxy/NPlug.Proxy.msbuildproj +++ b/src/NPlug.Proxy/NPlug.Proxy.msbuildproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 false 2.0.1 diff --git a/src/NPlug.Proxy/build/NPlug.Proxy.targets b/src/NPlug.Proxy/build/NPlug.Proxy.targets index 4958bae..da79117 100644 --- a/src/NPlug.Proxy/build/NPlug.Proxy.targets +++ b/src/NPlug.Proxy/build/NPlug.Proxy.targets @@ -18,6 +18,10 @@ MacOS MacOS + true + true + true + .vst3 .dylib .so diff --git a/src/NPlug/Interop/LibVst.IBStream.cs b/src/NPlug/Interop/LibVst.IBStream.cs index beba5f9..e998485 100644 --- a/src/NPlug/Interop/LibVst.IBStream.cs +++ b/src/NPlug/Interop/LibVst.IBStream.cs @@ -14,6 +14,7 @@ public partial struct IBStream /// /// Reads binary data from stream. /// + /// /// : destination buffer /// : amount of bytes to be read /// : result - how many bytes have been read from stream (set to 0 if this is of no interest) @@ -58,7 +59,7 @@ internal static IBStreamClient GetStream(IBStream* state) } public IBStream* NativeStream { get; set; } - + public override void Flush() { } diff --git a/src/NPlug/Interop/LibVst.IPluginFactory.cs b/src/NPlug/Interop/LibVst.IPluginFactory.cs index 4811e31..d083f15 100644 --- a/src/NPlug/Interop/LibVst.IPluginFactory.cs +++ b/src/NPlug/Interop/LibVst.IPluginFactory.cs @@ -50,7 +50,7 @@ private static partial ComResult getClassInfo_ToManaged(IPluginFactory* self, in var pluginClassInfo = Get(self).GetPluginClassInfo(index); info->cid = pluginClassInfo.ClassId.ConvertToPlatform(); info->cardinality = pluginClassInfo.Cardinality; - CopyStringToUTF8(AudioEffectCategory, info->category, 32); + CopyStringToUTF8(GetPluginCategory(pluginClassInfo), info->category, 32); CopyStringToUTF8(pluginClassInfo.Name, info->name, 64); return true; } diff --git a/src/NPlug/NPlug.csproj b/src/NPlug/NPlug.csproj index a2ca591..662487a 100644 --- a/src/NPlug/NPlug.csproj +++ b/src/NPlug/NPlug.csproj @@ -22,6 +22,9 @@ true snupkg True + + + $(NoWarn);CS8981 diff --git a/src/NPlug/build/NPlug.targets b/src/NPlug/build/NPlug.targets index 4ca081e..db02aad 100644 --- a/src/NPlug/build/NPlug.targets +++ b/src/NPlug/build/NPlug.targets @@ -9,6 +9,15 @@ true + + $(RuntimeIdentifier) + $(NETCoreSdkRuntimeIdentifier) + + true + true + true + + @@ -45,11 +54,14 @@ false + + false + - + PreserveNewest false diff --git a/src/NPlug/build/NPlugFactoryExport.cs b/src/NPlug/build/NPlugFactoryExport.cs index 85657a1..dc71f76 100644 --- a/src/NPlug/build/NPlugFactoryExport.cs +++ b/src/NPlug/build/NPlugFactoryExport.cs @@ -9,7 +9,7 @@ namespace NPlug.Interop; /// /// This class is responsible for exporting the current registered factory in . /// -internal static class NPlugFactoryExport +internal static partial class NPlugFactoryExport { [UnmanagedCallersOnly(EntryPoint = nameof(GetPluginFactory))] private static nint GetPluginFactory() diff --git a/src/NPlug/build/NPlugFactoryExportMacOS.cs b/src/NPlug/build/NPlugFactoryExportMacOS.cs new file mode 100644 index 0000000..a93a6dc --- /dev/null +++ b/src/NPlug/build/NPlugFactoryExportMacOS.cs @@ -0,0 +1,47 @@ +// Copyright (c) Alexandre Mutel. All rights reserved. +// Licensed under the BSD-Clause 2 license. +// See license.txt file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace NPlug.Interop; + +/// +/// This class is responsible for exporting the current registered factory in . +/// +internal static partial class NPlugFactoryExport +{ + private static readonly List BundleRefs = []; + + [DllImport("/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/Resources/BridgeSupport/CoreFoundation.dylib")] + private static extern nint CFRetain(nint theArrayRef); + + [DllImport("/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/Resources/BridgeSupport/CoreFoundation.dylib")] + private static extern void CFRelease(nint theArrayRef); + + [UnmanagedCallersOnly(EntryPoint = nameof(bundleEntry))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Exported function required by VST3 API")] + // ReSharper disable once InconsistentNaming + private static bool bundleEntry(nint bundlePointer) + { + if (bundlePointer != 0) + { + BundleRefs.Add(CFRetain(bundlePointer)); + } + return true; + } + + [UnmanagedCallersOnly(EntryPoint = nameof(bundleExit))] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Exported function required by VST3 API")] + // ReSharper disable once InconsistentNaming + private static bool bundleExit(nint bundlePointer) + { + if (bundlePointer != 0) + { + BundleRefs.Remove(bundlePointer); + CFRelease(bundlePointer); + } + return BundleRefs.Count > 0; + } +} \ No newline at end of file