private void OnCommandExecuted(ITrackInfo trackInfo) { if (OnCommandInfo != null) { OnCommandInfo(this, trackInfo); } }
public VirtualFlacCreator(string file, string flacImageFileName, ITrackInfo [] tracksInfo) { tracksInfo_ = tracksInfo; string xml = String.Format("<virtualFlac><flacImage uri=\"{0}\"><tracks></tracks><frames></frames></flacImage></virtualFlac>", flacImageFileName); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); inStream_ = new FlacStream(file, FlacStream.StreamMode.OpenExisting, FlacStream.StreamAccessMode.Read); inStream_.BeforeFrameDataRead += new FrameCallback(inStream__BeforeFrameDataRead); outStream_ = new FlacStream(Path.GetTempFileName(), FlacStream.StreamMode.CreateNew, FlacStream.StreamAccessMode.Write); inStream_.Decode(); outStream_.Close(); XmlNode tracks = doc.SelectSingleNode("/virtualFlac/flacImage/tracks"); foreach (VirtualTrack vt in virtualTracks_) { XmlNode track = doc.CreateElement("track"); vt.SaveToXml(track); tracks.AppendChild(track); } string virtualFlacFile = file.Remove(file.Length - ".flac".Length) + ".virtualflac"; doc.Save(virtualFlacFile); }
public void Play() { if (CurrentTrack == null) { CurrentTrack = Tracks.First(); } _playback?.Play(); }
/// <summary> /// Create a copy of the ITrackInfo /// </summary> /// <param name="Track">The ITrackInfo to copy the data from</param> /// <param name="ReadOnly">If true the copy with be read-only</param> public TrackInfo(ITrackInfo Track, bool ReadOnly) { m_ReadOnly = ReadOnly; this.Number = Track.Number; this.Name = Track.Name; this.Language = Track.Language; this.CodecID = Track.CodecID; this.CodecPrivate = Track.CodecPrivate; this.Duration = Track.Duration; }
public DataCalculator(ITrackInfo dataCalcRecieved) { this._dataCalcRecieved = dataCalcRecieved; this._dataCalcRecieved.AirspaceDataReady += UseList; gammelliste = new List <Plane>(); _printToConsole = new ConsolePrint(); }
public static ICachableTrackData ToCachedData(this ITrackInfo trackInfo, string id) => new CachableTrackData() { TotalDurationMs = trackInfo.Duration.TotalMilliseconds, Id = id, Thumbnail = trackInfo.Thumbnail, Url = trackInfo.Url, Platform = trackInfo.Platform, Title = trackInfo.Title };
public EngineState( bool isPlaying, int currentTrackIndex, ITrackInfo [] playQueue, long changeCount ) { Debug.Assert( null != playQueue ); _isPlaying = isPlaying; _currentTrackIndex = currentTrackIndex; _playQueue = playQueue; // should make a copy instead of ref? _changeCount = changeCount; }
private void OnCurrentTrackChanged(ITrackInfo oldTrack, ITrackInfo newTrack) { if (_playback != null) { _playback.Ended -= OnCurrentTrackEnded; _playback.Dispose(); } _playback = _audioHub.CreatePlayback(newTrack.Uri); _playback.Name = _playback.Name ?? newTrack.Name; _playback.Volume = Volume; _playback.Ended += OnCurrentTrackEnded; _playback.AddOutgoingConnections(OutgoingConnections); }
private void wkList_OnCommandInfo(object sender, ITrackInfo e) { string s = ""; GlobalVars.Instance.TrackInfos.Add(e); this.Dispatcher.Invoke(() => { if (e is PipettingTrackInfo) { s = ((PipettingTrackInfo)e).Stringfy(); log.Info(s); logForm.AddLog(s); } }); }
private void GoToIndex(int index) { if (index > Tracks.Count) { index = 0; } if (index < 0) { index = Tracks.Count - 1; } CurrentTrack = Tracks[index]; Play(); }
public static string PrettyTotalTime(this ITrackInfo trackInfo) { if (trackInfo.Duration == TimeSpan.Zero) { return("(?)"); } if (trackInfo.Duration == TimeSpan.MaxValue) { return("∞"); } if (trackInfo.Duration.TotalHours >= 1) { return(trackInfo.Duration.ToString(@"hh\:mm\:ss")); } return(trackInfo.Duration.ToString(@"mm\:ss")); }
/// <summary> /// The track info instance can use this method to load up all the meta data information. /// </summary> /// <param name="info"> /// The info. /// </param> /// <param name="path"> /// The path. /// </param> public void LazyLoad(ITrackInfo info, string path) { var fileInfo = new FileInfo(path); info.FileName = fileInfo.Name; info.ImagePath = this.GetImage(fileInfo); if (!string.IsNullOrEmpty(info.ImagePath)) { info.HasImage = true; } var tags = File.Create(path); info.Album = tags.Tag.Album; info.Artist = tags.Tag.JoinedAlbumArtists; info.Name = tags.Tag.Title; info.TrackNum = (int)tags.Tag.Track; if (string.IsNullOrEmpty(info.Name)) { info.Name = info.FileName; } }
/// /// Gets either the title or (if that is empty or all spaces or what) /// the filename from info /// string _FixTitle( ITrackInfo info ) { /// /// \todo check for all-whitespace title here /// if (info.title.Length > 0) { return info.title; } else { string title = info.filePath; if (title.Length > TITLE_MAX_WIDTH) { title = "..." + title.Substring( title.Length - (TITLE_MAX_WIDTH - 4) ); } return title; } }
/// <summary> /// The update current playing info. /// </summary> /// <param name="track"> /// The track. /// </param> private void UpdateCurrentPlayingInfo(ITrackInfo track) { this.CurrentAlbumName = track.Album; this.CurrentArtistName = track.Artist; this.CurrentSongName = track.Name; this.CurrentAlbumArtSource = track.ImagePath; }
/// /// Update the current track info display to match the current /// selection in the listbox. /// void _UpdateTrackInfoDisplay() { _Trace( "[_UpdateTrackInfoDisplay]" ); // Get selected track TreeModel model; TreeIter iter; _selectedTrackInfo = null; if (_trackListView.Selection.GetSelected( out model, out iter )) { _selectedTrackInfo = (ITrackInfo)model.GetValue ( iter, (int)TrackListOffset.TRACK_INFO ); } if (null != _selectedTrackInfo) { // Retrieve track suck/mood details as necessary (or from // the model?) // Update display: _titleDisplay.Buffer.Text = _selectedTrackInfo.title; _artistDisplay.Buffer.Text = _selectedTrackInfo.artist; _albumDisplay.Buffer.Text = _selectedTrackInfo.album; _pathDisplay.Buffer.Text = _selectedTrackInfo.filePath; } else { _selectedTrackInfo = null; _titleDisplay.Buffer.Text = ""; _artistDisplay.Buffer.Text = ""; _albumDisplay.Buffer.Text = ""; _pathDisplay.Buffer.Text = ""; } _UpdateTrackInfoButtonState(); }
public InputTrackInfo(ITrackInfo track) { m_Track = track; }
public void SetUp() { _fakeTrackReciever = Substitute.For <ITrackReciever>(); _uut = new TrackInfo(_fakeTrackReciever); _uut.AirspaceDataReady += (o, a) => { output = a; }; //Simulates Datacalcdataready event }
public void Stop() { _playback?.Stop(); CurrentTrack = Tracks.First(); }
public Frame GetNextFrame(ITrackInfo Track) { MatroskaFileFrame mFrame = m_File.getNextFrame(Track.Number); // Check for EOS if (mFrame == null) return null; Frame frame = new Frame(); frame.Track = Track; frame.Timecode = (mFrame.Timecode / 1000.0); frame.Duration = (mFrame.Duration / 1000.0); int referenceCount = 1; if (mFrame.References != null) referenceCount += mFrame.References.Length; frame.References = new double[referenceCount]; frame.References[0] = (mFrame.Reference / 1000.0); for (int i = 1; i < referenceCount; i++) frame.References[i] = (mFrame.References[i] / 1000.0); frame.Data = ArrayCopy.SByteToByte(mFrame.Data); return frame; }
public QueuedTrackInfo(ITrackInfo trackInfo, string queuer) { TrackInfo = trackInfo; Queuer = queuer; }
/// <summary> /// The previous. /// </summary> public void Previous() { // only do something if there is actually a previous song. if (this.Library.PlayedSongs.Count > 0) { this.Pause(); this.currSong = this.Library.GetPrevious(); this.player.Source = this.currSong.FullPath; this.player.Play(); this.currentlyPlaying = true; this.RaisePropertyChanged("Current"); } }
/// <summary> /// The play. /// </summary> /// <param name="next"> /// The next. /// </param> public void Play(bool next = false) { if (this.Library.PlayedSongs.Count == 0 || next) { // Pause(); if (this.Library.Songs != null && this.Library.Songs.Count > 0) { if (this.currSong == null || next) { this.currSong = this.Library.GetNext(); this.player.Source = this.currSong.FullPath; this.RaisePropertyChanged("Current"); // TODO: fix this. } } } if (this.currSong != null) { this.player.Play(); this.currentlyPlaying = true; } }
public void SetUp() { _fakeTrackInfo = Substitute.For <ITrackInfo>(); _uut = new DataCalculator(_fakeTrackInfo); _uut.CalcedDataReady += (o, a) => { output = a; }; }
public static string PrettyName(this ITrackInfo trackInfo) => $"**[{trackInfo.Title.TrimTo(60).Replace("[", "\\[").Replace("]", "\\]")}]({trackInfo.Url.TrimTo(50, true)})**";