示例#1
0
        /// <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());
            }
        }
示例#2
0
        /// <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());
            }
        }
示例#3
0
        /// <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());
            }
        }
示例#4
0
        /// <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)));
        }
示例#5
0
        /// <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);
        }
示例#6
0
        /// <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);
        }
示例#7
0
        /// <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);
        }
示例#8
0
        /// <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());
            }
        }
示例#9
0
        /// <summary>
        /// 获取错误信息
        /// </summary>
        /// <returns>错误信息</returns>
        public static string GetErrorInfo()
        {
            int errCode = Bass.BASS_ErrorGetCode();

            return(BassErrorCode.GetErrorInfo(errCode));
        }