void progressTimer_Tick(object sender, EventArgs e) { try { if (Bass.BASS_ChannelIsActive(player.Channel) != BASSActive.BASS_ACTIVE_STOPPED) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { int cpu = Convert.ToInt32(Bass.BASS_GetCPU() * 100); menuBar.CPU.Text = "CPU Usage: " + cpu.ToString() + "%"; player.Update(); double PercentOfTrack = player.Song.CurrentPositionInSeconds / player.Song.TotalLengthInSeconds; double trackBarLength = nowPlaying.trackBarBg.ActualWidth; nowPlaying.playedAmount.Width = PercentOfTrack * trackBarLength; nowPlaying.TotalTime.Text = Lala.API.Functions.SecondsToTime(player.Song.TotalLengthInSeconds, false); nowPlaying.CurrentTime.Text = Lala.API.Functions.SecondsToTime(player.Song.CurrentPositionInSeconds, false); double percentOfDownload = player.Song.CurrentPosition / player.Song.TotalLength; nowPlaying.loadedAmount.Width = percentOfDownload * trackBarLength; })); } else if (Lala.API.Instance.CurrentUser.Queue.Count > 0) { PlayNextInQueue(); } else { progressTimer.Stop(); } } catch (DllNotFoundException) { Functions.DownloadDlls(); } }
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); }
public static int BASS_MIDI_StreamGetTrackCount(int handle) { int num = 0; while (Bass.BASS_ChannelGetTags(handle, BASSTag.BASS_TAG_MIDI_TRACK + num) != IntPtr.Zero) { num++; } Bass.BASS_GetCPU(); return(num); }
public static int BASS_CD_GetDriveCount(bool release) { int num = 0; while (BassCd.BASS_CD_GetInfo(num, release) != null) { num++; } Bass.BASS_GetCPU(); return(num); }
public static int BASS_MIDI_InGetDeviceInfos() { BASS_MIDI_DEVICEINFO info = new BASS_MIDI_DEVICEINFO(); int num = 0; while (BassMidi.BASS_MIDI_InGetDeviceInfo(num, info)) { num++; } Bass.BASS_GetCPU(); return(num); }
private void timerUpdate_Tick(object sender, System.EventArgs e) { // here we gather info about the stream, when it is playing... if (Bass.BASS_ChannelIsActive(_stream) == BASSActive.BASS_ACTIVE_PLAYING) { // the stream is still playing... } else { // the stream is NOT playing anymore... _updateTimer.Stop(); return; } // from here on, the stream is for sure playing... _tickCounter++; long pos = Bass.BASS_ChannelGetPosition(_stream); // position in bytes long len = Bass.BASS_ChannelGetLength(_stream); // length in bytes this._pos = pos; if (_tickCounter == 5) { // display the position every 250ms (since timer is 50ms) _tickCounter = 0; double totaltime = Bass.BASS_ChannelBytes2Seconds(_stream, len); // the total time length double elapsedtime = Bass.BASS_ChannelBytes2Seconds(_stream, pos); // the elapsed time length double remainingtime = totaltime - elapsedtime; delegateVal.timeInfoValue = String.Format("{0:#0.00} / {1:#0.00}", Utils.FixTimespan(elapsedtime, "MMSS"), Utils.FixTimespan(totaltime, "MMSS")); //Utils.FixTimespan(remainingtime, "MMSS") delegateVal.cpuInfoValue = String.Format("Bass-CPU: {0:0.00}%", Bass.BASS_GetCPU()); } // display the level bars int peakL = 0; int peakR = 0; // for testing you might also call RMS_2, RMS_3 or RMS_4 //RMS(_stream, out peakL, out peakR); RMS_2(_stream, out peakL, out peakR); // level to dB double dBlevelL = Utils.LevelToDB(peakL, 65535); double dBlevelR = Utils.LevelToDB(peakR, 65535); //RMS_2(_stream, out peakL, out peakR); //RMS_3(_stream, out peakL, out peakR); //RMS_4(_stream, out peakL, out peakR); //**// // update the position UpdatePosition(pos, len); // update spectrum UpdateSpectrum(); }
public static BASS_MIDI_DEVICEINFO[] BASS_MIDI_InGetGeviceInfos() { List <BASS_MIDI_DEVICEINFO> list = new List <BASS_MIDI_DEVICEINFO>(); int num = 0; BASS_MIDI_DEVICEINFO item; while ((item = BassMidi.BASS_MIDI_InGetDeviceInfo(num)) != null) { list.Add(item); num++; } Bass.BASS_GetCPU(); return(list.ToArray()); }
public static BASS_CD_INFO[] BASS_CD_GetInfos(bool release) { List <BASS_CD_INFO> list = new List <BASS_CD_INFO>(); int num = 0; BASS_CD_INFO item; while ((item = BassCd.BASS_CD_GetInfo(num, release)) != null) { list.Add(item); num++; } Bass.BASS_GetCPU(); return(list.ToArray()); }
public static string[] BASS_WADSP_PluginInfoGetModuleNames() { List <string> list = new List <string>(); int num = 0; string text = string.Empty; while (text != null) { text = BassWaDsp.BASS_WADSP_PluginInfoGetModuleName(num); num++; if (text != null) { list.Add(text); } } Bass.BASS_GetCPU(); return(list.ToArray()); }
private void timerUpdate_Tick(object sender, System.EventArgs e) { // here we gather info about the stream, when it is playing... if (Bass.BASS_ChannelIsActive(_StreamFX) == BASSActive.BASS_ACTIVE_PLAYING) { // the stream is still playing... this.labelBPM.BackColor = SystemColors.Control; } else { // the stream is NOT playing anymore... this.timerUpdate.Stop(); this.progressBarPeakLeft.Value = 0; this.progressBarPeakRight.Value = 0; this.labelTime.Text = "Stopped"; return; } // display the level bars int peakL = 0; int peakR = 0; double rms = RMS(_StreamFX, out peakL, out peakR); this.progressBarPeakLeft.Value = peakL; this.progressBarPeakRight.Value = peakR; // from here on, the stream is for sure playing... _TickCounter++; if (_TickCounter == 4) { // display the position every 200ms (since timer is 50ms) _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} - Total: {1} - Remain: {2}", Utils.FixTimespan(elapsedtime, "MMSS"), Utils.FixTimespan(totaltime, "MMSS"), Utils.FixTimespan(remainingtime, "MMSS")); this.Text = String.Format("CPU: {0:0.00}%", Bass.BASS_GetCPU()); this.labelRMSValue.Text = Utils.LevelToDB(rms, 1d).ToString("0.0"); } }
public string GetCPU() { return(string.Format("Bass-CPU: {0:0.00}%", Bass.BASS_GetCPU())); }