private float GetValue(BASSAttribute attr) { float value = 0; if (!Bass.BASS_ChannelGetAttribute(_handle, BASSAttribute.BASS_ATTRIB_FREQ, ref value)) throw new BASSException(); return value; }
/// <summary> /// 获取播放声道特性值 /// </summary> /// <param name="attri">要获取的特性</param> /// <returns>值</returns> public float GetChannelAttribute(BASSAttribute attri) { if (this._handle == -1) { return(0f); } return(Bass.BASS_ChannelGetAttribute(this._handle, attri)); }
/// <summary> /// 设置播放声道特性值 /// </summary> /// <param name="attri">要设置的特性</param> /// <param name="value">值</param> public void SetChannelAttribute(BASSAttribute attri, float value) { if (this._handle == -1) { return; } Bass.BASS_ChannelSetAttribute(this._handle, attri, value); }
/// <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="attribute">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 ChannelSetAttributeEx(int handle, BASSAttribute attribute, IntPtr value, int size) { bool result = NativeMethods.BASS_ChannelSetAttributeEx(handle, attribute, value, size); //If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code. if (!result) { throw new WavException(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="attribute">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="time">The length of time (in milliseconds) that it should take for the attribute to reach the value</param> public static void ChannelSlideAttribute(int handle, BASSAttribute attribute, float value, int time) { bool result = NativeMethods.BASS_ChannelSlideAttribute(handle, attribute, value, time); //If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code if (!result) { throw new WavException(BassErrorCode.GetErrorInfo()); } }
private void btnGetValue_Click(object sender, EventArgs e) { try { BASSAttribute attri = DropdownBoxHelper.GetEnumFromComboBox <BASSAttribute>(comboBoxBASSAttribute); txtInfo.Text = wavePlayer1.GetChannelAttribute(attri).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <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="attribute">The attribute to set 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="size">The size of the attribute data... 0 = get the size of the attribute without getting the data. </param> /// <returns>If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code</returns> public static int ChannelGetAttributeEx(int handle, BASSAttribute attribute, IntPtr value, int size) { int result = NativeMethods.BASS_ChannelGetAttributeEx(handle, attribute, value, size); //If successful, the size of the attribute data is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code. if (result == 0) { throw new WavException(BassErrorCode.GetErrorInfo()); } return(result); }
/// <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="attribute">The attribute to get the value of... one of the following.</param> /// <returns>Pointer to a variable to receive the attribute value</returns> public static float ChannelGetAttribute(int handle, BASSAttribute attribute) { float value = default(float); bool result = NativeMethods.BASS_ChannelGetAttribute(handle, attribute, ref value); //If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code. if (!result) { throw new WavException(BassErrorCode.GetErrorInfo()); } return(value); }
private void btnSetValue_Click(object sender, EventArgs e) { try { BASSAttribute attri = DropdownBoxHelper.GetEnumFromComboBox <BASSAttribute>(comboBoxBASSAttribute); float value = (float)(numAttriValue.Value / 100); wavePlayer1.SetChannelAttribute(attri, value); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <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> /// <param name="value">The new attribute value. See the attribute's documentation for details on the possible values. </param> /// <param name="size">The size of the attribute data... 0 = get the size of the attribute without getting the data. </param> /// <returns>If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code</returns> public static int BASS_ChannelGetAttributeEx(int handle, BASSAttribute attrib, IntPtr value, int size) { int result; if (Environment.Is64BitProcess) { result = BassX64.BASS_ChannelGetAttributeEx(handle, attrib, value, size); } else { result = BassX86.BASS_ChannelGetAttributeEx(handle, attrib, value, size); } return(result); }
/// <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> /// 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> /// 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); }
public static extern bool BASS_ChannelIsSliding(int handle, BASSAttribute attrib);
private void SetValue(BASSAttribute attr, float value) { if (!Bass.BASS_ChannelSetAttribute(_handle, BASSAttribute.BASS_ATTRIB_FREQ, value)) throw new BASSException(); }
static extern bool BASS_ChannelSetAttribute(int handle, BASSAttribute attr,float pitch);
/// <summary> /// Sets an attribute value of the current channel (specified in the attribute property). /// </summary> /// <param name="attribute">Channel attribute</param> /// <param name="value">Value</param> public void SetAttribute(BASSAttribute attribute, float value) { // Set attribute value if (!Bass.BASS_ChannelSetAttribute(handle, attribute, value)) { // Check for error Base.CheckForError(); } }
public static extern bool BASS_ChannelSetAttributeEx(int handle, BASSAttribute attrib, IntPtr value, int size);
/// <summary> /// Checks if an attribute (or any attribute) of a sample, stream, or MOD music is sliding /// </summary> /// <param name="handle">The channel handle... a HCHANNEL, HSTREAM or HMUSIC</param> /// <param name="attribute">The attribute to check for sliding... one of the following, or 0 for any attribute. /// BASS_ATTRIB_EAXMIX EAX wet/dry mix. /// BASS_ATTRIB_FREQ Sample rate. /// BASS_ATTRIB_PAN Panning/balance position. /// BASS_ATTRIB_VOL Volume level. /// BASS_ATTRIB_MUSIC_AMPLIFY Amplification level. (HMUSIC only) /// BASS_ATTRIB_MUSIC_BPM BPM. (HMUSIC) /// BASS_ATTRIB_MUSIC_PANSEP Pan separation level. (HMUSIC) /// BASS_ATTRIB_MUSIC_PSCALER Position scaler. (HMUSIC) /// BASS_ATTRIB_MUSIC_SPEED Speed. (HMUSIC) /// BASS_ATTRIB_MUSIC_VOL_CHAN A channel volume level. (HMUSIC) /// BASS_ATTRIB_MUSIC_VOL_GLOBAL Global volume level. (HMUSIC) /// BASS_ATTRIB_MUSIC_VOL_INST An instrument/sample volume level. (HMUSIC) /// other attributes may be supported by add-ons, see the documentation.</param> /// <returns>If the attribute is sliding, then TRUE is returned, else FALSE is returned.</returns> public static bool ChannelIsSliding(int handle, BASSAttribute attribute) { return(NativeMethods.BASS_ChannelIsSliding(handle, attribute)); }
public static extern bool BASS_ChannelSlideAttribute(int handle, BASSAttribute attrib, float value, int time);
public static extern bool BASS_ChannelGetAttribute(int handle, BASSAttribute attrib, ref float value);
public static extern bool BASS_ChannelSetAttribute(int handle, BASSAttribute attrib, float value);