Decompiled source of AudioImportLib v1.3.0
Mods/AudioImportLib.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using AudioImportLib; using CSCore; using CSCore.Codecs; using CSCore.Codecs.AAC; using CSCore.Codecs.AIFF; using CSCore.Codecs.FLAC; using CSCore.Codecs.FLAC.Metadata; using CSCore.Codecs.MP3; using CSCore.Codecs.OGG; using CSCore.Codecs.WAV; using CSCore.CoreAudioAPI; using CSCore.DMO; using CSCore.DMO.Effects; using CSCore.DSP; using CSCore.DirectSound; using CSCore.MediaFoundation; using CSCore.SoundIn; using CSCore.SoundOut; using CSCore.SoundOut.MMInterop; using CSCore.Streams; using CSCore.Streams.SampleConverter; using CSCore.Tags.ID3; using CSCore.Tags.ID3.Frames; using CSCore.Utils; using CSCore.Utils.Buffer; using CSCore.Win32; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using NLayer; using NLayer.Decoder; using NVorbis; using NVorbis.Contracts; using NVorbis.Contracts.Ogg; using NVorbis.Ogg; using Un4seen.Bass; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AudioImportLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany(null)] [assembly: AssemblyProduct("AudioImportLib")] [assembly: AssemblyCopyright("Created by trev & zCubed")] [assembly: AssemblyTrademark(null)] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: MelonInfo(typeof(Core), "AudioImportLib", "1.0.0", "trev & zCubed", null)] [assembly: MelonGame(null, null)] [assembly: MelonPriority(1000)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Un4seen.Bass { [SuppressUnmanagedCodeSecurity] public sealed class Bass { private static object _mutex; private static bool _usesMF; private static bool _usesCA; public static string SupportedStreamExtensions; public static string SupportedStreamName; public static string SupportedMusicExtensions; internal static bool _configUTF8; public const int BASSVERSION = 516; public const int FALSE = 0; public const int TRUE = 1; public const int ERROR = -1; private static int _myModuleHandle; private const string _myModuleName = "bass"; public static bool UsesMediaFoundation => _usesMF; public static bool UsesCoreAudio => _usesCA; static Bass() { _mutex = new object(); _usesMF = false; _usesCA = false; SupportedStreamExtensions = "*.mp3;*.ogg;*.wav;*.mp2;*.mp1;*.aiff;*.m2a;*.mpa;*.m1a;*.mpg;*.mpeg;*.aif;*.mp3pro;*.bwf;*.mus"; SupportedStreamName = "WAV/AIFF/MP3/MP2/MP1/OGG"; SupportedMusicExtensions = "*.mod;*.mo3;*.s3m;*.xm;*.it;*.mtm;*.umx;*.mdz;*.s3z;*.itz;*.xmz"; _configUTF8 = false; _myModuleHandle = 0; string text = string.Empty; try { text = new StackFrame(1).GetMethod().Name; } catch { } if (!text.Equals("LoadMe")) { InitBass(); } } private static void InitBass() { if (!BassNet.OmitCheckVersion) { CheckVersion(); } _configUTF8 = BASS_SetConfig(BASSConfig.BASS_CONFIG_UNICODE, 1) || Environment.OSVersion.Platform > PlatformID.WinCE; try { if (BASS_GetVersion() >= 33818624 && Environment.OSVersion.Platform == PlatformID.MacOSX) { _usesCA = true; SupportedStreamExtensions += ";*.aac;*.adts;*.mp4;*.m4a;*.m4b;*.m4p;*.ac3;*.caf;*.mov"; SupportedStreamName += "/AAC/MP4/AC3/CAF"; } } catch { } try { if (BASS_GetVersion() >= 33818624 && Environment.OSVersion.Platform <= PlatformID.WinCE && File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "mfreadwrite.dll"))) { _usesMF = true; SupportedStreamExtensions += ";*.wma;*.wmv;*.aac;*.adts;*.mp4;*.m4a;*.m4b;*.m4p"; SupportedStreamName += "/WMA/AAC/MP4"; } else if (BASS_GetVersion() >= 33818624 && Environment.OSVersion.Platform == PlatformID.MacOSX) { _usesCA = true; SupportedStreamExtensions += ";*.aac;*.adts;*.mp4;*.m4a;*.m4b;*.m4p;*.ac3;*.caf;*.mov"; SupportedStreamName += "/AAC/MP4/AC3/CAF"; } } catch { } } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_Init(int device, int freq, BASSInit flags, IntPtr win, IntPtr clsid); public static bool BASS_Init(int device, int freq, BASSInit flags, IntPtr win) { return BASS_Init(device, freq, flags, win, IntPtr.Zero); } [DllImport("bass", EntryPoint = "BASS_Init")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_InitGuid(int device, int freq, BASSInit flags, IntPtr win, [MarshalAs(UnmanagedType.LPStruct)] Guid clsid); public static bool BASS_Init(int device, int freq, BASSInit flags, IntPtr win, Guid clsid) { if (clsid == Guid.Empty) { return BASS_Init(device, freq, flags, win, IntPtr.Zero); } return BASS_InitGuid(device, freq, flags, win, clsid); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_IsStarted(); [DllImport("bass", EntryPoint = "BASS_GetDeviceInfo")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_GetDeviceInfoInternal([In] int device, [In][Out] ref BASS_DEVICEINFO_INTERNAL info); public unsafe static bool BASS_GetDeviceInfo(int device, BASS_DEVICEINFO info) { bool flag = BASS_GetDeviceInfoInternal(device, ref info._internal); if (flag) { if (_configUTF8) { info.name = Utils.IntPtrAsStringUtf8(info._internal.name, out var len); info.driver = Utils.IntPtrAsStringUtf8(info._internal.driver, out len); if (len > 0 && BASS_GetVersion() > 33818624 && Environment.OSVersion.Platform < PlatformID.WinCE) { try { info.id = Utils.IntPtrAsStringUtf8(new IntPtr((byte*)info._internal.driver.ToPointer() + len + 1), out len); } catch { } } } else { info.name = Utils.IntPtrAsStringAnsi(info._internal.name); info.driver = Utils.IntPtrAsStringAnsi(info._internal.driver); if (!string.IsNullOrEmpty(info.driver) && BASS_GetVersion() > 33818624 && Environment.OSVersion.Platform < PlatformID.WinCE) { try { info.id = Utils.IntPtrAsStringAnsi(new IntPtr((byte*)info._internal.driver.ToPointer() + info.driver.Length + 1)); } catch { } } } info.flags = info._internal.flags; } return flag; } public static BASS_DEVICEINFO BASS_GetDeviceInfo(int device) { BASS_DEVICEINFO bASS_DEVICEINFO = new BASS_DEVICEINFO(); if (BASS_GetDeviceInfo(device, bASS_DEVICEINFO)) { return bASS_DEVICEINFO; } return null; } public static BASS_DEVICEINFO[] BASS_GetDeviceInfos() { List<BASS_DEVICEINFO> list = new List<BASS_DEVICEINFO>(); int num = 0; BASS_DEVICEINFO item; while ((item = BASS_GetDeviceInfo(num)) != null) { list.Add(item); num++; } BASS_GetCPU(); return list.ToArray(); } public static int BASS_GetDeviceCount() { BASS_DEVICEINFO info = new BASS_DEVICEINFO(); int i; for (i = 0; BASS_GetDeviceInfo(i, info); i++) { } BASS_GetCPU(); return i; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_GetInfo([In][Out] BASS_INFO info); public static BASS_INFO BASS_GetInfo() { BASS_INFO bASS_INFO = new BASS_INFO(); if (BASS_GetInfo(bASS_INFO)) { return bASS_INFO; } return null; } [DllImport("bass")] public static extern BASSError BASS_ErrorGetCode(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Stop(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Free(); [DllImport("bass")] public static extern int BASS_GetVersion(); public static Version BASS_GetVersion(int fieldcount) { if (fieldcount < 1) { fieldcount = 1; } if (fieldcount > 4) { fieldcount = 4; } int num = BASS_GetVersion(); Version result = new Version(2, 3); switch (fieldcount) { case 1: result = new Version((num >> 24) & 0xFF, 0); break; case 2: result = new Version((num >> 24) & 0xFF, (num >> 16) & 0xFF); break; case 3: result = new Version((num >> 24) & 0xFF, (num >> 16) & 0xFF, (num >> 8) & 0xFF); break; case 4: result = new Version((num >> 24) & 0xFF, (num >> 16) & 0xFF, (num >> 8) & 0xFF, num & 0xFF); break; } return result; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetDevice(int device); [DllImport("bass")] public static extern int BASS_GetDevice(); [DllImport("bass")] public static extern IntPtr BASS_GetDSoundObject(int handle); [DllImport("bass")] public static extern IntPtr BASS_GetDSoundObject(BASSDirectSound dsobject); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Update(int length); [DllImport("bass")] public static extern float BASS_GetCPU(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Start(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Pause(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetVolume(float volume); [DllImport("bass")] public static extern float BASS_GetVolume(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetConfig(BASSConfig option, int newvalue); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetConfig(BASSConfig option, [In][MarshalAs(UnmanagedType.Bool)] bool newvalue); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetConfigPtr(BASSConfig option, IntPtr newvalue); [DllImport("bass", EntryPoint = "BASS_SetConfigPtr")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_SetConfigStringUnicode(BASSConfig option, [In][MarshalAs(UnmanagedType.LPWStr)] string newvalue); public static bool BASS_SetConfigString(BASSConfig option, string newvalue) { return BASS_SetConfigStringUnicode(option | (BASSConfig)(-2147483648), newvalue); } [DllImport("bass")] public static extern int BASS_GetConfig(BASSConfig option); [DllImport("bass", EntryPoint = "BASS_GetConfig")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_GetConfigBool(BASSConfig option); [DllImport("bass")] public static extern IntPtr BASS_GetConfigPtr(BASSConfig option); public static string BASS_GetConfigString(BASSConfig option) { return Utils.IntPtrAsStringUnicode(BASS_GetConfigPtr(option | (BASSConfig)(-2147483648))); } [DllImport("bass", EntryPoint = "BASS_PluginLoad")] private static extern int BASS_PluginLoadUnicode([In][MarshalAs(UnmanagedType.LPWStr)] string file, BASSFlag flags); public static int BASS_PluginLoad(string file) { return BASS_PluginLoadUnicode(file, BASSFlag.BASS_UNICODE); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_PluginFree(int handle); public static Dictionary<int, string> BASS_PluginLoadDirectory(string dir) { return BASS_PluginLoadDirectory(dir, null); } public static Dictionary<int, string> BASS_PluginLoadDirectory(string dir, List<string> exclude) { Dictionary<int, string> dictionary = new Dictionary<int, string>(); string[] files = Directory.GetFiles(dir, "bass*.dll"); if (files == null || files.Length == 0) { files = Directory.GetFiles(dir, "libbass*.so"); } if (files == null || files.Length == 0) { files = Directory.GetFiles(dir, "libbass*.dylib"); } if (files != null) { string[] array = files; string[] array2 = array; foreach (string text in array2) { if (exclude != null) { string fn = Path.GetFileNameWithoutExtension(text); if (exclude.Find((string f) => f.ToLower().Contains(fn.ToLower())) != null) { continue; } } int num = BASS_PluginLoad(text); if (num != 0) { dictionary.Add(num, text); } } } BASS_GetCPU(); if (dictionary.Count > 0) { return dictionary; } return null; } [DllImport("bass", EntryPoint = "BASS_PluginGetInfo")] private static extern IntPtr BASS_PluginGetInfoPtr(int handle); public static BASS_PLUGININFO BASS_PluginGetInfo(int handle) { if (handle != 0) { IntPtr intPtr = BASS_PluginGetInfoPtr(handle); if (intPtr != IntPtr.Zero) { bass_plugininfo bass_plugininfo2 = (bass_plugininfo)Marshal.PtrToStructure(intPtr, typeof(bass_plugininfo)); return new BASS_PLUGININFO(bass_plugininfo2.version, bass_plugininfo2.formatc, bass_plugininfo2.formats); } return null; } if (_usesMF) { BASS_PLUGINFORM[] formats = new BASS_PLUGINFORM[16] { new BASS_PLUGINFORM("WAVE Audio", "*.wav", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("Ogg Vorbis", "*.ogg", BASSChannelType.BASS_CTYPE_STREAM_OGG), new BASS_PLUGINFORM("MPEG Layer 1", "*.mp1;*.m1a", BASSChannelType.BASS_CTYPE_STREAM_MP1), new BASS_PLUGINFORM("MPEG Layer 2", "*.mp2;*.m2a;*.mpa;*.mus", BASSChannelType.BASS_CTYPE_STREAM_MP2), new BASS_PLUGINFORM("MPEG Layer 3", "*.mp3;*.mpg;*.mpeg;*.mp3pro", BASSChannelType.BASS_CTYPE_STREAM_MP3), new BASS_PLUGINFORM("Audio IFF", "*.aif;*.aiff", BASSChannelType.BASS_CTYPE_STREAM_AIFF), new BASS_PLUGINFORM("Broadcast Wave", "*.bwf", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("Windows Media Audio", "*.wma;*.wmv", BASSChannelType.BASS_CTYPE_STREAM_WMA), new BASS_PLUGINFORM("Advanced Audio Codec", "*.aac;*.adts", BASSChannelType.BASS_CTYPE_STREAM_AAC), new BASS_PLUGINFORM("MPEG 4 Audio", "*.mp4;*.m4a;*.m4b;*.m4p", BASSChannelType.BASS_CTYPE_STREAM_MP4), new BASS_PLUGINFORM("MOD Music", "*.mod;*.mdz", BASSChannelType.BASS_CTYPE_MUSIC_MOD), new BASS_PLUGINFORM("MO3 Music", "*.mo3", BASSChannelType.BASS_CTYPE_MUSIC_MO3), new BASS_PLUGINFORM("S3M Music", "*.s3m;*.s3z", BASSChannelType.BASS_CTYPE_MUSIC_S3M), new BASS_PLUGINFORM("XM Music", "*.xm;*.xmz", BASSChannelType.BASS_CTYPE_MUSIC_XM), new BASS_PLUGINFORM("IT Music", "*.it;*.itz;*.umx", BASSChannelType.BASS_CTYPE_MUSIC_IT), new BASS_PLUGINFORM("MTM Music", "*.mtm", BASSChannelType.BASS_CTYPE_MUSIC_MTM) }; return new BASS_PLUGININFO(BASS_GetVersion(), formats); } if (_usesCA) { BASS_PLUGINFORM[] formats2 = new BASS_PLUGINFORM[18] { new BASS_PLUGINFORM("WAVE Audio", "*.wav", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("Ogg Vorbis", "*.ogg", BASSChannelType.BASS_CTYPE_STREAM_OGG), new BASS_PLUGINFORM("MPEG Layer 1", "*.mp1;*.m1a", BASSChannelType.BASS_CTYPE_STREAM_MP1), new BASS_PLUGINFORM("MPEG Layer 2", "*.mp2;*.m2a;*.mpa;*.mus", BASSChannelType.BASS_CTYPE_STREAM_MP2), new BASS_PLUGINFORM("MPEG Layer 3", "*.mp3;*.mpg;*.mpeg;*.mp3pro", BASSChannelType.BASS_CTYPE_STREAM_MP3), new BASS_PLUGINFORM("Audio IFF", "*.aif;*.aiff", BASSChannelType.BASS_CTYPE_STREAM_AIFF), new BASS_PLUGINFORM("Broadcast Wave", "*.bwf", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("Advanced Audio Codec", "*.aac;*.adts", BASSChannelType.BASS_CTYPE_STREAM_AAC), new BASS_PLUGINFORM("MPEG 4 Audio", "*.mp4;*.m4a;*.m4b;*.m4p", BASSChannelType.BASS_CTYPE_STREAM_MP4), new BASS_PLUGINFORM("AC-3 Dolby Digital", "*.ac3", BASSChannelType.BASS_CTYPE_STREAM_AC3), new BASS_PLUGINFORM("Apple Lossless Audio", "*.mp4;*.m4a;*.m4b;*.m4p;*.mov", BASSChannelType.BASS_CTYPE_STREAM_ALAC), new BASS_PLUGINFORM("Apple Core Audio", "*.caf", BASSChannelType.BASS_CTYPE_STREAM_CA), new BASS_PLUGINFORM("MOD Music", "*.mod;*.mdz", BASSChannelType.BASS_CTYPE_MUSIC_MOD), new BASS_PLUGINFORM("MO3 Music", "*.mo3", BASSChannelType.BASS_CTYPE_MUSIC_MO3), new BASS_PLUGINFORM("S3M Music", "*.s3m;*.s3z", BASSChannelType.BASS_CTYPE_MUSIC_S3M), new BASS_PLUGINFORM("XM Music", "*.xm;*.xmz", BASSChannelType.BASS_CTYPE_MUSIC_XM), new BASS_PLUGINFORM("IT Music", "*.it;*.itz;*.umx", BASSChannelType.BASS_CTYPE_MUSIC_IT), new BASS_PLUGINFORM("MTM Music", "*.mtm", BASSChannelType.BASS_CTYPE_MUSIC_MTM) }; return new BASS_PLUGININFO(BASS_GetVersion(), formats2); } BASS_PLUGINFORM[] formats3 = new BASS_PLUGINFORM[13] { new BASS_PLUGINFORM("WAVE Audio", "*.wav", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("Ogg Vorbis", "*.ogg", BASSChannelType.BASS_CTYPE_STREAM_OGG), new BASS_PLUGINFORM("MPEG Layer 1", "*.mp1;*.m1a", BASSChannelType.BASS_CTYPE_STREAM_MP1), new BASS_PLUGINFORM("MPEG Layer 2", "*.mp2;*.m2a;*.mpa;*.mus", BASSChannelType.BASS_CTYPE_STREAM_MP2), new BASS_PLUGINFORM("MPEG Layer 3", "*.mp3;*.mpg;*.mpeg;*.mp3pro", BASSChannelType.BASS_CTYPE_STREAM_MP3), new BASS_PLUGINFORM("Audio IFF", "*.aif;*.aiff", BASSChannelType.BASS_CTYPE_STREAM_AIFF), new BASS_PLUGINFORM("Broadcast Wave", "*.bwf", BASSChannelType.BASS_CTYPE_STREAM_WAV), new BASS_PLUGINFORM("MOD Music", "*.mod;*.mdz", BASSChannelType.BASS_CTYPE_MUSIC_MOD), new BASS_PLUGINFORM("MO3 Music", "*.mo3", BASSChannelType.BASS_CTYPE_MUSIC_MO3), new BASS_PLUGINFORM("S3M Music", "*.s3m;*.s3z", BASSChannelType.BASS_CTYPE_MUSIC_S3M), new BASS_PLUGINFORM("XM Music", "*.xm;*.xmz", BASSChannelType.BASS_CTYPE_MUSIC_XM), new BASS_PLUGINFORM("IT Music", "*.it;*.itz;*.umx", BASSChannelType.BASS_CTYPE_MUSIC_IT), new BASS_PLUGINFORM("MTM Music", "*.mtm", BASSChannelType.BASS_CTYPE_MUSIC_MTM) }; return new BASS_PLUGININFO(BASS_GetVersion(), formats3); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_GetEAXParameters(ref EAXEnvironment env, ref float vol, ref float decay, ref float damp); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_GetEAXParameters([In][Out][MarshalAs(UnmanagedType.AsAny)] object env, [In][Out][MarshalAs(UnmanagedType.AsAny)] object vol, [In][Out][MarshalAs(UnmanagedType.AsAny)] object decay, [In][Out][MarshalAs(UnmanagedType.AsAny)] object damp); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SetEAXParameters(EAXEnvironment env, float vol, float decay, float damp); public static bool BASS_SetEAXParameters(EAXPreset preset) { bool result = false; switch (preset) { case EAXPreset.EAX_PRESET_GENERIC: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_GENERIC, 0.5f, 1.493f, 0.5f); break; case EAXPreset.EAX_PRESET_PADDEDCELL: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_PADDEDCELL, 0.25f, 0.1f, 0f); break; case EAXPreset.EAX_PRESET_ROOM: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_ROOM, 0.417f, 0.4f, 0.666f); break; case EAXPreset.EAX_PRESET_BATHROOM: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_BATHROOM, 0.653f, 1.499f, 0.166f); break; case EAXPreset.EAX_PRESET_LIVINGROOM: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_LIVINGROOM, 0.208f, 0.478f, 0f); break; case EAXPreset.EAX_PRESET_STONEROOM: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_STONEROOM, 0.5f, 2.309f, 0.888f); break; case EAXPreset.EAX_PRESET_AUDITORIUM: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_AUDITORIUM, 0.403f, 4.279f, 0.5f); break; case EAXPreset.EAX_PRESET_CONCERTHALL: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_CONCERTHALL, 0.5f, 3.961f, 0.5f); break; case EAXPreset.EAX_PRESET_CAVE: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_CAVE, 0.5f, 2.886f, 1.304f); break; case EAXPreset.EAX_PRESET_ARENA: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_ARENA, 0.361f, 7.284f, 0.332f); break; case EAXPreset.EAX_PRESET_HANGAR: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_HANGAR, 0.5f, 10f, 0.3f); break; case EAXPreset.EAX_PRESET_CARPETEDHALLWAY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153f, 0.259f, 2f); break; case EAXPreset.EAX_PRESET_HALLWAY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_HALLWAY, 0.361f, 1.493f, 0f); break; case EAXPreset.EAX_PRESET_STONECORRIDOR: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_STONECORRIDOR, 0.444f, 2.697f, 0.638f); break; case EAXPreset.EAX_PRESET_ALLEY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_ALLEY, 0.25f, 1.752f, 0.776f); break; case EAXPreset.EAX_PRESET_FOREST: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_FOREST, 0.111f, 3.145f, 0.472f); break; case EAXPreset.EAX_PRESET_CITY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_CITY, 0.111f, 2.767f, 0.224f); break; case EAXPreset.EAX_PRESET_MOUNTAINS: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_MOUNTAINS, 0.194f, 7.841f, 0.472f); break; case EAXPreset.EAX_PRESET_QUARRY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_QUARRY, 1f, 1.499f, 0.5f); break; case EAXPreset.EAX_PRESET_PLAIN: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_PLAIN, 0.097f, 2.767f, 0.224f); break; case EAXPreset.EAX_PRESET_PARKINGLOT: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_PARKINGLOT, 0.208f, 1.652f, 1.5f); break; case EAXPreset.EAX_PRESET_SEWERPIPE: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_SEWERPIPE, 0.652f, 2.886f, 0.25f); break; case EAXPreset.EAX_PRESET_UNDERWATER: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_UNDERWATER, 1f, 1.499f, 0f); break; case EAXPreset.EAX_PRESET_DRUGGED: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_DRUGGED, 0.875f, 8.392f, 1.388f); break; case EAXPreset.EAX_PRESET_DIZZY: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_DIZZY, 0.139f, 17.234f, 0.666f); break; case EAXPreset.EAX_PRESET_PSYCHOTIC: result = BASS_SetEAXParameters(EAXEnvironment.EAX_ENVIRONMENT_PSYCHOTIC, 0.486f, 7.563f, 0.806f); break; } return result; } [DllImport("bass")] public static extern void BASS_Apply3D(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Set3DFactors(float distf, float rollf, float doppf); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Get3DFactors(ref float distf, ref float rollf, ref float doppf); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Get3DFactors([In][Out][MarshalAs(UnmanagedType.AsAny)] object distf, [In][Out][MarshalAs(UnmanagedType.AsAny)] object rollf, [In][Out][MarshalAs(UnmanagedType.AsAny)] object doppf); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Set3DPosition([In] BASS_3DVECTOR pos, [In] BASS_3DVECTOR vel, [In] BASS_3DVECTOR front, [In] BASS_3DVECTOR top); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_Get3DPosition([In][Out] BASS_3DVECTOR pos, [In][Out] BASS_3DVECTOR vel, [In][Out] BASS_3DVECTOR front, [In][Out] BASS_3DVECTOR top); [DllImport("bass", EntryPoint = "BASS_SampleLoad")] private static extern int BASS_SampleLoadUnicode([MarshalAs(UnmanagedType.Bool)] bool mem, [In][MarshalAs(UnmanagedType.LPWStr)] string file, long offset, int length, int max, BASSFlag flags); public static int BASS_SampleLoad(string file, long offset, int length, int max, BASSFlag flags) { flags |= BASSFlag.BASS_UNICODE; return BASS_SampleLoadUnicode(mem: false, file, offset, length, max, flags); } [DllImport("bass", EntryPoint = "BASS_SampleLoad")] private static extern int BASS_SampleLoadMemory([MarshalAs(UnmanagedType.Bool)] bool mem, IntPtr memory, long offset, int length, int max, BASSFlag flags); public static int BASS_SampleLoad(IntPtr memory, long offset, int length, int max, BASSFlag flags) { return BASS_SampleLoadMemory(mem: true, memory, offset, length, max, flags); } [DllImport("bass", EntryPoint = "BASS_SampleLoad")] private static extern int BASS_SampleLoadMemory([MarshalAs(UnmanagedType.Bool)] bool mem, byte[] memory, long offset, int length, int max, BASSFlag flags); public static int BASS_SampleLoad(byte[] memory, long offset, int length, int max, BASSFlag flags) { return BASS_SampleLoadMemory(mem: true, memory, offset, length, max, flags); } [DllImport("bass")] public static extern int BASS_SampleCreate(int length, int freq, int chans, int max, BASSFlag flags); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetData(int handle, IntPtr buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetData(int handle, float[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetData(int handle, int[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetData(int handle, short[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetData(int handle, byte[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetData(int handle, IntPtr buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetData(int handle, float[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetData(int handle, int[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetData(int handle, short[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetData(int handle, byte[] buffer); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleFree(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleGetInfo(int handle, [In][Out] BASS_SAMPLE info); public static BASS_SAMPLE BASS_SampleGetInfo(int handle) { BASS_SAMPLE bASS_SAMPLE = new BASS_SAMPLE(); if (BASS_SampleGetInfo(handle, bASS_SAMPLE)) { return bASS_SAMPLE; } return null; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleSetInfo(int handle, [In] BASS_SAMPLE info); [DllImport("bass")] public static extern int BASS_SampleGetChannel(int handle, [MarshalAs(UnmanagedType.Bool)] bool onlynew); [DllImport("bass")] public static extern int BASS_SampleGetChannels(int handle, int[] channels); public static int[] BASS_SampleGetChannels(int handle) { int[] array = new int[BASS_SampleGetInfo(handle).max]; int num = BASS_SampleGetChannels(handle, array); if (num >= 0) { int[] array2 = new int[num]; Array.Copy(array, array2, num); return array2; } return null; } public static int BASS_SampleGetChannelCount(int handle) { return BASS_SampleGetChannels(handle, null); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_SampleStop(int handle); [DllImport("bass")] public static extern int BASS_StreamCreate(int freq, int chans, BASSFlag flags, STREAMPROC proc, IntPtr user); [DllImport("bass", EntryPoint = "BASS_StreamCreate")] private static extern int BASS_StreamCreatePtr(int freq, int chans, BASSFlag flags, IntPtr procPtr, IntPtr user); public static int BASS_StreamCreate(int freq, int chans, BASSFlag flags, BASSStreamProc proc) { return BASS_StreamCreatePtr(freq, chans, flags, new IntPtr((int)proc), IntPtr.Zero); } public static int BASS_StreamCreateDummy(int freq, int chans, BASSFlag flags, IntPtr user) { return BASS_StreamCreatePtr(freq, chans, flags, IntPtr.Zero, user); } public static int BASS_StreamCreatePush(int freq, int chans, BASSFlag flags, IntPtr user) { return BASS_StreamCreatePtr(freq, chans, flags, new IntPtr(-1), user); } public static int BASS_StreamCreateDevice(int freq, int chans, BASSFlag flags, IntPtr user) { return BASS_StreamCreatePtr(freq, chans, flags, new IntPtr(-2), user); } public static int BASS_StreamCreateDevice3D(int freq, int chans, BASSFlag flags, IntPtr user) { return BASS_StreamCreatePtr(freq, chans, flags, new IntPtr(-3), user); } [DllImport("bass")] public static extern int BASS_StreamCreateFileUser(BASSStreamSystem system, BASSFlag flags, BASS_FILEPROCS procs, IntPtr user); [DllImport("bass", EntryPoint = "BASS_StreamCreateFile")] private static extern int BASS_StreamCreateFileUnicode([MarshalAs(UnmanagedType.Bool)] bool mem, [In][MarshalAs(UnmanagedType.LPWStr)] string file, long offset, long length, BASSFlag flags); public static int BASS_StreamCreateFile(string file, long offset, long length, BASSFlag flags) { flags |= BASSFlag.BASS_UNICODE; return BASS_StreamCreateFileUnicode(mem: false, file, offset, length, flags); } [DllImport("bass", EntryPoint = "BASS_StreamCreateFile")] private static extern int BASS_StreamCreateFileMemory([MarshalAs(UnmanagedType.Bool)] bool mem, IntPtr memory, long offset, long length, BASSFlag flags); public static int BASS_StreamCreateFile(IntPtr memory, long offset, long length, BASSFlag flags) { return BASS_StreamCreateFileMemory(mem: true, memory, offset, length, flags); } [DllImport("bass", EntryPoint = "BASS_StreamCreateURL")] private static extern int BASS_StreamCreateURLUnicode([In][MarshalAs(UnmanagedType.LPWStr)] string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user); [DllImport("bass", CharSet = CharSet.Ansi, EntryPoint = "BASS_StreamCreateURL")] private static extern int BASS_StreamCreateURLAscii([In][MarshalAs(UnmanagedType.LPStr)] string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user); public static int BASS_StreamCreateURL(string url, int offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user) { flags |= BASSFlag.BASS_UNICODE; int num = BASS_StreamCreateURLUnicode(url, offset, flags, proc, user); if (num == 0) { flags &= BASSFlag.BASS_SPEAKER_PAIR15 | BASSFlag.BASS_SAMPLE_OVER_DIST | BASSFlag.BASS_AC3_DOWNMIX_DOLBY | BASSFlag.BASS_SAMPLE_8BITS | BASSFlag.BASS_SAMPLE_MONO | BASSFlag.BASS_SAMPLE_LOOP | BASSFlag.BASS_SAMPLE_3D | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_MUTEMAX | BASSFlag.BASS_SAMPLE_VAM | BASSFlag.BASS_SAMPLE_FX | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_RECORD_PAUSE | BASSFlag.BASS_RECORD_ECHOCANCEL | BASSFlag.BASS_RECORD_AGC | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_STREAM_RESTRATE | BASSFlag.BASS_STREAM_BLOCK | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_SPEAKER_LEFT | BASSFlag.BASS_SPEAKER_RIGHT | BASSFlag.BASS_ASYNCFILE | BASSFlag.BASS_WV_STEREO | BASSFlag.BASS_AC3_DYNAMIC_RANGE | BASSFlag.BASS_AAC_FRAME960; num = BASS_StreamCreateURLAscii(url, offset, flags, proc, user); } return num; } [DllImport("bass")] public static extern long BASS_StreamGetFilePosition(int handle, BASSStreamFilePosition mode); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_StreamFree(int handle); [DllImport("bass")] public static extern int BASS_StreamPutData(int handle, IntPtr buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutData(int handle, float[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutData(int handle, int[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutData(int handle, short[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutData(int handle, byte[] buffer, int length); public unsafe static int BASS_StreamPutData(int handle, byte[] buffer, int startIdx, int length) { fixed (byte* value = &buffer[startIdx]) { return BASS_StreamPutData(handle, new IntPtr(value), length); } } [DllImport("bass")] public static extern int BASS_StreamPutFileData(int handle, IntPtr buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutFileData(int handle, float[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutFileData(int handle, int[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutFileData(int handle, short[] buffer, int length); [DllImport("bass")] public static extern int BASS_StreamPutFileData(int handle, byte[] buffer, int length); [DllImport("bass", EntryPoint = "BASS_MusicLoad")] private static extern int BASS_MusicLoadUnicode([MarshalAs(UnmanagedType.Bool)] bool mem, [In][MarshalAs(UnmanagedType.LPWStr)] string file, long offset, int length, BASSFlag flags, int freq); public static int BASS_MusicLoad(string file, long offset, int length, BASSFlag flags, int freq) { flags |= BASSFlag.BASS_UNICODE; return BASS_MusicLoadUnicode(mem: false, file, offset, length, flags, freq); } [DllImport("bass", EntryPoint = "BASS_MusicLoad")] private static extern int BASS_MusicLoadMemory([MarshalAs(UnmanagedType.Bool)] bool mem, IntPtr memory, long offset, int length, BASSFlag flags, int freq); public static int BASS_MusicLoad(IntPtr memory, long offset, int length, BASSFlag flags, int freq) { return BASS_MusicLoadMemory(mem: true, memory, offset, length, flags, freq); } [DllImport("bass", EntryPoint = "BASS_MusicLoad")] private static extern int BASS_MusicLoadMemory([MarshalAs(UnmanagedType.Bool)] bool mem, byte[] memory, long offset, int length, BASSFlag flags, int freq); public static int BASS_MusicLoad(byte[] memory, long offset, int length, BASSFlag flags, int freq) { return BASS_MusicLoadMemory(mem: true, memory, offset, length, flags, freq); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_MusicFree(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_RecordInit(int device); [DllImport("bass")] public static extern int BASS_RecordStart(int freq, int chans, BASSFlag flags, RECORDPROC proc, IntPtr user); public static int BASS_RecordStart(int freq, int chans, BASSFlag flags, int period, RECORDPROC proc, IntPtr user) { return BASS_RecordStart(freq, chans, (BASSFlag)Utils.MakeLong((int)flags, period), proc, user); } [DllImport("bass", EntryPoint = "BASS_RecordGetDeviceInfo")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_RecordGetDeviceInfoInternal([In] int device, [In][Out] ref BASS_DEVICEINFO_INTERNAL info); public unsafe static bool BASS_RecordGetDeviceInfo(int device, BASS_DEVICEINFO info) { bool flag = BASS_RecordGetDeviceInfoInternal(device, ref info._internal); if (flag) { if (_configUTF8) { info.name = Utils.IntPtrAsStringUtf8(info._internal.name, out var len); info.driver = Utils.IntPtrAsStringUtf8(info._internal.driver, out len); if (len > 0 && BASS_GetVersion() > 33818624) { try { info.id = Utils.IntPtrAsStringUtf8(new IntPtr((byte*)info._internal.driver.ToPointer() + len + 1), out len); } catch { } } } else { info.name = Utils.IntPtrAsStringAnsi(info._internal.name); info.driver = Utils.IntPtrAsStringAnsi(info._internal.driver); if (!string.IsNullOrEmpty(info.driver) && BASS_GetVersion() > 33818624) { try { info.id = Utils.IntPtrAsStringAnsi(new IntPtr((byte*)info._internal.driver.ToPointer() + info.driver.Length + 1)); } catch { } } } info.flags = info._internal.flags; } return flag; } public static BASS_DEVICEINFO BASS_RecordGetDeviceInfo(int device) { BASS_DEVICEINFO bASS_DEVICEINFO = new BASS_DEVICEINFO(); if (BASS_RecordGetDeviceInfo(device, bASS_DEVICEINFO)) { return bASS_DEVICEINFO; } return null; } public static BASS_DEVICEINFO[] BASS_RecordGetDeviceInfos() { List<BASS_DEVICEINFO> list = new List<BASS_DEVICEINFO>(); int num = 0; BASS_DEVICEINFO item; while ((item = BASS_RecordGetDeviceInfo(num)) != null) { list.Add(item); num++; } BASS_GetCPU(); return list.ToArray(); } public static int BASS_RecordGetDeviceCount() { BASS_DEVICEINFO info = new BASS_DEVICEINFO(); int i; for (i = 0; BASS_RecordGetDeviceInfo(i, info); i++) { } BASS_GetCPU(); return i; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_RecordSetDevice(int device); [DllImport("bass")] public static extern int BASS_RecordGetDevice(); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_RecordGetInfo([In][Out] BASS_RECORDINFO info); public static BASS_RECORDINFO BASS_RecordGetInfo() { BASS_RECORDINFO bASS_RECORDINFO = new BASS_RECORDINFO(); if (BASS_RecordGetInfo(bASS_RECORDINFO)) { return bASS_RECORDINFO; } return null; } [DllImport("bass", EntryPoint = "BASS_RecordGetInputName")] private static extern IntPtr BASS_RecordGetInputNamePtr(int input); public static string BASS_RecordGetInputName(int input) { IntPtr intPtr = BASS_RecordGetInputNamePtr(input); if (intPtr != IntPtr.Zero) { if (_configUTF8 && BASS_GetVersion() >= 33819150) { return Utils.IntPtrAsStringUtf8(intPtr); } return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string[] BASS_RecordGetInputNames() { List<string> list = new List<string>(); int num = 0; string item; while ((item = BASS_RecordGetInputName(num)) != null) { list.Add(item); num++; } BASS_GetCPU(); return list.ToArray(); } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_RecordSetInput(int input, BASSInput setting, float volume); [DllImport("bass")] public static extern int BASS_RecordGetInput(int input, ref float volume); public static BASSInput BASS_RecordGetInput(int input) { int num = BASS_RecordGetInputPtr(input, IntPtr.Zero); if (num != -1) { return (BASSInput)(num & 0xFF0000); } return BASSInput.BASS_INPUT_NONE; } [DllImport("bass", EntryPoint = "BASS_RecordGetInput")] private static extern int BASS_RecordGetInputPtr(int input, IntPtr vol); public static BASSInputType BASS_RecordGetInputType(int input) { int num = BASS_RecordGetInputPtr(input, IntPtr.Zero); if (num != -1) { return (BASSInputType)(num & -16777216); } return BASSInputType.BASS_INPUT_TYPE_ERROR; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_RecordFree(); [DllImport("bass", EntryPoint = "BASS_ChannelGetInfo")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_ChannelGetInfoInternal(int handle, [In][Out] ref BASS_CHANNELINFO_INTERNAL info); public static bool BASS_ChannelGetInfo(int handle, BASS_CHANNELINFO info) { bool flag = BASS_ChannelGetInfoInternal(handle, ref info._internal); if (flag) { info.chans = info._internal.chans; info.ctype = info._internal.ctype; info.flags = info._internal.flags; info.freq = info._internal.freq; info.origres = info._internal.origres & 0xFFFF; info.origresIsFloat = (info._internal.origres & 0x10000) == 65536; info.plugin = info._internal.plugin; info.sample = info._internal.sample; if (((uint)info.flags & 0x80000000u) != 0) { info.filename = Marshal.PtrToStringUni(info._internal.filename); return flag; } if (_configUTF8 || Environment.OSVersion.Platform > PlatformID.WinCE) { info.filename = Utils.IntPtrAsStringUtf8(info._internal.filename); return flag; } info.filename = Utils.IntPtrAsStringAnsi(info._internal.filename); } return flag; } public static BASS_CHANNELINFO BASS_ChannelGetInfo(int handle) { BASS_CHANNELINFO bASS_CHANNELINFO = new BASS_CHANNELINFO(); if (BASS_ChannelGetInfo(handle, bASS_CHANNELINFO)) { return bASS_CHANNELINFO; } return null; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelPlay(int handle, [MarshalAs(UnmanagedType.Bool)] bool restart); [DllImport("bass")] public static extern int BASS_ChannelSetDSP(int handle, DSPPROC proc, IntPtr user, int priority); [DllImport("bass")] public static extern int BASS_ChannelGetData(int handle, IntPtr buffer, int length); [DllImport("bass")] public static extern int BASS_ChannelGetData(int handle, [In][Out] float[] buffer, int length); [DllImport("bass")] public static extern int BASS_ChannelGetData(int handle, [In][Out] short[] buffer, int length); [DllImport("bass")] public static extern int BASS_ChannelGetData(int handle, [In][Out] int[] buffer, int length); [DllImport("bass")] public static extern int BASS_ChannelGetData(int handle, [In][Out] byte[] buffer, int length); [DllImport("bass")] public static extern long BASS_ChannelSeconds2Bytes(int handle, double pos); [DllImport("bass")] public static extern double BASS_ChannelBytes2Seconds(int handle, long pos); [DllImport("bass")] public static extern BASSActive BASS_ChannelIsActive(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelLock(int handle, [MarshalAs(UnmanagedType.Bool)] bool state); [DllImport("bass")] public static extern long BASS_ChannelGetLength(int handle, BASSMode mode); public static long BASS_ChannelGetLength(int handle) { return BASS_ChannelGetLength(handle, BASSMode.BASS_POS_BYTE); } [DllImport("bass")] public static extern int BASS_ChannelSetSync(int handle, BASSSync type, long param, SYNCPROC proc, IntPtr user); [DllImport("bass")] public static extern int BASS_ChannelSetFX(int handle, BASSFXType type, int priority); [DllImport("bass")] public static extern int BASS_ChannelGetDevice(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSetDevice(int handle, int device); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelStop(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelPause(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSetAttribute(int handle, BASSAttribute attrib, float value); [DllImport("bass", EntryPoint = "BASS_ChannelSetAttributeEx")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSetAttribute(int handle, BASSAttribute attrib, IntPtr value, int size); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelGetAttribute(int handle, BASSAttribute attrib, ref float value); [DllImport("bass", EntryPoint = "BASS_ChannelGetAttributeEx")] public static extern int BASS_ChannelGetAttribute(int handle, BASSAttribute attrib, IntPtr value, int size); [DllImport("bass")] public static extern BASSFlag BASS_ChannelFlags(int handle, BASSFlag flags, BASSFlag mask); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelUpdate(int handle, int length); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelIsSliding(int handle, BASSAttribute attrib); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSlideAttribute(int handle, BASSAttribute attrib, float value, int time); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSet3DAttributes(int handle, BASS3DMode mode, float min, float max, int iangle, int oangle, int outvol); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelGet3DAttributes(int handle, ref BASS3DMode mode, ref float min, ref float max, ref int iangle, ref int oangle, ref int outvol); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelGet3DAttributes(int handle, [In][Out][MarshalAs(UnmanagedType.AsAny)] object mode, [In][Out][MarshalAs(UnmanagedType.AsAny)] object min, [In][Out][MarshalAs(UnmanagedType.AsAny)] object max, [In][Out][MarshalAs(UnmanagedType.AsAny)] object iangle, [In][Out][MarshalAs(UnmanagedType.AsAny)] object oangle, [In][Out][MarshalAs(UnmanagedType.AsAny)] object outvol); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSet3DPosition(int handle, [In] BASS_3DVECTOR pos, [In] BASS_3DVECTOR orient, [In] BASS_3DVECTOR vel); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelGet3DPosition(int handle, [In][Out] BASS_3DVECTOR pos, [In][Out] BASS_3DVECTOR orient, [In][Out] BASS_3DVECTOR vel); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSetPosition(int handle, long pos, BASSMode mode); public static bool BASS_ChannelSetPosition(int handle, long pos) { return BASS_ChannelSetPosition(handle, pos, BASSMode.BASS_POS_BYTE); } public static bool BASS_ChannelSetPosition(int handle, double seconds) { return BASS_ChannelSetPosition(handle, BASS_ChannelSeconds2Bytes(handle, seconds), BASSMode.BASS_POS_BYTE); } public static bool BASS_ChannelSetPosition(int handle, int order, int row) { return BASS_ChannelSetPosition(handle, Utils.MakeLong(order, row), BASSMode.BASS_POS_MUSIC_ORDERS); } [DllImport("bass")] public static extern long BASS_ChannelGetPosition(int handle, BASSMode mode); public static long BASS_ChannelGetPosition(int handle) { return BASS_ChannelGetPosition(handle, BASSMode.BASS_POS_BYTE); } [DllImport("bass")] public static extern int BASS_ChannelGetLevel(int handle); [DllImport("bass", EntryPoint = "BASS_ChannelGetLevelEx")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelGetLevel(int handle, [In][Out] float[] levels, float length, BASSLevel flags); public static float[] BASS_ChannelGetLevels(int handle, float length = 0.02f, BASSLevel flags = BASSLevel.BASS_LEVEL_ALL) { BASS_CHANNELINFO bASS_CHANNELINFO = BASS_ChannelGetInfo(handle); if (bASS_CHANNELINFO != null) { int num = bASS_CHANNELINFO.chans; if ((flags & BASSLevel.BASS_LEVEL_MONO) == BASSLevel.BASS_LEVEL_MONO) { num = 1; } else if ((flags & BASSLevel.BASS_LEVEL_STEREO) == BASSLevel.BASS_LEVEL_STEREO) { num = 2; } float[] array = new float[num]; if (BASS_ChannelGetLevel(handle, array, length, flags)) { return array; } return null; } return null; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelRemoveSync(int handle, int sync); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelRemoveDSP(int handle, int dsp); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelRemoveFX(int handle, int fx); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelSetLink(int handle, int chan); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_ChannelRemoveLink(int handle, int chan); [DllImport("bass")] public static extern IntPtr BASS_ChannelGetTags(int handle, BASSTag tags); public static string[] BASS_ChannelGetTagsArrayNullTermAnsi(int handle, BASSTag format) { return Utils.IntPtrToArrayNullTermAnsi(BASS_ChannelGetTags(handle, format)); } public static string[] BASS_ChannelGetTagsArrayNullTermUtf8(int handle, BASSTag format) { return Utils.IntPtrToArrayNullTermUtf8(BASS_ChannelGetTags(handle, format)); } public static string[] BASS_ChannelGetTagsID3V1(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_ID3); if (intPtr != IntPtr.Zero) { string[] array = new string[7]; try { BASS_TAG_ID3 bASS_TAG_ID = (BASS_TAG_ID3)Marshal.PtrToStructure(intPtr, typeof(BASS_TAG_ID3)); array[0] = bASS_TAG_ID.Title; array[1] = bASS_TAG_ID.Artist; array[2] = bASS_TAG_ID.Album; array[3] = bASS_TAG_ID.Year; array[4] = bASS_TAG_ID.Comment; array[5] = bASS_TAG_ID.Genre.ToString(); if (bASS_TAG_ID.Dummy == 0) { array[6] = bASS_TAG_ID.Track.ToString(); return array; } return array; } catch { return array; } } return null; } public static string[] BASS_ChannelGetTagsBWF(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_RIFF_BEXT); if (intPtr != IntPtr.Zero) { string[] array = new string[9]; try { BASS_TAG_BEXT bASS_TAG_BEXT = (BASS_TAG_BEXT)Marshal.PtrToStructure(intPtr, typeof(BASS_TAG_BEXT)); array[0] = bASS_TAG_BEXT.Description; array[1] = bASS_TAG_BEXT.Originator; array[2] = bASS_TAG_BEXT.OriginatorReference; array[3] = bASS_TAG_BEXT.OriginationDate; array[4] = bASS_TAG_BEXT.OriginationTime; array[5] = bASS_TAG_BEXT.TimeReference.ToString(); array[6] = bASS_TAG_BEXT.Version.ToString(); array[7] = bASS_TAG_BEXT.UMID; array[8] = bASS_TAG_BEXT.GetCodingHistory(intPtr); return array; } catch { return array; } } return null; } public static BASS_TAG_CACODEC BASS_ChannelGetTagsCA(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_WMA_META); if (intPtr != IntPtr.Zero) { return new BASS_TAG_CACODEC(intPtr); } return null; } public static string BASS_ChannelGetTagsDSDArtist(int handle) { return Utils.IntPtrAsStringAnsi(BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_DSD_ARTIST)); } public static string BASS_ChannelGetTagsDSDTitle(int handle) { return Utils.IntPtrAsStringAnsi(BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_DSD_TITLE)); } public static BASS_TAG_DSD_COMMENT[] BASS_ChannelGetTagsDSDComments(int handle) { List<BASS_TAG_DSD_COMMENT> list = new List<BASS_TAG_DSD_COMMENT>(); int num = 0; BASS_TAG_DSD_COMMENT tag; while ((tag = BASS_TAG_DSD_COMMENT.GetTag(handle, num)) != null) { list.Add(tag); num++; } if (list.Count > 0) { return list.ToArray(); } return null; } public static string[] BASS_ChannelGetTagsID3V2(int handle) { return null; } public static string[] BASS_ChannelGetTagsAPE(int handle) { return BASS_ChannelGetTagsArrayNullTermUtf8(handle, BASSTag.BASS_TAG_APE); } public static BASS_TAG_APE_BINARY[] BASS_ChannelGetTagsAPEBinary(int handle) { List<BASS_TAG_APE_BINARY> list = new List<BASS_TAG_APE_BINARY>(); int num = 0; BASS_TAG_APE_BINARY tag; while ((tag = BASS_TAG_APE_BINARY.GetTag(handle, num)) != null) { list.Add(tag); num++; } if (list.Count > 0) { return list.ToArray(); } return null; } public static string[] BASS_ChannelGetTagsWMA(int handle) { return BASS_ChannelGetTagsArrayNullTermUtf8(handle, BASSTag.BASS_TAG_WMA); } public static string[] BASS_ChannelGetTagsMP4(int handle) { return BASS_ChannelGetTagsArrayNullTermUtf8(handle, BASSTag.BASS_TAG_MP4); } public static string[] BASS_ChannelGetTagsMF(int handle) { return BASS_ChannelGetTagsArrayNullTermUtf8(handle, BASSTag.BASS_TAG_MF); } public static WAVEFORMATEXT BASS_ChannelGetTagsWAVEFORMAT(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_WAVEFORMAT); if (intPtr != IntPtr.Zero) { return new WAVEFORMATEXT(intPtr); } return null; } public static BASS_TAG_FLAC_PICTURE[] BASS_ChannelGetTagsFLACPictures(int handle) { List<BASS_TAG_FLAC_PICTURE> list = new List<BASS_TAG_FLAC_PICTURE>(); int num = 0; BASS_TAG_FLAC_PICTURE tag; while ((tag = BASS_TAG_FLAC_PICTURE.GetTag(handle, num)) != null) { list.Add(tag); num++; } if (list.Count > 0) { return list.ToArray(); } return null; } public static BASS_TAG_FLAC_CUE BASS_ChannelGetTagsFLACCuesheet(int handle) { return BASS_TAG_FLAC_CUE.GetTag(handle); } public static string[] BASS_ChannelGetTagsHTTP(int handle) { return BASS_ChannelGetTagsArrayNullTermAnsi(handle, BASSTag.BASS_TAG_HTTP); } public static string[] BASS_ChannelGetTagsICY(int handle) { return BASS_ChannelGetTagsArrayNullTermAnsi(handle, BASSTag.BASS_TAG_ICY); } public static string[] BASS_ChannelGetTagsOGG(int handle) { return BASS_ChannelGetTagsArrayNullTermUtf8(handle, BASSTag.BASS_TAG_OGG); } public static string[] BASS_ChannelGetTagsRIFF(int handle) { return BASS_ChannelGetTagsArrayNullTermAnsi(handle, BASSTag.BASS_TAG_RIFF_INFO); } public static BASS_TAG_CUE BASS_ChannelGetTagsRIFFCUE(int handle) { return BASS_TAG_CUE.GetTag(handle); } public static string[] BASS_ChannelGetTagsMETA(int handle) { return Utils.IntPtrToArrayNullTermAnsi(BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_META)); } public static string BASS_ChannelGetTagLyrics3v2(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_LYRICS3); if (intPtr != IntPtr.Zero) { return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string BASS_ChannelGetMusicName(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_MUSIC_NAME); if (intPtr != IntPtr.Zero) { return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string BASS_ChannelGetMusicMessage(int handle) { IntPtr intPtr = BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_MUSIC_MESSAGE); if (intPtr != IntPtr.Zero) { return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string BASS_ChannelGetMusicInstrument(int handle, int instrument) { IntPtr intPtr = BASS_ChannelGetTags(handle, (BASSTag)(65792 + instrument)); if (intPtr != IntPtr.Zero) { return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string BASS_ChannelGetMusicSample(int handle, int sample) { IntPtr intPtr = BASS_ChannelGetTags(handle, (BASSTag)(66304 + sample)); if (intPtr != IntPtr.Zero) { return Utils.IntPtrAsStringAnsi(intPtr); } return null; } public static string[] BASS_ChannelGetMidiTrackText(int handle, int track) { if (track >= 0) { return Utils.IntPtrToArrayNullTermAnsi(BASS_ChannelGetTags(handle, (BASSTag)(69632 + track))); } List<string> list = new List<string>(); track = 0; while (true) { IntPtr intPtr = BASS_ChannelGetTags(handle, (BASSTag)(69632 + track)); if (!(intPtr != IntPtr.Zero)) { break; } string[] array = Utils.IntPtrToArrayNullTermAnsi(intPtr); if (array != null && array.Length != 0) { list.AddRange(array); } track++; } if (list.Count > 0) { return list.ToArray(); } return null; } [DllImport("bass", EntryPoint = "BASS_FXSetParameters")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_FXSetParametersExt(int handle, [In][MarshalAs(UnmanagedType.AsAny)] object par); public static bool BASS_FXSetParameters(int handle, object par) { return false; } [DllImport("bass", EntryPoint = "BASS_FXGetParameters")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_FXGetParametersExt(int handle, [In][Out] float[] par); [DllImport("bass", EntryPoint = "BASS_FXGetParameters")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool BASS_FXGetParametersExt(int handle, [In][Out][MarshalAs(UnmanagedType.AsAny)] object par); public static bool BASS_FXGetParameters(int handle, object par) { return false; } [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_FXReset(int handle); [DllImport("bass")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool BASS_FXSetPriority(int handle, int priority); public static bool LoadMe() { bool flag = Utils.LoadLib("bass", ref _myModuleHandle); if (flag) { InitBass(); } return flag; } public static bool LoadMe(string path) { bool flag = Utils.LoadLib(Path.Combine(path, "bass"), ref _myModuleHandle); if (flag) { InitBass(); } return flag; } public static bool FreeMe() { return Utils.FreeLib(ref _myModuleHandle); } private static void CheckVersion() { try { if (Utils.HighWord(BASS_GetVersion()) == 516) { return; } Version version = BASS_GetVersion(2); Version version2 = new Version(2, 4); FileVersionInfo fileVersionInfo = null; ProcessModuleCollection modules = Process.GetCurrentProcess().Modules; for (int num = modules.Count - 1; num >= 0; num--) { ProcessModule processModule = modules[num]; if (processModule.ModuleName.ToLower().Equals("bass".ToLower())) { fileVersionInfo = processModule.FileVersionInfo; break; } } if (fileVersionInfo != null) { Console.WriteLine(string.Format("An incorrect version of BASS was loaded!\r\n\r\nVersion loaded: {0}.{1}\r\nVersion expected: {2}.{3}\r\n\r\nFile: {4}\r\nFileVersion: {5}\r\nDescription: {6}\r\nCompany: {7}\r\nLanguage: {8}", version.Major, version.Minor, version2.Major, version2.Minor, fileVersionInfo.FileName, fileVersionInfo.FileVersion, fileVersionInfo.FileDescription, fileVersionInfo.CompanyName + " " + fileVersionInfo.LegalCopyright, fileVersionInfo.Language)); } else { Console.WriteLine($"An incorrect version of BASS was loaded!\r\n\r\nBASS Version loaded: {version.Major}.{version.Minor}\r\nBASS Version expected: {version2.Major}.{version2.Minor}"); } } catch { } } } public enum BASS3DAlgorithm { BASS_3DALG_DEFAULT, BASS_3DALG_OFF, BASS_3DALG_FULL, BASS_3DALG_LIGHT } public enum BASS3DMode { BASS_3DMODE_LEAVECURRENT = -1, BASS_3DMODE_NORMAL, BASS_3DMODE_RELATIVE, BASS_3DMODE_OFF } public enum BASSActive { BASS_ACTIVE_STOPPED, BASS_ACTIVE_PLAYING, BASS_ACTIVE_STALLED, BASS_ACTIVE_PAUSED, BASS_ACTIVE_PAUSED_DEVICE } public enum BASSAttribute { BASS_ATTRIB_FREQ = 1, BASS_ATTRIB_VOL = 2, BASS_ATTRIB_PAN = 3, BASS_ATTRIB_EAXMIX = 4, BASS_ATTRIB_NOBUFFER = 5, BASS_ATTRIB_CPU = 7, BASS_ATTRIB_SRC = 8, BASS_ATTRIB_NET_RESUME = 9, BASS_ATTRIB_SCANINFO = 10, BASS_ATTRIB_NORAMP = 11, BASS_ATTRIB_BITRATE = 12, BASS_ATTRIB_BUFFER = 13, BASS_ATTRIB_MUSIC_AMPLIFY = 256, BASS_ATTRIB_MUSIC_PANSEP = 257, BASS_ATTRIB_MUSIC_PSCALER = 258, BASS_ATTRIB_MUSIC_BPM = 259, BASS_ATTRIB_MUSIC_SPEED = 260, BASS_ATTRIB_MUSIC_VOL_GLOBAL = 261, BASS_ATTRIB_MUSIC_ACTIVE = 262, BASS_ATTRIB_MUSIC_VOL_CHAN = 512, BASS_ATTRIB_MUSIC_VOL_INST = 768, BASS_ATTRIB_TEMPO = 65536, BASS_ATTRIB_TEMPO_PITCH = 65537, BASS_ATTRIB_TEMPO_FREQ = 65538, BASS_ATTRIB_TEMPO_OPTION_USE_AA_FILTER = 65552, BASS_ATTRIB_TEMPO_OPTION_AA_FILTER_LENGTH = 65553, BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO = 65554, BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MS = 65555, BASS_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MS = 65556, BASS_ATTRIB_TEMPO_OPTION_OVERLAP_MS = 65557, BASS_ATTRIB_TEMPO_OPTION_PREVENT_CLICK = 65558, BASS_ATTRIB_REVERSE_DIR = 69632, BASS_ATTRIB_MIDI_PPQN = 73728, BASS_ATTRIB_MIDI_CPU = 73729, BASS_ATTRIB_MIDI_CHANS = 73730, BASS_ATTRIB_MIDI_VOICES = 73731, BASS_ATTRIB_MIDI_VOICES_ACTIVE = 73732, BASS_ATTRIB_MIDI_STATE = 73733, BASS_ATTRIB_MIDI_SRC = 73734, BASS_ATTRIB_MIDI_KILL = 73735, BASS_ATTRIB_MIDI_TRACK_VOL = 73984, BASS_ATTRIB_OPUS_ORIGFREQ = 77824, BASS_ATTRIB_DSD_GAIN = 81920, BASS_ATTRIB_DSD_RATE = 81921, BASS_ATTRIB_MIXER_LATENCY = 86016, BASS_ATTRIB_SPLIT_ASYNCBUFFER = 86032, BASS_ATTRIB_SPLIT_ASYNCPERIOD = 86033, BASS_ATTRIB_WEBM_TRACK = 90112, BASS_SLIDE_LOG = 16777216 } [SuppressUnmanagedCodeSecurity] public sealed class BASSBuffer : IDisposable { private bool disposed; private int _bufferlength = 352800; private int _bps = 2; private int _samplerate = 44100; private int _chans = 2; private byte[] _buffer; private int _bufferwritepos; private int _readers = 1; private int[] _bufferreadpos = new int[1]; public int BufferLength => _bufferlength; public int Bps => _bps; public int SampleRate => _samplerate; public int NumChans => _chans; public int Readers { get { return _readers; } set { if (value <= 0 || value == _readers) { return; } lock (_buffer) { int[] array = new int[value]; for (int i = 0; i < value; i++) { if (i < _readers) { array[i] = _bufferreadpos[i]; } else { array[i] = _bufferreadpos[_readers - 1]; } } _bufferreadpos = array; _readers = value; } } } public BASSBuffer() { Initialize(); } public BASSBuffer(float seconds, int samplerate, int chans, int bps) { if (seconds <= 0f) { seconds = 2f; } _samplerate = samplerate; if (_samplerate <= 0) { _samplerate = 44100; } _chans = chans; if (_chans <= 0) { _chans = 2; } _bps = bps; if (_bps > 4) { switch (_bps) { case 32: _bps = 4; break; case 8: _bps = 1; break; default: _bps = 2; break; } } if (_bps <= 0 || _bps == 3) { _bps = 2; } _bufferlength = (int)Math.Ceiling((double)seconds * (double)_samplerate * (double)_chans * (double)_bps); if (_bufferlength % _bps > 0) { _bufferlength -= _bufferlength % _bps; } Initialize(); } private void Initialize() { _buffer = new byte[_bufferlength]; Clear(); } public void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (!disposed) { } disposed = true; } ~BASSBuffer() { Dispose(disposing: false); } public void Clear() { lock (_buffer) { Array.Clear(_buffer, 0, _bufferlength); _bufferwritepos = 0; for (int i = 0; i < _readers; i++) { _bufferreadpos[i] = 0; } } } public void Resize(float factor) { if (factor <= 1f) { return; } lock (_buffer) { _bufferlength = (int)Math.Ceiling((double)factor * (double)_bufferlength); if (_bufferlength % _bps > 0) { _bufferlength -= _bufferlength % _bps; } byte[] array = new byte[_bufferlength]; Array.Clear(array, 0, _bufferlength); Array.Copy(_buffer, array, _buffer.Length); _buffer = array; } } public int Space(int reader) { int num = _bufferlength; lock (_buffer) { if (reader < 0 || reader >= _readers) { int num2 = 0; for (int i = 0; i < _readers; i++) { num2 = _bufferlength - (_bufferwritepos - _bufferreadpos[reader]); if (num2 > _bufferlength) { num2 -= _bufferlength; } if (num2 < num) { num = num2; } } return num; } num = _bufferlength - (_bufferwritepos - _bufferreadpos[reader]); if (num > _bufferlength) { return num - _bufferlength; } return num; } } public int Count(int reader) { int num = -1; lock (_buffer) { if (reader < 0 || reader >= _readers) { int num2 = 0; for (int i = 0; i < _readers; i++) { num2 = _bufferwritepos - _bufferreadpos[i]; if (num2 < 0) { num2 += _bufferlength; } if (num2 > num) { num = num2; } } return num; } num = _bufferwritepos - _bufferreadpos[reader]; if (num < 0) { return num + _bufferlength; } return num; } } public unsafe int Write(IntPtr buffer, int length) { lock (_buffer) { if (length > _bufferlength) { length = _bufferlength; } int num = 0; int num2 = _bufferlength - _bufferwritepos; if (length >= num2) { Marshal.Copy(buffer, _buffer, _bufferwritepos, num2); num += num2; buffer = new IntPtr((byte*)buffer.ToPointer() + num2); length -= num2; _bufferwritepos = 0; } Marshal.Copy(buffer, _buffer, _bufferwritepos, length); num += length; _bufferwritepos += length; return num; } } public int Write(byte[] buffer, int length) { lock (_buffer) { if (length > _bufferlength) { length = _bufferlength; } int num = 0; int num2 = _bufferlength - _bufferwritepos; if (length >= num2) { Array.Copy(buffer, num, _buffer, _bufferwritepos, num2); num += num2; length -= num2; _bufferwritepos = 0; } Array.Copy(buffer, num, _buffer, _bufferwritepos, length); num += length; _bufferwritepos += length; return num; } } public unsafe int Read(IntPtr buffer, int length, int reader) { lock (_buffer) { int num = 0; if (reader < 0 || reader >= _readers) { reader = 0; } int num2 = _bufferwritepos - _bufferreadpos[reader]; if (num2 < 0) { num2 += _bufferlength; } if (length > num2) { length = num2; } num2 = _bufferlength - _bufferreadpos[reader]; if (length >= num2) { Marshal.Copy(_buffer, _bufferreadpos[reader], buffer, num2); num += num2; buffer = new IntPtr((byte*)buffer.ToPointer() + num2); length -= num2; _bufferreadpos[reader] = 0; } Marshal.Copy(_buffer, _bufferreadpos[reader], buffer, length); _bufferreadpos[reader] += length; return num + length; } } public int Read(byte[] buffer, int length, int reader) { lock (_buffer) { int num = 0; if (reader < 0 || reader >= _readers) { reader = 0; } int num2 = _bufferwritepos - _bufferreadpos[reader]; if (num2 < 0) { num2 += _bufferlength; } if (length > num2) { length = num2; } num2 = _bufferlength - _bufferreadpos[reader]; if (length >= num2) { Array.Copy(_buffer, _bufferreadpos[reader], buffer, num, num2); num += num2; length -= num2; _bufferreadpos[reader] = 0; } Array.Copy(_buffer, _bufferreadpos[reader], buffer, num, length); _bufferreadpos[reader] += length; return num + length; } } } [Flags] public enum BASSChannelType { BASS_CTYPE_UNKNOWN = 0, BASS_CTYPE_SAMPLE = 1, BASS_CTYPE_RECORD = 2, BASS_CTYPE_MUSIC_MO3 = 0x100, BASS_CTYPE_STREAM = 0x10000, BASS_CTYPE_STREAM_OGG = 0x10002, BASS_CTYPE_STREAM_MP1 = 0x10003, BASS_CTYPE_STREAM_MP2 = 0x10004, BASS_CTYPE_STREAM_MP3 = 0x10005, BASS_CTYPE_STREAM_AIFF = 0x10006, BASS_CTYPE_STREAM_CA = 0x10007, BASS_CTYPE_STREAM_MF = 0x10008, BASS_CTYPE_STREAM_AM = 0x10009, BASS_CTYPE_STREAM_DUMMY = 0x18000, BASS_CTYPE_STREAM_DEVICE = 0x18001, BASS_CTYPE_STREAM_MIXER = 0x10800, BASS_CTYPE_STREAM_SPLIT = 0x10801, BASS_CTYPE_STREAM_WAV = 0x40000, BASS_CTYPE_STREAM_WAV_PCM = 0x50001, BASS_CTYPE_STREAM_WAV_FLOAT = 0x50003, BASS_CTYPE_MUSIC_MOD = 0x20000, BASS_CTYPE_MUSIC_MTM = 0x20001, BASS_CTYPE_MUSIC_S3M = 0x20002, BASS_CTYPE_MUSIC_XM = 0x20003, BASS_CTYPE_MUSIC_IT = 0x20004, BASS_CTYPE_STREAM_WV = 0x10500, BASS_CTYPE_STREAM_WV_H = 0x10501, BASS_CTYPE_STREAM_WV_L = 0x10502, BASS_CTYPE_STREAM_WV_LH = 0x10503, BASS_CTYPE_STREAM_CD = 0x10200, BASS_CTYPE_STREAM_WMA = 0x10300, BASS_CTYPE_STREAM_WMA_MP3 = 0x10301, BASS_CTYPE_STREAM_FLAC = 0x10900, BASS_CTYPE_STREAM_FLAC_OGG = 0x10901, BASS_CTYPE_STREAM_OFR = 0x10600, BASS_CTYPE_STREAM_APE = 0x10700, BASS_CTYPE_STREAM_MPC = 0x10A00, BASS_CTYPE_STREAM_AAC = 0x10B00, BASS_CTYPE_STREAM_MP4 = 0x10B01, BASS_CTYPE_STREAM_SPX = 0x10C00, BASS_CTYPE_STREAM_ALAC = 0x10E00, BASS_CTYPE_STREAM_TTA = 0x10F00, BASS_CTYPE_STREAM_AC3 = 0x11000, BASS_CTYPE_STREAM_OPUS = 0x11200, BASS_CTYPE_STREAM_WINAMP = 0x10400, BASS_CTYPE_STREAM_DSD = 0x11700, BASS_CTYPE_STREAM_MIDI = 0x10D00, BASS_CTYPE_STREAM_ADX = 0x1F000, BASS_CTYPE_STREAM_AIX = 0x1F001, BASS_CTYPE_STREAM_TEMPO = 0x1F200, BASS_CTYPE_STREAM_REVERSE = 0x1F201, BASS_CTYPE_STREAM_VIDEO = 0x11100 } public enum BASSConfig { BASS_CONFIG_BUFFER = 0, BASS_CONFIG_UPDATEPERIOD = 1, BASS_CONFIG_GVOL_SAMPLE = 4, BASS_CONFIG_GVOL_STREAM = 5, BASS_CONFIG_GVOL_MUSIC = 6, BASS_CONFIG_CURVE_VOL = 7, BASS_CONFIG_CURVE_PAN = 8, BASS_CONFIG_FLOATDSP = 9, BASS_CONFIG_3DALGORITHM = 10, BASS_CONFIG_NET_TIMEOUT = 11, BASS_CONFIG_NET_BUFFER = 12, BASS_CONFIG_PAUSE_NOPLAY = 13, BASS_CONFIG_NET_PREBUF = 15, BASS_CONFIG_NET_AGENT = 16, BASS_CONFIG_NET_PROXY = 17, BASS_CONFIG_NET_PASSIVE = 18, BASS_CONFIG_REC_BUFFER = 19, BASS_CONFIG_NET_PLAYLIST = 21, BASS_CONFIG_MUSIC_VIRTUAL = 22, BASS_CONFIG_VERIFY = 23, BASS_CONFIG_UPDATETHREADS = 24, BASS_CONFIG_DEV_BUFFER = 27, BASS_CONFIG_VISTA_TRUEPOS = 30, BASS_CONFIG_MP3_ERRORS = 35, BASS_CONFIG_DEV_DEFAULT = 36, BASS_CONFIG_NET_READTIMEOUT = 37, BASS_CONFIG_VISTA_SPEAKERS = 38, BASS_CONFIG_MF_DISABLE = 40, BASS_CONFIG_HANDLES = 41, BASS_CONFIG_UNICODE = 42, BASS_CONFIG_SRC = 43, BASS_CONFIG_SRC_SAMPLE = 44, BASS_CONFIG_ASYNCFILE_BUFFER = 45, BASS_CONFIG_OGG_PRESCAN = 47, BASS_CONFIG_MF_VIDEO = 48, BASS_CONFIG_DEV_NONSTOP = 50, BASS_CONFIG_VERIFY_NET = 52, BASS_CONFIG_NET_SEEK = 56, BASS_CONFIG_NET_PLAYLIST_DEPTH = 59, BASS_CONFIG_NET_PREBUF_WAIT = 60, BASS_CONFIG_LIBSSL = 64, BASS_CONFIG_WASAPI_PERSIST = 65, BASS_CONFIG_AC3_DYNRNG = 65537, BASS_CONFIG_WMA_PREBUF = 65793, BASS_CONFIG_WMA_BASSFILE = 65795, BASS_CONFIG_WMA_NETSEEK = 65796, BASS_CONFIG_WMA_VIDEO = 65797, BASS_CONFIG_WMA_ASYNC = 65807, BASS_CONFIG_CD_FREEOLD = 66048, BASS_CONFIG_CD_RETRY = 66049, BASS_CONFIG_CD_AUTOSPEED = 66050, BASS_CONFIG_CD_SKIPERROR = 66051, BASS_CONFIG_CD_CDDB_SERVER = 66052, BASS_CONFIG_CD_READ = 66053, BASS_CONFIG_CD_TIMEOUT = 66054, BASS_CONFIG_ENCODE_PRIORITY = 66304, BASS_CONFIG_ENCODE_QUEUE = 66305, BASS_CONFIG_ENCODE_ACM_LOAD = 66306, BASS_CONFIG_ENCODE_CAST_TIMEOUT = 66320, BASS_CONFIG_ENCODE_CAST_PROXY = 66321, BASS_CONFIG_MIDI_COMPACT = 66560, BASS_CONFIG_MIDI_VOICES = 66561, BASS_CONFIG_MIDI_AUTOFONT = 66562, BASS_CONFIG_MIDI_DEFFONT = 66563, BASS_CONFIG_MIDI_IN_PORTS = 66564, BASS_CONFIG_MIXER_FILTER = 67072, BASS_CONFIG_MIXER_BUFFER = 67073, BASS_CONFIG_MIXER_POSEX = 67074, BASS_CONFIG_SPLIT_BUFFER = 67088, BASS_CONFIG_MP4_VIDEO = 67328, BASS_CONFIG_AAC_PRESCAN = 67330, BASS_CONFIG_AAC_MP4 = 67329, BASS_CONFIG_WINAMP_INPUT_TIMEOUT = 67584, BASS_CONFIG_DSD_FREQ = 67584, BASS_CONFIG_DSD_GAIN = 67585 } [Flags] public enum BASSData { BASS_DATA_AVAILABLE = 0, BASS_DATA_FFT_INDIVIDUAL = 0x10, BASS_DATA_FFT_NOWINDOW = 0x20, BASS_DATA_FFT_REMOVEDC = 0x40, BASS_DATA_FFT_COMPLEX = 0x80, BASS_DATA_FFT_NYQUIST = 0x100, BASS_DATA_FIXED = 0x20000000, BASS_DATA_FLOAT = 0x40000000, BASS_DATA_FFT256 = int.MinValue, BASS_DATA_FFT512 = -2147483647, BASS_DATA_FFT1024 = -2147483646, BASS_DATA_FFT2048 = -2147483645, BASS_DATA_FFT4096 = -2147483644, BASS_DATA_FFT8192 = -2147483643, BASS_DATA_FFT16384 = -2147483642, BASS_DATA_FFT32768 = -2147483641 } [Flags] public enum BASSDeviceInfo { BASS_DEVICE_NONE = 0, BASS_DEVICE_ENABLED = 1, BASS_DEVICE_DEFAULT = 2, BASS_DEVICE_INIT = 4, BASS_DEVICE_LOOPBACK = 8, BASS_DEVICE_INPUT = 0x10, BASS_DEVICE_UNPLUGGED = 0x20, BASS_DEVICE_DISABLED = 0x40, BASS_DEVICE_TYPE_NETWORK = 0x1000000, BASS_DEVICE_TYPE_SPEAKERS = 0x2000000, BASS_DEVICE_TYPE_LINE = 0x3000000, BASS_DEVICE_TYPE_HEADPHONES = 0x4000000, BASS_DEVICE_TYPE_MICROPHONE = 0x5000000, BASS_DEVICE_TYPE_HEADSET = 0x6000000, BASS_DEVICE_TYPE_HANDSET = 0x7000000, BASS_DEVICE_TYPE_DIGITAL = 0x8000000, BASS_DEVICE_TYPE_SPDIF = 0x9000000, BASS_DEVICE_TYPE_HDMI = 0xA000000, BASS_DEVICE_TYPE_DISPLAYPORT = 0x40000000, BASS_DEVICE_TYPE_MASK = -16777216 } public enum BASSDirectSound { BASS_OBJECT_DS = 1, BASS_OBJECT_DS3DL } public enum BASSError { BASS_OK = 0, BASS_ERROR_MEM = 1, BASS_ERROR_FILEOPEN = 2, BASS_ERROR_DRIVER = 3, BASS_ERROR_BUFLOST = 4, BASS_ERROR_HANDLE = 5, BASS_ERROR_FORMAT = 6, BASS_ERROR_POSITION = 7, BASS_ERROR_INIT = 8, BASS_ERROR_START = 9, BASS_ERROR_NOCD = 12, BASS_ERROR_CDTRACK = 13, BASS_ERROR_ALREADY = 14, BASS_ERROR_NOPAUSE = 16, BASS_ERROR_NOTAUDIO = 17, BASS_ERROR_NOCHAN = 18, BASS_ERROR_ILLTYPE = 19, BASS_ERROR_ILLPARAM = 20, BASS_ERROR_NO3D = 21, BASS_ERROR_NOEAX = 22, BASS_ERROR_DEVICE = 23, BASS_ERROR_NOPLAY = 24, BASS_ERROR_FREQ = 25, BASS_ERROR_NOTFILE = 27, BASS_ERROR_NOHW = 29, BASS_ERROR_EMPTY = 31, BASS_ERROR_NONET = 32, BASS_ERROR_CREATE = 33, BASS_ERROR_NOFX = 34, BASS_ERROR_PLAYING = 35, BASS_ERROR_NOTAVAIL = 37, BASS_ERROR_DECODE = 38, BASS_ERROR_DX = 39, BASS_ERROR_TIMEOUT = 40, BASS_ERROR_FILEFORM = 41, BASS_ERROR_SPEAKER = 42, BASS_ERROR_VERSION = 43, BASS_ERROR_CODEC = 44, BASS_ERROR_ENDED = 45, BASS_ERROR_BUSY = 46, BASS_ERROR_UNKNOWN = -1, BASS_ERROR_WMA_LICENSE = 1000, BASS_ERROR_WMA_WM9 = 1001, BASS_ERROR_WMA_DENIED = 1002, BASS_ERROR_WMA_CODEC = 1003, BASS_ERROR_WMA_INDIVIDUAL = 1004, BASS_ERROR_ACM_CANCEL = 2000, BASS_ERROR_CAST_DENIED = 2100, BASS_VST_ERROR_NOINPUTS = 3000, BASS_VST_ERROR_NOOUTPUTS = 3001, BASS_VST_ERROR_NOREALTIME = 3002, BASS_ERROR_WASAPI = 5000, BASS_ERROR_WASAPI_BUFFER = 5001, BASS_ERROR_WASAPI_CATEGORY = 5002, BASS_ERROR_MP4_NOSTREAM = 6000, BASS_ERROR_WEBM_NOTAUDIO = 8000, BASS_ERROR_WEBM_TRACK = 8001 } [Flags] public enum BASSFlag { BASS_DEFAULT = 0, BASS_SAMPLE_8BITS = 1, BASS_SAMPLE_MONO = 2, BASS_SAMPLE_LOOP = 4, BASS_SAMPLE_3D = 8, BASS_SAMPLE_SOFTWARE = 0x10, BASS_SAMPLE_MUTEMAX = 0x20, BASS_SAMPLE_VAM = 0x40, BASS_SAMPLE_FX = 0x80, BASS_SAMPLE_FLOAT = 0x100, BASS_RECORD_PAUSE = 0x8000, BASS_RECORD_ECHOCANCEL = 0x2000, BASS_RECORD_AGC = 0x4000, BASS_STREAM_PRESCAN = 0x20000, BASS_STREAM_AUTOFREE = 0x40000, BASS_STREAM_RESTRATE = 0x80000, BASS_STREAM_BLOCK = 0x100000, BASS_STREAM_DECODE = 0x200000, BASS_STREAM_STATUS = 0x800000, BASS_SPEAKER_FRONT = 0x1000000, BASS_SPEAKER_REAR = 0x2000000, BASS_SPEAKER_CENLFE = 0x3000000, BASS_SPEAKER_REAR2 = 0x4000000, BASS_SPEAKER_LEFT = 0x10000000, BASS_SPEAKER_RIGHT = 0x20000000, BASS_SPEAKER_FRONTLEFT = 0x11000000, BASS_SPEAKER_FRONTRIGHT = 0x21000000, BASS_SPEAKER_REARLEFT = 0x12000000, BASS_SPEAKER_REARRIGHT = 0x22000000, BASS_SPEAKER_CENTER = 0x13000000, BASS_SPEAKER_LFE = 0x23000000, BASS_SPEAKER_REAR2LEFT = 0x14000000, BASS_SPEAKER_REAR2RIGHT = 0x24000000, BASS_SPEAKER_PAIR1 = 0x1000000, BASS_SPEAKER_PAIR2 = 0x2000000, BASS_SPEAKER_PAIR3 = 0x3000000, BASS_SPEAKER_PAIR4 = 0x4000000, BASS_SPEAKER_PAIR5 = 0x5000000, BASS_SPEAKER_PAIR6 = 0x6000000, BASS_SPEAKER_PAIR7 = 0x7000000, BASS_SPEAKER_PAIR8 = 0x8000000, BASS_SPEAKER_PAIR9 = 0x9000000, BASS_SPEAKER_PAIR10 = 0xA000000, BASS_SPEAKER_PAIR11 = 0xB000000, BASS_SPEAKER_PAIR12 = 0xC000000, BASS_SPEAKER_PAIR13 = 0xD000000, BASS_SPEAKER_PAIR14 = 0xE000000, BASS_SPEAKER_PAIR15 = 0xF000000, BASS_ASYNCFILE = 0x40000000, BASS_UNICODE = int.MinValue, BASS_SAMPLE_OVER_VOL = 0x10000, BASS_SAMPLE_OVER_POS = 0x20000, BASS_SAMPLE_OVER_DIST = 0x30000, BASS_WV_STEREO = 0x400000, BASS_AC3_DOWNMIX_2 = 0x200, BASS_AC3_DOWNMIX_4 = 0x400, BASS_DSD_RAW = 0x200, BASS_DSD_DOP = 0x400, BASS_AC3_DOWNMIX_DOLBY = 0x600, BASS_AC3_DYNAMIC_RANGE = 0x800, BASS_AAC_FRAME960 = 0x1000, BASS_AAC_STEREO = 0x400000, BASS_MIXER_END = 0x10000, BASS_MIXER_PAUSE = 0x20000, BASS_MIXER_NONSTOP = 0x20000, BASS_MIXER_RESUME = 0x1000, BASS_MIXER_POSEX = 0x2000, BASS_MIXER_LIMIT = 0x4000, BASS_MIXER_MATRIX = 0x10000, BASS_MIXER_DOWNMIX = 0x400000, BASS_MIXER_NORAMPIN = 0x800000, BASS_SPLIT_SLAVE = 0x1000, BASS_MIXER_BUFFER = 0x2000, BASS_SPLIT_POS = 0x2000, BASS_CD_SUBCHANNEL = 0x200, BASS_CD_SUBCHANNEL_NOHW = 0x400, BASS_CD_C2ERRORS = 0x800, BASS_MIDI_NOSYSRESET = 0x800, BASS_MIDI_DECAYEND = 0x1000, BASS_MIDI_NOFX = 0x2000, BASS_MIDI_DECAYSEEK = 0x4000, BASS_MIDI_NOCROP = 0x8000, BASS_MIDI_NOTEOFF1 = 0x10000, BASS_MIDI_SINCINTER = 0x800000, BASS_MIDI_FONT_MMAP = 0x20000, BASS_MIDI_FONT_XGDRUMS = 0x40000, BASS_MIDI_FONT_NOFX = 0x80000, BASS_MIDI_PACK_NOHEAD = 1, BASS_MIDI_PACK_16BIT = 2, BASS_FX_FREESOURCE = 0x10000, BASS_FX_BPM_BKGRND = 1, BASS_FX_BPM_MULT2 = 2, BASS_FX_TEMPO_ALGO_LINEAR = 0x200, BASS_FX_TEMPO_ALGO_CUBIC = 0x400, BASS_FX_TEMPO_ALGO_SHANNON = 0x800, BASS_MUSIC_FLOAT = 0x100, BASS_MUSIC_MONO = 2, BASS_MUSIC_LOOP = 4, BASS_MUSIC_3D = 8, BASS_MUSIC_FX = 0x80, BASS_MUSIC_AUTOFREE = 0x40000, BASS_MUSIC_DECODE = 0x200000, BASS_MUSIC_PRESCAN = 0x20000, BASS_MUSIC_RAMP = 0x200, BASS_MUSIC_RAMPS = 0x400, BASS_MUSIC_SURROUND = 0x800, BASS_MUSIC_SURROUND2 = 0x1000, BASS_MUSIC_FT2PAN = 0x2000, BASS_MUSIC_FT2MOD = 0x2000, BASS_MUSIC_PT1MOD = 0x4000, BASS_MUSIC_NONINTER = 0x10000, BASS_MUSIC_SINCINTER = 0x800000, BASS_MUSIC_POSRESET = 0x8000, BASS_MUSIC_POSRESETEX = 0x400000, BASS_MUSIC_STOPBACK = 0x80000, BASS_MUSIC_NOSAMPLE = 0x100000 } public enum BASSFXPhase { BASS_FX_PHASE_NEG_180, BASS_FX_PHASE_NEG_90, BASS_FX_PHASE_ZERO, BASS_FX_PHASE_90, BASS_FX_PHASE_180 } public enum BASSFXType { BASS_FX_DX8_CHORUS = 0, BASS_FX_DX8_COMPRESSOR = 1, BASS_FX_DX8_DISTORTION = 2, BASS_FX_DX8_ECHO = 3, BASS_FX_DX8_FLANGER = 4, BASS_FX_DX8_GARGLE = 5, BASS_FX_DX8_I3DL2REVERB = 6, BASS_FX_DX8_PARAMEQ = 7, BASS_FX_DX8_REVERB = 8, BASS_FX_VOLUME = 9, BASS_FX_BFX_ROTATE = 65536, [Obsolete("This effect is obsolete; use BASS_FX_BFX_ECHO4 instead")] BASS_FX_BFX_ECHO = 65537, [Obsolete("This effect is obsolete; use BASS_FX_BFX_CHORUS instead")] BASS_FX_BFX_FLANGER = 65538, BASS_FX_BFX_VOLUME = 65539, BASS_FX_BFX_PEAKEQ = 65540, [Obsolete("This effect is obsolete; use BASS_FX_BFX_FREEVERB instead")] BASS_FX_BFX_REVERB = 65541, [Obsolete("This effect is obsolete; use 2x BASS_FX_BFX_BQF with BASS_BFX_BQF_LOWPASS filter and appropriate fQ values instead")] BASS_FX_BFX_LPF = 65542, BASS_FX_BFX_MIX = 65543, BASS_FX_BFX_DAMP = 65544, BASS_FX_BFX_AUTOWAH = 65545, [Obsolete("This effect is obsolete; use BASS_FX_BFX_ECHO4 instead")] BASS_FX_BFX_ECHO2 = 65546, BASS_FX_BFX_PHASER = 65547, [Obsolete("This effect is obsolete; use BASS_FX_BFX_ECHO4 instead")] BASS_FX_BFX_ECHO3 = 65548, BASS_FX_BFX_CHORUS = 65549, [Obsolete("This effect is obsolete; use BASS_FX_BFX_BQF with BASS_BFX_BQF_ALLPASS filter instead")] BASS_FX_BFX_APF = 65550, [Obsolete("This effect is obsolete; use BASS_FX_BFX_COMPRESSOR2 instead")] BASS_FX_BFX_COMPRESSOR = 65551, BASS_FX_BFX_DISTORTION = 65552, BASS_FX_BFX_COMPRESSOR2 = 65553, BASS_FX_BFX_VOLUME_ENV = 65554, BASS_FX_BFX_BQF = 65555, BASS_FX_BFX_ECHO4 = 65556, BASS_FX_BFX_PITCHSHIFT = 65557, BASS_FX_BFX_FREEVERB = 65558 } [Flags] public enum BASSInfo { DSCAPS_NONE = 0, DSCAPS_CONTINUOUSRATE = 0x10, DSCAPS_EMULDRIVER = 0x20, DSCAPS_CERTIFIED = 0x40, DSCAPS_SECONDARYMONO = 0x100, DSCAPS_SECONDARYSTEREO = 0x200, DSCAPS_SECONDARY8BIT = 0x400, DSCAPS_SECONDARY16BIT = 0x800 } [Flags] public enum BASSInit { BASS_DEVICE_DEFAULT = 0, BASS_DEVICE_8BITS = 1, BASS_DEVICE_MONO = 2, BASS_DEVICE_3D = 4, BASS_DEVICE_LATENCY = 0x100, BASS_DEVICE_CPSPEAKERS = 0x400, BASS_DEVICE_SPEAKERS = 0x800, BASS_DEVICE_NOSPEAKER = 0x1000, BASS_DEVIDE_DMIX = 0x2000, BASS_DEVICE_FREQ = 0x4000, BASS_DEVICE_STEREO = 0x8000, BASS_DEVICE_HOG = 0x10000, BASS_DEVICE_DSOUND = 0x40000 } [Flags] public enum BASSInput { BASS_INPUT_NONE = 0, BASS_INPUT_OFF = 0x10000, BASS_INPUT_ON = 0x20000 } [Flags] public enum BASSInputType { BASS_INPUT_TYPE_ERROR = -1, BASS_INPUT_TYPE_MASK = -16777216, BASS_INPUT_TYPE_UNDEF = 0, BASS_INPUT_TYPE_DIGITAL = 0x1000000, BASS_INPUT_TYPE_LINE = 0x2000000, BASS_INPUT_TYPE_MIC = 0x3000000, BASS_INPUT_TYPE_SYNTH = 0x4000000, BASS_INPUT_TYPE_CD = 0x5000000, BASS_INPUT_TYPE_PHONE = 0x6000000, BASS_INPUT_TYPE_SPEAKER = 0x7000000, BASS_INPUT_TYPE_WAVE = 0x8000000, BASS_INPUT_TYPE_AUX = 0x9000000, BASS_INPUT_TYPE_ANALOG = 0xA000000 } [Flags] public enum BASSLevel { BASS_LEVEL_ALL = 0, BASS_LEVEL_MONO = 1, BASS_LEVEL_STEREO = 2, BASS_LEVEL_RMS = 4, BASS_LEVEL_VOLPAN = 8 } [Flags] public enum BASSMode { BASS_POS_BYTE = 0, BASS_POS_BYTES = 0, BASS_POS_MUSIC_ORDERS = 1, BASS_POS_MIDI_TICK = 2, BASS_POS_OGG = 3, BASS_POS_CD_TRACK = 4, BASS_POS_RESET = 0x2000000, BASS_POS_RELATIVE = 0x4000000, BASS_POS_INEXACT = 0x8000000, BASS_MUSIC_POSRESET = 0x8000, BASS_MUSIC_POSRESETEX = 0x400000, BASS_MIXER_NORAMPIN = 0x800000, BASS_POS_MIXER_RESET = 0x10000, BASS_POS_DECODE = 0x10000000, BASS_POS_DECODETO = 0x20000000, BASS_POS_SCAN = 0x40000000, BASS_MIDI_DECAYSEEK = 0x4000 } [SuppressUnmanagedCodeSecurity] public sealed class BassNet { internal static string _eMail; internal static string _registrationKey; internal static string _internalName; public static bool OmitCheckVersion; private static bool _useBrokenLatin1; private static bool _useRiffInfoUTF8; public static string InternalName => _internalName; public static bool UseBrokenLatin1Behavior { get { return _useBrokenLatin1; } set { _useBrokenLatin1 = value; } } public static bool UseRiffInfoUTF8 { get { return _useRiffInfoUTF8; } set { _useRiffInfoUTF8 = value; } } private BassNet() { } static BassNet() { _eMail = string.Empty; _registrationKey = string.Empty; _internalName = "BASS.NET"; OmitCheckVersion = false; _useBrokenLatin1 = false; _useRiffInfoUTF8 = false; AssemblyName name = Assembly.GetExecutingAssembly().GetName(); _internalName = $"{name.Name} v{name.Version}"; } public static void Registration(string eMail, string registrationKey) { _eMail = eMail; _registrationKey = registrationKey; } } [Flags] public enum BASSRecordFormat { WAVE_FORMAT_UNKNOWN = 0, WAVE_FORMAT_1M08 = 1, WAVE_FORMAT_1S08 = 2, WAVE_FORMAT_1M16 = 4, WAVE_FORMAT_1S16 = 8, WAVE_FORMAT_2M08 = 0x10, WAVE_FORMAT_2S08 = 0x20, WAVE_FORMAT_2M16 = 0x40, WAVE_FORMAT_2S16 = 0x80, WAVE_FORMAT_4M08 = 0x100, WAVE_FORMAT_4S08 = 0x200, WAVE_FORMAT_4M16 = 0x400, WAVE_FORMAT_4S16 = 0x800, WAVE_FORMAT_48M08 = 0x1000, WAVE_FORMAT_48S08 = 0x2000, WAVE_FORMAT_48M16 = 0x4000, WAVE_FORMAT_48S16 = 0x8000, WAVE_FORMAT_96M08 = 0x10000, WAVE_FORMAT_96S08 = 0x20000, WAVE_FORMAT_96M16 = 0x40000, WAVE_FORMAT_96S16 = 0x80000 } [Flags] public enum BASSRecordInfo { DSCAPS_NONE = 0, DSCAPS_EMULDRIVER = 0x20, DSCAPS_CERTIFIED = 0x40 } public enum BASSStreamFilePosition { BASS_FILEPOS_CURRENT = 0, BASS_FILEPOS_DOWNLOAD = 1, BASS_FILEPOS_END = 2, BASS_FILEPOS_START = 3, BASS_FILEPOS_CONNECTED = 4, BASS_FILEPOS_BUFFER = 5, BASS_FILEPOS_SOCKET = 6, BASS_FILEPOS_ASYNCBUF = 7, BASS_FILEPOS_SIZE = 8, BASS_FILEPOS_BUFFERING = 9, BASS_FILEPOS_WMA_BUFFER = 1000, BASS_FILEPOS_HLS_SEGMENT = 65536 } public enum BASSStreamProc { STREAMPROC_DUMMY = 0, STREAMPROC_PUSH = -1, BASS_STREAMPROC_END = int.MinValue } public enum BASSStreamSystem { STREAMFILE_NOBUFFER, STREAMFILE_BUFFER, STREAMFILE_BUFFERPUSH } [Flags] public enum BASSSync { BASS_SYNC_POS = 0, BASS_SYNC_MUSICINST = 1, BASS_SYNC_END = 2, BASS_SYNC_MUSICFX = 3, BASS_SYNC_META = 4, BASS_SYNC_SLIDE = 5, BASS_SYNC_STALL = 6, BASS_SYNC_DOWNLOAD = 7, BASS_SYNC_FREE = 8, BASS_SYNC_MUSICPOS = 0xA, BASS_SYNC_SETPOS = 0xB, BASS_SYNC_OGG_CHANGE = 0xC, BASS_SYNC_DEV_FAIL = 0xE, BASS_SYNC_DEV_FORMAT = 0xF, BASS_SYNC_MIXTIME = 0x40000000, BASS_SYNC_ONETIME = int.MinValue, BASS_SYNC_MIXER_ENVELOPE = 0x10200, BASS_SYNC_MIXER_ENVELOPE_NODE = 0x10201, BASS_SYNC_WMA_CHANGE = 0x10100, BASS_SYNC_WMA_META = 0x10101, BASS_SYNC_CD_ERROR = 0x3E8, BASS_SYNC_CD_SPEED = 0x3EA, BASS_WINAMP_SYNC_BITRATE = 0x64, BASS_SYNC_MIDI_MARKER = 0x10000, BASS_SYNC_MIDI_CUE = 0x10001, BASS_SYNC_MIDI_LYRIC = 0x10002, BASS_SYNC_MIDI_TEXT = 0x10003, BASS_SYNC_MIDI_EVENT = 0x10004, BASS_SYNC_MIDI_TICK = 0x10005, BASS_SYNC_MIDI_TIMESIG = 0x10006, BASS_SYNC_MIDI_KEYSIG = 0x10007, BASS_SYNC_HLS_SEGMENT = 0x10300 } public enum BASSTag { BASS_TAG_ID3 = 0, BASS_TAG_ID3V2 = 1, BASS_TAG_OGG = 2, BASS_TAG_HTTP = 3, BASS_TAG_ICY = 4, BASS_TAG_META = 5, BASS_TAG_APE = 6, BASS_TAG_MP4 = 7, BASS_TAG_WMA = 8, BASS_TAG_VENDOR = 9, BASS_TAG_LYRICS3 = 10, BASS_TAG_WMA_META = 11, BASS_TAG_CA_CODEC = 11, BASS_TAG_FLAC_CUE = 12, BASS_TAG_WMA_CODEC = 12, BASS_TAG_MF = 13, BASS_TAG_WAVEFORMAT = 14, BASS_TAG_AM_MIME = 15, BASS_TAG_AM_NAME = 16, BASS_TAG_RIFF_INFO = 256, BASS_TAG_RIFF_BEXT = 257, BASS_TAG_RIFF_CART = 258, BASS_TAG_RIFF_DISP = 259, BASS_TAG_RIFF_CUE = 260, BASS_TAG_RIFF_SMPL = 261, BASS_TAG_APE_BINARY = 4096, BASS_TAG_MUSIC_NAME = 65536, BASS_TAG_MUSIC_MESSAGE = 65537, BASS_TAG_MUSIC_ORDERS = 65538, BASS_TAG_MUSIC_AUTH = 65539, BASS_TAG_MUSIC_INST = 65792, BASS_TAG_MUSIC_SAMPLE = 66304, BASS_TAG_MIDI_TRACK = 69632, BASS_TAG_ADX_LOOP = 73728, BASS_TAG_FLAC_PICTURE = 73728, BASS_TAG_DSD_ARTIST = 77824, BASS_TAG_DSD_TITLE = 77825, BASS_TAG_DSD_COMMENT = 78080, BASS_TAG_HLS_EXTINF = 81920, BASS_TAG_HLS_STREAMINF = 81921, BASS_TAG_HLS_DATE = 81922, BASS_TAG_UNKNOWN = -1 } [SuppressUnmanagedCodeSecurity] public sealed class BASSTimer : IDisposable { private bool disposed; private Timer _timer; private int _interval = 50; private TimerCallback _timerDelegate; private bool _enabled; public int Interval { get { return _interval; } set { if (value <= 0) { _interval = -1; } else { _interval = value; } if (Enabled) { lock (_timer) { _timer.Change(_interval, _interval); } } } } public bool Enabled { get { if (_enabled) { return _timer != null; } return false; } set { if (value == _enabled) { return; } if (value) { if (_timer != null) { lock (_timer) { _timer.Change(_interval, _interval); _enabled = true; return; } } Start(); return; } if (_timer != null) { lock (_timer) { _timer.Change(-1, -1); _enabled = false; return; } } Stop(); } } public event EventHandler Tick; public BASSTimer() { _timerDelegate = timer_Tick; } public BASSTimer(int interval) { _interval = interval; _timerDelegate = timer_Tick; } public void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (!disposed) { try { Stop(); } catch { } } disposed = true; } ~BASSTimer() { Dispose(disposing: false); } private void timer_Tick(object state) { if (this.Tick != null) { ProcessDelegate(this.Tick, this, EventArgs.Empty); } } private void ProcessDelegate(Delegate del, params object[] args) { if ((object)del == null || _timer == null) { return; } lock (_timer) { Delegate[] invocationList = del.GetInvocationList(); Delegate[] array = invocationList; foreach (Delegate del2 in array) { InvokeDelegate(del2, args); } } } private void InvokeDelegate(Delegate del, object[] args) { if (del.Target is ISynchronizeInvoke synchronizeInvoke) { if (synchronizeInvoke.InvokeRequired) { try { synchronizeInvoke.BeginInvoke(del, args); return; } catch { return; } } del.DynamicInvoke(args); } else { del.DynamicInvoke(args); } } public void Start() { if (_timer == null) { _timer = new Timer(_timerDelegate, null, _interval, _interval); _enabled = true; return; } lock (_timer) { _timer.Change(_interval, _interval); _enabled = true; } } public void Stop() { if (_timer != null) { lock (_timer) { _timer.Change(-1, -1); _timer.Dispose(); _enabled = false; } _timer = null; } else { _enabled = false; } } } [Flags] public enum BASSVam { BASS_VAM_HARDWARE = 1, BASS_VAM_SOFTWARE = 2, BASS_VAM_TERM_TIME = 4, BASS_VAM_TERM_DIST = 8, BASS_VAM_TERM_PRIO = 0x10 } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_3DVECTOR { public float x; public float y; public float z; public BASS_3DVECTOR() { } public BASS_3DVECTOR(float X, float Y, float Z) { x = X; y = Y; z = Z; } public override string ToString() { return $"X={x}, Y={y}, Z={z}"; } } [Serializable] public sealed class BASS_CHANNELINFO { internal BASS_CHANNELINFO_INTERNAL _internal; public int freq; public int chans; public BASSFlag flags; public BASSChannelType ctype; public int origres; public int plugin; public int sample; public string filename = string.Empty; public bool origresIsFloat; public bool IsDecodingChannel => (flags & BASSFlag.BASS_STREAM_DECODE) != 0; public bool Is32bit => (flags & BASSFlag.BASS_SAMPLE_FLOAT) != 0; public bool Is8bit => (flags & BASSFlag.BASS_SAMPLE_8BITS) != 0; public override string ToString() { return string.Format("{0}, {1}Hz, {2}, {3}bit{4}", Utils.BASSChannelTypeToString(ctype), freq, Utils.ChannelNumberToString(chans), (origres != 0) ? origres : (Is32bit ? 32 : (Is8bit ? 8 : 16)), origresIsFloat ? "-float" : ""); } } [Serializable] internal struct BASS_CHANNELINFO_INTERNAL { public int freq; public int chans; public BASSFlag flags; public BASSChannelType ctype; public int origres; public int plugin; public int sample; public IntPtr filename; } [Serializable] public sealed class BASS_DEVICEINFO { internal BASS_DEVICEINFO_INTERNAL _internal; public string name = string.Empty; public string driver = string.Empty; public string id; public BASSDeviceInfo flags; public BASSDeviceInfo status => flags & (BASSDeviceInfo)16777215; public BASSDeviceInfo type => flags & BASSDeviceInfo.BASS_DEVICE_TYPE_MASK; public bool IsEnabled => (flags & BASSDeviceInfo.BASS_DEVICE_ENABLED) != 0; public bool IsDefault => (flags & BASSDeviceInfo.BASS_DEVICE_DEFAULT) != 0; public bool IsInitialized => (flags & BASSDeviceInfo.BASS_DEVICE_INIT) != 0; public override string ToString() { return name; } } [Serializable] internal struct BASS_DEVICEINFO_INTERNAL { public IntPtr name; public IntPtr driver; public BASSDeviceInfo flags; } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_CHORUS { public float fWetDryMix; public float fDepth = 25f; public float fFeedback; public float fFrequency; public int lWaveform = 1; public float fDelay; public BASSFXPhase lPhase = BASSFXPhase.BASS_FX_PHASE_ZERO; public BASS_DX8_CHORUS() { } public BASS_DX8_CHORUS(float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, BASSFXPhase Phase) { fWetDryMix = WetDryMix; fDepth = Depth; fFeedback = Feedback; fFrequency = Frequency; lWaveform = Waveform; fDelay = Delay; lPhase = Phase; } public void Preset_Default() { fWetDryMix = 50f; fDepth = 25f; fFeedback = 0f; fFrequency = 0f; lWaveform = 1; fDelay = 0f; lPhase = BASSFXPhase.BASS_FX_PHASE_ZERO; } public void Preset_A() { fWetDryMix = 60f; fDepth = 60f; fFeedback = 25f; fFrequency = 5f; lWaveform = 1; fDelay = 8f; lPhase = BASSFXPhase.BASS_FX_PHASE_90; } public void Preset_B() { fWetDryMix = 75f; fDepth = 80f; fFeedback = 50f; fFrequency = 7f; lWaveform = 0; fDelay = 15f; lPhase = BASSFXPhase.BASS_FX_PHASE_NEG_90; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_COMPRESSOR { public float fGain; public float fAttack = 10f; public float fRelease = 200f; public float fThreshold = -20f; public float fRatio = 3f; public float fPredelay = 4f; public BASS_DX8_COMPRESSOR() { } public BASS_DX8_COMPRESSOR(float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay) { fGain = Gain; fAttack = Attack; fRelease = Release; fThreshold = Threshold; fRatio = Ratio; fPredelay = Predelay; } public void Preset_Default() { fGain = 0f; fAttack = 10f; fRelease = 200f; fThreshold = -20f; fRatio = 3f; fPredelay = 4f; } public void Preset_Soft() { fGain = 0f; fAttack = 12f; fRelease = 800f; fThreshold = -20f; fRatio = 3f; fPredelay = 4f; } public void Preset_Soft2() { fGain = 2f; fAttack = 20f; fRelease = 800f; fThreshold = -20f; fRatio = 4f; fPredelay = 4f; } public void Preset_Medium() { fGain = 4f; fAttack = 5f; fRelease = 600f; fThreshold = -20f; fRatio = 5f; fPredelay = 3f; } public void Preset_Hard() { fGain = 2f; fAttack = 2f; fRelease = 400f; fThreshold = -20f; fRatio = 8f; fPredelay = 2f; } public void Preset_Hard2() { fGain = 6f; fAttack = 2f; fRelease = 200f; fThreshold = -20f; fRatio = 10f; fPredelay = 2f; } public void Preset_HardCommercial() { fGain = 4f; fAttack = 5f; fRelease = 300f; fThreshold = -16f; fRatio = 9f; fPredelay = 2f; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_DISTORTION { public float fGain; public float fEdge = 50f; public float fPostEQCenterFrequency = 4000f; public float fPostEQBandwidth = 4000f; public float fPreLowpassCutoff = 4000f; public BASS_DX8_DISTORTION() { } public BASS_DX8_DISTORTION(float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff) { fGain = Gain; fEdge = Edge; fPostEQCenterFrequency = PostEQCenterFrequency; fPostEQBandwidth = PostEQBandwidth; fPreLowpassCutoff = PreLowpassCutoff; } public void Preset_Default() { fGain = 0f; fEdge = 50f; fPostEQCenterFrequency = 4000f; fPostEQBandwidth = 4000f; fPreLowpassCutoff = 4000f; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_ECHO { public float fWetDryMix; public float fFeedback; public float fLeftDelay = 333f; public float fRightDelay = 333f; [MarshalAs(UnmanagedType.Bool)] public bool lPanDelay; public BASS_DX8_ECHO() { } public BASS_DX8_ECHO(float WetDryMix, float Feedback, float LeftDelay, float RightDelay, bool PanDelay) { fWetDryMix = WetDryMix; fFeedback = Feedback; fLeftDelay = LeftDelay; fRightDelay = RightDelay; lPanDelay = PanDelay; } public void Preset_Default() { fWetDryMix = 50f; fFeedback = 0f; fLeftDelay = 333f; fRightDelay = 333f; lPanDelay = false; } public void Preset_Small() { fWetDryMix = 50f; fFeedback = 20f; fLeftDelay = 100f; fRightDelay = 100f; lPanDelay = false; } public void Preset_Long() { fWetDryMix = 50f; fFeedback = 20f; fLeftDelay = 700f; fRightDelay = 700f; lPanDelay = false; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_FLANGER { public float fWetDryMix; public float fDepth = 25f; public float fFeedback; public float fFrequency; public int lWaveform = 1; public float fDelay; public BASSFXPhase lPhase = BASSFXPhase.BASS_FX_PHASE_ZERO; public BASS_DX8_FLANGER() { } public BASS_DX8_FLANGER(float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, BASSFXPhase Phase) { fWetDryMix = WetDryMix; fDepth = Depth; fFeedback = Feedback; fFrequency = Frequency; lWaveform = Waveform; fDelay = Delay; lPhase = Phase; } public void Preset_Default() { fWetDryMix = 50f; fDepth = 25f; fFeedback = 0f; fFrequency = 0f; lWaveform = 1; fDelay = 0f; lPhase = BASSFXPhase.BASS_FX_PHASE_ZERO; } public void Preset_A() { fWetDryMix = 60f; fDepth = 60f; fFeedback = 25f; fFrequency = 5f; lWaveform = 1; fDelay = 1f; lPhase = BASSFXPhase.BASS_FX_PHASE_90; } public void Preset_B() { fWetDryMix = 75f; fDepth = 80f; fFeedback = 50f; fFrequency = 7f; lWaveform = 0; fDelay = 3f; lPhase = BASSFXPhase.BASS_FX_PHASE_NEG_90; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_GARGLE { public int dwRateHz = 500; public int dwWaveShape = 1; public BASS_DX8_GARGLE() { } public BASS_DX8_GARGLE(int RateHz, int WaveShape) { dwRateHz = RateHz; dwWaveShape = WaveShape; } public void Preset_Default() { dwRateHz = 100; dwWaveShape = 1; } } [Serializable] [StructLayout(LayoutKind.Sequential)] public sealed class BASS_DX8_I3DL2REVERB { public int lRoom = -1000; public int lRoomHF; public float flRoomRolloffFactor; public float flDecayTime = 1.49f; public float flDecayHFRatio = 0.83f; public int lReflections = -2602; public float flReflectionsDelay = 0.007f; public int lReverb = 200; public float flReverbDelay = 0.011f; public float flDiffusion = 100f; public float flDensity = 100f; public float flHFReference = 5000f; public BASS_DX8_I3DL2REVERB() { } public BASS_DX8_I3DL2REVERB(int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference) { lRoom = Room; lRoomHF = RoomHF; flRoomRolloffFactor = RoomRolloffFactor; fl