internal static void SetConfig() { if (UpdatePeriod < 5) { LogicError.Throw(eLogicError.X160); return; } //CheckOK(Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, UpdatePeriod)); Bass.UpdatePeriod = UpdatePeriod; BassInfo info = new BassInfo(); if (Bass.GetInfo(out info)) { BassInfo = info; if (P.frmConfigBass != null) { P.frmConfigBass.lblMinBuf.Text = BassInfo.MinBufferLength.ToString(); P.frmConfigBass.lblLatency.Text = BassInfo.Latency.ToString(); } if (BufferSize <= 10) //10 is min, but may be defaulted to by BASS { int minbuf = (BassInfo.MinBufferLength > 0) ? BassInfo.MinBufferLength : 100; BufferSize = UpdatePeriod + minbuf + BufferMargin; if (P.frmConfigBass != null) { P.frmConfigBass.Bypass_Event = true; P.frmConfigBass.nudBuffer.Value = BufferSize; P.frmConfigBass.Bypass_Event = false; } } } //CheckOK(Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, BufferSize)); Bass.PlaybackBufferLength = BufferSize; }
private void SetLatencyFromDevice(NumericUpDown nud) { if (clsBASSOutDev.indAsio) { double rate = BassAsio.Rate; int latency = BassAsio.GetLatency(false); int ms = (int)(latency * 1000 / rate); if (ms <= 5) { ms = 0; //not worth using timer delay } nud.Value = ms; } else //non-ASIO { BassInfo info = new BassInfo(); if (Bass.GetInfo(out info)) { clsBASSOutDevNonAsio.BassInfo = info; } if (clsBASSOutDevNonAsio.BassInfo.Latency > 0) { nud.Value = clsBASSOutDevNonAsio.BassInfo.Latency; } } }
internal override void ShowCurrentConnectionSub() { try { Frm.Bypass_Event = true; int buffer = Bass.GetConfig(Configuration.PlaybackBufferLength); if (buffer >= Frm.nudBuffer.Minimum && buffer <= Frm.nudBuffer.Maximum) { Frm.nudBuffer.Value = buffer; } int updateperiod = Bass.GetConfig(Configuration.UpdatePeriod); if (updateperiod >= Frm.nudBuffer.Minimum && updateperiod <= Frm.nudBuffer.Maximum) { Frm.nudUpdatePeriod.Value = updateperiod; } BassInfo info = new BassInfo(); if (Bass.GetInfo(out info)) { clsBASSOutDevNonAsio.BassInfo = info; } if (clsBASSOutDevNonAsio.BassInfo.Latency > 0) { Frm.lblLatency.Text = clsBASSOutDevNonAsio.BassInfo.Latency.ToString(); } if (clsBASSOutDevNonAsio.BassInfo.MinBufferLength > 0) { Frm.lblMinBuf.Text = clsBASSOutDevNonAsio.BassInfo.MinBufferLength.ToString(); } } finally { Frm.Bypass_Event = false; } }
private void cmdCalcBuffer_Click(object sender, EventArgs e) { BassInfo info = new BassInfo(); if (Bass.GetInfo(out info)) { clsBASSOutDevNonAsio.BassInfo = info; } if (clsBASSOutDevNonAsio.BassInfo.MinBufferLength > 0) { nudBuffer.Value = (int)nudUpdatePeriod.Value + clsBASSOutDevNonAsio.BassInfo.MinBufferLength + clsBASSOutDevNonAsio.BufferMargin; } }
internal clsBASSOutDevNonAsio() { Version bassversion = Bass.Version; Debug.WriteLine("Bass Version: " + bassversion); BassInfo = new BassInfo(); #if NOAUDIODEVS ThrowAudioExc(); //temp Bass test //Disconnected = true; //temp Bass test #else CheckOKHard(Bass.Init(AudioDevNum, 44100, DeviceInitFlags.Latency, P.frmSC.Handle)); //44100 ignored #endif AudioDevNum = (int)Bass.CurrentDevice; //convert default device to actual device Bass.GetInfo(out BassInfo); SetConfig(); }