public float GetCPUusage() { float f; switch (SoundDeviceType) { case ESoundDeviceType.ExclusiveWASAPI: case ESoundDeviceType.SharedWASAPI: f = BassWasapi.BASS_WASAPI_GetCPU(); break; case ESoundDeviceType.ASIO: f = BassAsio.BASS_ASIO_GetCPU(); break; case ESoundDeviceType.BASS: f = Bass.BASS_GetCPU(); break; case ESoundDeviceType.OpenAL: f = 0.0f; break; default: f = 0.0f; break; } return(f); }
private void timerUpdate_Tick(object sender, System.EventArgs e) { _tickCounter++; if (_tickCounter == 4) { _tickCounter = 0; long len = Bass.BASS_ChannelGetLength(_streamFX); // length in bytes long pos = Bass.BASS_ChannelGetPosition(_streamFX); // position in bytes double totaltime = Bass.BASS_ChannelBytes2Seconds(_streamFX, len); // the total time length double elapsedtime = Bass.BASS_ChannelBytes2Seconds(_streamFX, pos); // the elapsed time length double remainingtime = totaltime - elapsedtime; this.labelTime.Text = String.Format("Elapsed: {0:#0.00} - Total: {1:#0.00} - Remain: {2:#0.00}", Utils.FixTimespan(elapsedtime, "MMSS"), Utils.FixTimespan(totaltime, "MMSS"), Utils.FixTimespan(remainingtime, "MMSS")); this.Text = String.Format("CPU: {0:0.00}%", BassAsio.BASS_ASIO_GetCPU()); // set the track bar if (_trackBarPositionCanDisplay) { this.trackBarPosition.Maximum = (int)len; this.trackBarPosition.Value = (int)pos; } } this.progressBarVULeft.Value = _peakL; this.progressBarVURight.Value = _peakR; }