/// <summary> /// Sets the equalizer value according to frequency. /// </summary> /// <param name="frequency"></param> /// <param name="value"></param> public void SetEqualizerFrequency(Int32 frequency, Double value) { EqualizerValue equalizerValue = new EqualizerValue(frequency, value); BASS_DX8_PARAMEQ parameqDX8 = new BASS_DX8_PARAMEQ(); if (values.ContainsKey(frequency)) { Handle eqValueHandle = values[frequency]?.Handle; if (eqValueHandle != null) { Bass.BASS_ChannelRemoveFX(handle, eqValueHandle); } } Int32 fxHandle = Bass.BASS_ChannelSetFX(handle, BASSFXType.BASS_FX_DX8_PARAMEQ, frequency); equalizerValue.Handle = new Handle(fxHandle); parameqDX8.fCenter = frequency; parameqDX8.fGain = (Single)value; parameqDX8.fBandwidth = 8f; Bass.BASS_FXSetParameters(equalizerValue.Handle, parameqDX8); values[frequency] = equalizerValue; }
public void SetEqualizerPosition(int freq, float position) { var par = new BASS_DX8_PARAMEQ(freq, 5, position); Bass.BASS_FXSetParameters(GetFXHandle(freq), par); _lastEqualizerValues[freq] = position; }
private void UpdateEQ(int band, float gain) { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(_fxEQ[band], eq)) { eq.fGain = gain; Bass.BASS_FXSetParameters(_fxEQ[band], eq); } }
public float GetEqualizerPosition(int freq) { var par = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(GetFXHandle(freq), par)) { return(par.fGain); } return(0); }
private void SetBassEq(decimal gain) { // 3-band EQ var eq = new BASS_DX8_PARAMEQ { fBandwidth = 18f, fCenter = 100f, fGain = (float) gain }; Bass.BASS_FXSetParameters(_eqChannel, eq); }
public static void UpdateEq(int band, double gain) { Eq[band] = gain; var eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(FxEq[band], eq)) { eq.fGain = (float)gain; Bass.BASS_FXSetParameters(FxEq[band], eq); } }
//public void SetReverb(int progress) //{ // BASS_DX8_REVERB p = new BASS_DX8_REVERB(); // Bass.BASS_FXGetParameters(fxReverb, p); // p.fReverbMix = (float)(progress > 15 ? Math.Log((double)progress / 20.0) * 20.0 : -96.0); // Bass.BASS_FXSetParameters(fxReverb, p); //} public void UpdateEQ(int band, float gain) { BASS_DX8_PARAMEQ p = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(fxBands[band], p)) { gains[band] = gain; p.fGain = gain; Bass.BASS_FXSetParameters(fxBands[band], p); } }
private void SetBassEq(decimal gain) { // 3-band EQ var eq = new BASS_DX8_PARAMEQ { fBandwidth = 18f, fCenter = 100f, fGain = (float)gain }; Bass.BASS_FXSetParameters(_eqChannel, eq); }
private void UpdateEQ(int band, float gain) { try { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(Player.PlayController.bassEng._fxEQ[band], eq)) { eq.fGain = gain; Bass.BASS_FXSetParameters(Player.PlayController.bassEng._fxEQ[band], eq); } } catch { } }
public void SetEQ(int index, float gain) { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (fxEQ.Length > 0) { if (Bass.BASS_FXGetParameters(fxEQ[index], eq)) { eq.fGain = gain; Bass.BASS_FXSetParameters(fxEQ[index], eq); } } }
public void InitEQ(float[] eqItems) { fxEQ = new int[eqItems.Length]; for (int i = 0; i < eqItems.Length; i++) { fxEQ[i] = Bass.BASS_ChannelSetFX(this.Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); eq.fCenter = eqItems[i]; Bass.BASS_FXSetParameters(fxEQ[i], eq); } }
/// <summary> ///初始化EQ /// </summary> private void InitializeEQ() { // 10段 EQ BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); fxEQ[0] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[1] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[2] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[3] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[4] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[5] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[6] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[7] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[8] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[9] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fCenter = 80f;//80Hz eq.fGain = MyEQ[0]; Bass.BASS_FXSetParameters(fxEQ[0], eq); eq.fCenter = 170f;//170Hz eq.fGain = MyEQ[1]; Bass.BASS_FXSetParameters(fxEQ[1], eq); eq.fCenter = 370f;//370Hz eq.fGain = MyEQ[2]; Bass.BASS_FXSetParameters(fxEQ[2], eq); eq.fCenter = 600f;//600Hz eq.fGain = MyEQ[3]; Bass.BASS_FXSetParameters(fxEQ[3], eq); eq.fCenter = 1000f;//1000Hz eq.fGain = MyEQ[4]; Bass.BASS_FXSetParameters(fxEQ[4], eq); eq.fCenter = 3000f;//3000Hz eq.fGain = MyEQ[5]; Bass.BASS_FXSetParameters(fxEQ[5], eq); eq.fCenter = 6000f;//6000Hz eq.fGain = MyEQ[6]; Bass.BASS_FXSetParameters(fxEQ[6], eq); eq.fCenter = 12000f;//12000Hz eq.fGain = MyEQ[7]; Bass.BASS_FXSetParameters(fxEQ[7], eq); eq.fCenter = 14000f;//14000Hz eq.fGain = MyEQ[8]; Bass.BASS_FXSetParameters(fxEQ[8], eq); eq.fCenter = 15000f;//15000Hz eq.fGain = MyEQ[9]; Bass.BASS_FXSetParameters(fxEQ[9], eq); }
/// <summary> /// Установка эффектов /// </summary> /// <param name="echo"></param> /// <param name="chorus"></param> /// <param name="eq"></param> /// <param name="save"></param> public static void SetEffects(float echo = 0f, float chorus = 0f, float volume = 1f, float[] eq = null, bool save = true) { Echo.fWetDryMix = echo; Bass.BASS_FXSetParameters(FXEchoHandle, Echo); Chorus.fWetDryMix = chorus; Bass.BASS_FXSetParameters(FXChorusHandle, Chorus); VolumeFX.fTarget = volume; VolumeFX.lCurve = 1; Bass.BASS_FXSetParameters(FXVolumeHandle, VolumeFX); BASS_DX8_PARAMEQ parameter = new BASS_DX8_PARAMEQ(); parameter.fBandwidth = 2.5f; if (eq == null) { eq = new float[18]; } for (int i = 0; i < FX.Length; i++) { parameter.fGain = eq[i]; parameter.fCenter = Frequencies[i]; Bass.BASS_FXSetParameters(FX[i], parameter); } if (save) { Properties.Settings.Default.Chorus = chorus; Properties.Settings.Default.Echo = echo; Properties.Settings.Default.VolumeFX = volume; Properties.Settings.Default.EQ0 = eq[0]; Properties.Settings.Default.EQ1 = eq[1]; Properties.Settings.Default.EQ2 = eq[2]; Properties.Settings.Default.EQ3 = eq[3]; Properties.Settings.Default.EQ4 = eq[4]; Properties.Settings.Default.EQ5 = eq[5]; Properties.Settings.Default.EQ6 = eq[6]; Properties.Settings.Default.EQ7 = eq[7]; Properties.Settings.Default.EQ8 = eq[8]; Properties.Settings.Default.EQ9 = eq[9]; Properties.Settings.Default.EQ10 = eq[10]; Properties.Settings.Default.EQ11 = eq[11]; Properties.Settings.Default.EQ12 = eq[12]; Properties.Settings.Default.EQ13 = eq[13]; Properties.Settings.Default.EQ14 = eq[14]; Properties.Settings.Default.EQ15 = eq[15]; Properties.Settings.Default.EQ16 = eq[16]; Properties.Settings.Default.EQ17 = eq[17]; Properties.Settings.Default.Save(); } }
/// <summary> ///初始化EQ /// </summary> private void InitializeEQ() { // 10段 EQ BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); fxEQ[0] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[1] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[2] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[3] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[4] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[5] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[6] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[7] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[8] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); fxEQ[9] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fCenter = 32f;//32Hz eq.fGain = MyEQ[0]; Bass.BASS_FXSetParameters(fxEQ[0], eq); eq.fCenter = 64f;//64Hz eq.fGain = MyEQ[1]; Bass.BASS_FXSetParameters(fxEQ[1], eq); eq.fCenter = 125f;//125Hz eq.fGain = MyEQ[2]; Bass.BASS_FXSetParameters(fxEQ[2], eq); eq.fCenter = 250f;//250Hz eq.fGain = MyEQ[3]; Bass.BASS_FXSetParameters(fxEQ[3], eq); eq.fCenter = 500f;//500Hz eq.fGain = MyEQ[4]; Bass.BASS_FXSetParameters(fxEQ[4], eq); eq.fCenter = 1000f;//1000Hz eq.fGain = MyEQ[5]; Bass.BASS_FXSetParameters(fxEQ[5], eq); eq.fCenter = 2000f;//2000Hz eq.fGain = MyEQ[6]; Bass.BASS_FXSetParameters(fxEQ[6], eq); eq.fCenter = 4000f;//4000Hz eq.fGain = MyEQ[7]; Bass.BASS_FXSetParameters(fxEQ[7], eq); eq.fCenter = 8000f;//8000Hz eq.fGain = MyEQ[8]; Bass.BASS_FXSetParameters(fxEQ[8], eq); eq.fCenter = 16000f;//16000Hz eq.fGain = MyEQ[9]; Bass.BASS_FXSetParameters(fxEQ[9], eq); }
private void buttonPlay_Click(object sender, System.EventArgs e) { Bass.BASS_StreamFree(_Stream); // test BASS_ChannelSetFX if (_FileName != String.Empty) { // create the stream _Stream = Bass.BASS_StreamCreateFile(_FileName, 0, 0, BASSFlag.BASS_DEFAULT); // create some FX... _fxChorusHandle = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_CHORUS, 1); _chorus.fWetDryMix = 0f; trackBarChorus.Value = 0; Bass.BASS_FXSetParameters(_fxChorusHandle, _chorus); _fxEchoHandle = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_ECHO, 2); _echo.fWetDryMix = 0f; trackBarEcho.Value = 0; Bass.BASS_FXSetParameters(_fxEchoHandle, _echo); // 3-band EQ BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); _fxEQ[0] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[1] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[2] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fCenter = 100f; eq.fGain = this.trackBarLowEQ.Value / 10f; Bass.BASS_FXSetParameters(_fxEQ[0], eq); eq.fCenter = 1000f; eq.fGain = this.trackBarMidEQ.Value / 10f; Bass.BASS_FXSetParameters(_fxEQ[1], eq); eq.fCenter = 8000f; eq.fGain = this.trackBarHighEQ.Value / 10f; Bass.BASS_FXSetParameters(_fxEQ[2], eq); // play the stream if (_Stream != 0 && Bass.BASS_ChannelPlay(_Stream, false)) { //playing... } else { MessageBox.Show(this, "Error: " + Enum.GetName(typeof(BASSError), Bass.BASS_ErrorGetCode())); } } }
public void Equalize() { // 3-band EQ BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); _fxEQ[0] = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[1] = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[2] = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fCenter = 100f; eq.fGain = 0f; Bass.BASS_FXSetParameters(_fxEQ[0], eq); eq.fCenter = 1000f; Bass.BASS_FXSetParameters(_fxEQ[1], eq); eq.fCenter = 8000f; Bass.BASS_FXSetParameters(_fxEQ[2], eq); }
private void openfile_FileOk(object sender, CancelEventArgs e) { if (openfile.FileName != String.Empty) { audioPath = openfile.FileName; fileName.Text = audioPath; playButton.Enabled = true; saveButton.Enabled = true; Bass.BASS_StreamFree(audioStream); Bass.BASS_StreamFree(fxStream); audioStream = Bass.BASS_StreamCreateFile(audioPath, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN); if (audioStream != 0) { fxStream = BassFx.BASS_FX_TempoCreate(audioStream, BASSFlag.BASS_FX_FREESOURCE); if (fxStream != 0) { // Вешаем эффекты до воиспроизведения, чтобы не было задержки distortion = Bass.BASS_ChannelSetFX(fxStream, BASSFXType.BASS_FX_BFX_DISTORTION, -4); BASS_BFX_DISTORTION dist = new BASS_BFX_DISTORTION(); dist.fDrive = distAmount.Value; dist.fDryMix = 5.0f; dist.fWetMix = distAmount.Value / 3.0f; dist.fFeedback = -0.5f; dist.fVolume = 0.1f; Bass.BASS_FXSetParameters(distortion, dist); // -- bassboost = Bass.BASS_ChannelSetFX(fxStream, BASSFXType.BASS_FX_DX8_PARAMEQ, -4); BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); eq.fBandwidth = 24; eq.fCenter = 80; eq.fGain = bassAmount.Value; Bass.BASS_FXSetParameters(bassboost, eq); bassboost2 = Bass.BASS_ChannelSetFX(fxStream, BASSFXType.BASS_FX_DX8_PARAMEQ, -4); Bass.BASS_FXSetParameters(bassboost2, eq); return; } } MessageBox.Show(this, "Чот нихуя"); } }
private void bassAmount_Scroll(object sender, EventArgs e) { if (fxStream != 0) { // Изменения гейна эквалайзеров BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); Bass.BASS_FXGetParameters(bassboost, eq); eq.fGain = bassAmount.Value; Bass.BASS_FXSetParameters(bassboost, eq); Bass.BASS_FXSetParameters(bassboost2, eq); // Делаем кол-во Ы в лейбле равным бусту bassAmountLabel.Text = "БасЫ"; for (int i = 1; i <= bassAmount.Value; i++) { bassAmountLabel.Text += "ы"; } } }
/// <summary> /// 更新EQ,使EQ设置生效 /// </summary> /// <returns></returns> public bool UpdateEQ() { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); for (int i = 0; i < 10; i++) { if (Bass.BASS_FXGetParameters(fxEQ[i], eq)) { eq.fGain = MyEQ[i]; if (!Bass.BASS_FXSetParameters(fxEQ[i], eq)) { return(false); } } else { return(false); } } return(true); }
public static void SetBFX_EQ() { var eq = new BASS_DX8_PARAMEQ(); FxEq[0] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[1] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[2] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[3] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[4] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[5] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[6] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[7] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[8] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[9] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[10] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[11] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[12] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[13] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[14] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[15] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[16] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); FxEq[17] = Bass.BASS_ChannelSetFX(Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fGain = 0f; eq.fCenter = 31f; Bass.BASS_FXSetParameters(FxEq[0], eq); eq.fCenter = 63f; Bass.BASS_FXSetParameters(FxEq[1], eq); eq.fCenter = 87f; Bass.BASS_FXSetParameters(FxEq[2], eq); eq.fCenter = 125f; Bass.BASS_FXSetParameters(FxEq[3], eq); eq.fCenter = 175f; Bass.BASS_FXSetParameters(FxEq[4], eq); eq.fCenter = 250f; Bass.BASS_FXSetParameters(FxEq[5], eq); eq.fCenter = 350f; Bass.BASS_FXSetParameters(FxEq[6], eq); eq.fCenter = 500f; Bass.BASS_FXSetParameters(FxEq[7], eq); eq.fCenter = 700f; Bass.BASS_FXSetParameters(FxEq[8], eq); eq.fCenter = 1000f; Bass.BASS_FXSetParameters(FxEq[9], eq); eq.fCenter = 1400f; Bass.BASS_FXSetParameters(FxEq[10], eq); eq.fCenter = 2000f; Bass.BASS_FXSetParameters(FxEq[11], eq); eq.fCenter = 2800f; Bass.BASS_FXSetParameters(FxEq[12], eq); eq.fCenter = 4000f; Bass.BASS_FXSetParameters(FxEq[13], eq); eq.fCenter = 5600f; Bass.BASS_FXSetParameters(FxEq[14], eq); eq.fCenter = 8000f; Bass.BASS_FXSetParameters(FxEq[15], eq); eq.fCenter = 11200f; Bass.BASS_FXSetParameters(FxEq[16], eq); eq.fCenter = 16000f; Bass.BASS_FXSetParameters(FxEq[17], eq); }
private int SetEQ(int _Stream) { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); _fxEQ[0] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[1] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[2] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[3] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[4] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[5] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[6] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[7] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[8] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[9] = Bass.BASS_ChannelSetFX(_Stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; float[] fCenters = { 31f, 62f, 125f, 250f, 500f, 1000f, 2000f, 4000f, 8000f, 16000f }; for (int i = 0; i < 10; i++) { eq.fCenter = fCenters[i]; eq.fGain = 0; Bass.BASS_FXSetParameters(_fxEQ[i], eq); } #region 老的方法 //eq.fCenter = 31f; //eq.fGain = (float)Player.PlayController.EQS.silder0.Value/ 10f; //Bass.BASS_FXSetParameters(_fxEQ[0], eq); //eq.fCenter = 62f; //eq.fGain = (float)Player.PlayController.EQS.silder1.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[1], eq); //eq.fCenter = 125f; //eq.fGain = (float)Player.PlayController.EQS.silder2.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[2], eq); //eq.fCenter = 250f; //eq.fGain = (float)Player.PlayController.EQS.silder3.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[3], eq); //eq.fCenter = 500f; //eq.fGain = (float)Player.PlayController.EQS.silder4.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[4], eq); //eq.fCenter = 1000f; //eq.fGain = (float)Player.PlayController.EQS.silder5.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[5], eq); //eq.fCenter = 2000f; //eq.fGain = (float)Player.PlayController.EQS.silder6.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[6], eq); //eq.fCenter = 4000f; //eq.fGain = (float)Player.PlayController.EQS.silder7.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[7], eq); //eq.fCenter = 8000f; //eq.fGain = (float)Player.PlayController.EQS.silder8.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[8], eq); //eq.fCenter = 16000f; //eq.fGain = (float)Player.PlayController.EQS.silder9.Value / 10f; //Bass.BASS_FXSetParameters(_fxEQ[9], eq); #endregion return(_Stream); }
private void UpdateGain(int band, float gain) { var eq = new BASS_DX8_PARAMEQ(); BandValue bandVal = _bands[band]; bandVal.Gain = gain; if (!_enabled) return; int handle = bandVal.Handle; if (!Bass.BASS_FXGetParameters(handle, eq)) return; eq.fGain = gain; Bass.BASS_FXSetParameters(handle, eq); }
private void Activate() { if (_handle == -1) return; var eq = new BASS_DX8_PARAMEQ(); for (int i = 0; i < _bands.Length; i++) { _bands[i].Handle = Bass.BASS_ChannelSetFX(_handle, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fCenter = _cenders[i]; Bass.BASS_FXSetParameters(_bands[i].Handle, eq); } OnPropertyChangedExplicit("Band0"); OnPropertyChangedExplicit("Band1"); OnPropertyChangedExplicit("Band2"); OnPropertyChangedExplicit("Band3"); OnPropertyChangedExplicit("Band4"); OnPropertyChangedExplicit("Band5"); OnPropertyChangedExplicit("Band6"); OnPropertyChangedExplicit("Band7"); OnPropertyChangedExplicit("Band8"); OnPropertyChangedExplicit("Band9"); }
private float GetGain(int band) { BandValue bandValue = _bands[band]; if (!_enabled) return bandValue.Gain; var eq = new BASS_DX8_PARAMEQ(); int handle = bandValue.Handle; return Bass.BASS_FXGetParameters(handle, eq) ? eq.fGain : bandValue.Gain; }
public void UpdateEQ(int band, float gain) { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(_fxEQ[band], eq)) { eq.fGain = gain; Bass.BASS_FXSetParameters(_fxEQ[band], eq); } }
public void EqualizerApplyForNewTrack() { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); for (int i = 0; i < 12; i++) { eqalizer._fxEQ[i] = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); } eq.fBandwidth = 2.5f; for (int i = 0; i < 12; i++) { eq.fCenter = eqalizer.GetFraquencyByIndex(0); eq.fGain = eqalizer.GetValueByIndex(0); Bass.BASS_FXSetParameters(eqalizer._fxEQ[0], eq); } }
/// <summary> /// Reads the FX parameters from the current equalizer profile and updates /// the sound accordingly. /// </summary> public static void UpdateFXParameters() { echo.fWetDryMix = SettingsManager.CurrentEqualizerProfile.EchoLevel; Bass.BASS_FXSetParameters(fxEchoHandle, echo); for (int band = 0; band < SettingsManager.CurrentEqualizerProfile.Levels.Count(); band++) { float gain = SettingsManager.CurrentEqualizerProfile.Levels[band]; BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(eqBands[band], eq)) { eq.fGain = gain; Bass.BASS_FXSetParameters(eqBands[band], eq); } } }
private void UpdateEQ(int band) { BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); if (Bass.BASS_FXGetParameters(eqalizer._fxEQ[band], eq)) { eq.fGain = eqalizer.GetValueByIndex(band); Bass.BASS_FXSetParameters(eqalizer._fxEQ[band], eq); } }
/// <summary> /// Sets the effects (volume, equalizer, echo, etc) on the audio channels. /// </summary> private static void SetFX() { Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, (float)SettingsManager.Volume / 100); fxEchoHandle = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_ECHO, 2); echo.fWetDryMix = SettingsManager.CurrentEqualizerProfile.EchoLevel; Bass.BASS_FXSetParameters(fxEchoHandle, echo); float[] bands = new float[8] { 125f, 256f, 512f, 1024f, 2048f, 4096f, 8192f, 16384f }; for (int i = 0; i < 8; i++) { int channel = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); BASS_DX8_PARAMEQ param = new BASS_DX8_PARAMEQ(); param.fCenter = bands[i]; param.fGain = SettingsManager.CurrentEqualizerProfile.Levels[i]; Bass.BASS_FXSetParameters(channel, param); } }
private void SetFXParameters() { _fxChorusHandle = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_CHORUS, 1); _chorus.fWetDryMix = 0f; //trackBarChorus.Value = 0; Bass.BASS_FXSetParameters(_fxChorusHandle, _chorus); _fxEchoHandle = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_ECHO, 2); _echo.fWetDryMix = 0f; //trackBarEcho.Value = 0; Bass.BASS_FXSetParameters(_fxEchoHandle, _echo); // tu gdzies jest blad :P // 3-band EQ BASS_DX8_PARAMEQ eq = new BASS_DX8_PARAMEQ(); _fxEQ[0] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[1] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[2] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[3] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[4] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[5] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[6] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[7] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[8] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); _fxEQ[9] = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_DX8_PARAMEQ, 0); eq.fBandwidth = 18f; eq.fCenter = 50f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[0], eq); eq.fBandwidth = 18f; eq.fCenter = 100f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[1], eq); eq.fBandwidth = 18f; eq.fCenter = 200f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[2], eq); eq.fBandwidth = 18f; eq.fCenter = 400f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[3], eq); eq.fBandwidth = 18f; eq.fCenter = 700f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[4], eq); eq.fBandwidth = 18f; eq.fCenter = 1000f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[5], eq); eq.fBandwidth = 18f; eq.fCenter = 2000f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[6], eq); eq.fBandwidth = 18f; eq.fCenter = 4000f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[7], eq); eq.fBandwidth = 18f; eq.fCenter = 6000f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[8], eq); eq.fBandwidth = 18f; eq.fCenter = 8000f; eq.fGain = 0 / 10f; Bass.BASS_FXSetParameters(_fxEQ[9], eq); fxChanged = true; }