/// <summary> /// Sets the value of a channel's attribute /// </summary> /// <param name="handle">The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD</param> /// <param name="attrib">The attribute to set the value of... one of the following. /// BASS_ATTRIB_SCANINFO Scanned info. (HSTREAM only) /// other attributes may be supported by add-ons, see the documentation</param> /// <param name="value">The new attribute data</param> /// <param name="size">The size of the attribute data</param> public static void BASS_ChannelSetAttributeEx(int handle, BASSAttribute attrib, IntPtr value, int size) { bool result = false; if (Environment.Is64BitProcess) { result = BassX64.BASS_ChannelSetAttributeEx(handle, attrib, value, size); } else { result = BassX86.BASS_ChannelSetAttributeEx(handle, attrib, value, size); } if (!result) { throw new ApplicationException("BASS_ChannelSetAttributeEx Fail," + BassErrorCode.GetErrorInfo()); } }
/// <summary> /// Slides a channel's attribute from its current value to a new value /// </summary> /// <param name="handle">The channel handle... a HCHANNEL, HSTREAM, HMUSIC, or HRECORD</param> /// <param name="attrib">The attribute to slide the value of... one of the following,other attributes may be supported by add-ons, see the documentation</param> /// <param name="value">The new attribute value. See the attribute's documentation for details on the possible values. </param> /// <param name="duration">The length of time (in milliseconds) that it should take for the attribute to reach the value</param> /// <returns>If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code</returns> public static void BASS_ChannelSlideAttribute(int handle, BASSAttribute attrib, float value, int duration) { bool result = false; if (Environment.Is64BitProcess) { result = BassX64.BASS_ChannelSlideAttribute(handle, attrib, value, duration); } else { result = BassX86.BASS_ChannelSlideAttribute(handle, attrib, value, duration); } if (!result) { throw new ApplicationException("BASS_ChannelSlideAttribute Fail," + BassErrorCode.GetErrorInfo()); } }
/// <summary> /// Unplugs an add-on. /// </summary> /// <param name="handle">The plugin handle... 0 = all plugins</param> public static void BASS_PluginFree(int handle) { bool result = false; if (Environment.Is64BitProcess) { result = BassX64.BASS_PluginFree(handle); } else { result = BassX86.BASS_PluginFree(handle); } if (!result) { throw new ApplicationException("BASS_PluginGetInfo Fail," + BassErrorCode.GetErrorInfo()); } }
/// <summary> /// Retrieves information on a plugin /// </summary> /// <param name="handle">The plugin handle</param> /// <returns>插件信息</returns> public static BASS_PLUGINFORM BASS_PluginGetInfo(int handle) { IntPtr ptr; if (Environment.Is64BitProcess) { ptr = BassX64.BASS_PluginGetInfo(handle); } else { ptr = BassX86.BASS_PluginGetInfo(handle); } if (ptr == IntPtr.Zero) { throw new ApplicationException("BASS_PluginGetInfo Fail," + BassErrorCode.GetErrorInfo()); } return((BASS_PLUGINFORM)Marshal.PtrToStructure(ptr, typeof(BASS_PLUGININFO))); }
/// <summary> /// Plugs an "add-on" into the standard stream and sample creation functions /// </summary> /// <param name="file">Filename of the add-on/plugin</param> /// <returns>the loaded plugin's handle is returned</returns> public static int BASS_PluginLoad(string file) { int hplugin; if (Environment.Is64BitProcess) { hplugin = BassX64.BASS_PluginLoad(file, BASSFileFlag.BASS_UNICODE); } else { hplugin = BassX86.BASS_PluginLoad(file, BASSFileFlag.BASS_UNICODE); } if (hplugin == 0) { throw new ApplicationException("BASS_PluginLoad Fail," + BassErrorCode.GetErrorInfo()); } return(hplugin); }
/// <summary> /// Retrieves the value of a channel's attribute /// </summary> /// <param name="handle">The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD</param> /// <param name="attrib">The attribute to set the value of... one of the following,other attributes may be supported by add-ons, see the documentation</param> public static float BASS_ChannelGetAttribute(int handle, BASSAttribute attrib) { float value = 0; bool result = false; if (Environment.Is64BitProcess) { result = BassX64.BASS_ChannelGetAttribute(handle, attrib, ref value); } else { result = BassX86.BASS_ChannelGetAttribute(handle, attrib, ref value); } if (!result) { throw new ApplicationException("BASS_ChannelGetAttribute Fail," + BassErrorCode.GetErrorInfo()); } return(value); }
/// <summary> /// 打开文件 /// </summary> /// <param name="mem">true:流;false:文件</param> /// <param name="file">文件路径</param> /// <param name="offset"></param> /// <param name="length"></param> /// <param name="flags"></param> public static int BASS_StreamCreateFile(bool mem, string file, long offset, long length, BASSFileFlag flags) { int handle; if (Environment.Is64BitProcess) { handle = BassX64.BASS_StreamCreateFile(mem, file, offset, length, flags); } else { handle = BassX86.BASS_StreamCreateFile(mem, file, offset, length, flags); } int errCode = Bass.BASS_ErrorGetCode(); if (errCode != BassErrorCode.BASS_OK) { throw new Exception(BassErrorCode.GetErrorInfo()); } return(handle); }
/// <summary> /// Retrieves information on a channel /// </summary> /// <param name="handle">The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD</param> /// <returns>If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code</returns> public static BASS_CHANNELINFO_INTERNAL BASS_ChannelGetInfo(int handle) { BASS_CHANNELINFO_INTERNAL info = new BASS_CHANNELINFO_INTERNAL(); bool result = false; if (Environment.Is64BitProcess) { result = BassX64.BASS_ChannelGetInfo(handle, ref info); } else { result = BassX86.BASS_ChannelGetInfo(handle, ref info); } if (result) { return(info); } else { throw new ApplicationException("BASS_ChannelGetInfo Fail," + BassErrorCode.GetErrorInfo()); } }
/// <summary> /// 获取错误信息 /// </summary> /// <returns>错误信息</returns> public static string GetErrorInfo() { int errCode = Bass.BASS_ErrorGetCode(); return(BassErrorCode.GetErrorInfo(errCode)); }