static string PtrToString(IntPtr ptr) { if (ptr == IntPtr.Zero) { return(null); } var unicodeWin = Bass.GetConfig(Configuration.UnicodeDeviceInformation); switch (unicodeWin) { case -1: return(Extensions.PtrToStringUtf8(ptr)); case 0: return(Marshal.PtrToStringAnsi(ptr)); default: return(Extensions.PtrToStringUtf8(ptr)); } }