public void applyNormalize(bool isApply) { if (_gain != null) { if (isApply) { _gain.SetBypass(false); // getgain float gain = 0; Un4seen.Bass.Utils.GetNormalizationGain(_filePath, 30f, -1, -1, ref gain); //Debug.WriteLine("normalize gain:" + gain); //Debug.WriteLine("music gain " + _gain.Gain); //Debug.WriteLine("music gaindb " + _gain.Gain_dBV); //Debug.WriteLine("diff gaindb " + (Un4seen.Bass.Utils.LevelToDB(gain, 1) * -1)); //if (gain < 1.0f) //{ _gain.Gain_dBV = (Un4seen.Bass.Utils.LevelToDB(gain, 1) * -1); //} } else { _gain.SetBypass(true); } } }
private void SetDSPGain(double gainDB) { if (_gain == null) { _gain = new DSP_Gain(); } if (gainDB == 0.0) { _gain.SetBypass(true); } else { _gain.SetBypass(false); _gain.Gain_dBV = gainDB; } }
/// <summary> /// Sets the parameter for a given Bass effect /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="value"></param> /// <param name="format"></param> private void setBassDSP(string id, string name, string value) { switch (id) { case "Gain": if (name == "Gain_dbV") { double gainDB = double.Parse(value); if (_gain == null) { _gain = new DSP_Gain(); } if (gainDB == 0.0) { _gain.SetBypass(true); } else { _gain.SetBypass(false); _gain.Gain_dBV = gainDB; } } break; case "DynAmp": if (name == "Preset") { if (_damp == null) { _damp = new BASS_BFX_DAMP(); } switch (Convert.ToInt32(value)) { case 0: _damp.Preset_Soft(); break; case 1: _damp.Preset_Medium(); break; case 2: _damp.Preset_Hard(); break; } } break; case "Compressor": if (name == "Threshold") { if (_comp == null) { _comp = new BASS_BFX_COMPRESSOR(); } _comp.Preset_Medium(); _comp.fThreshold = (float)Un4seen.Bass.Utils.DBToLevel(Convert.ToInt32(value) / 10d, 1.0); } break; } }