Beispiel #1
0
		void Mixer_AudioRead(object sender, CUETools.DSP.Mixer.AudioReadEventArgs e)
		{
			latency = buffer.Write(e.buffer);
			//int bs = buffer.Write(e.buffer);
			//if (bs > 0)
			//{
			//    Trace.WriteLine(string.Format("buffer size {0}", bs));
			//}
		}
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="File" /> for a specified path in the local file
		///    system and specified read style.
		/// </summary>
		/// <param name="path">
		///    A <see cref="string" /> object containing the path of the
		///    file to use in the new instance.
		/// </param>
		/// <param name="propertiesStyle">
		///    A <see cref="ReadStyle" /> value specifying at what level
		///    of accuracy to read the media properties, or <see
		///    cref="ReadStyle.None" /> to ignore the properties.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="path" /> is <see langword="null" />.
		/// </exception>
		public File (string path, ReadStyle propertiesStyle, CUETools.Processor.CUEToolsTagger _tagger)
			: base (path, propertiesStyle)
		{
			tagger = _tagger;
			// Make sure we have a tag.
			switch (tagger)
			{
				case CUETools.Processor.CUEToolsTagger.APEv2:
					GetTag(TagTypes.Ape, true);
					break;
				case CUETools.Processor.CUEToolsTagger.ID3v2:
					GetTag(TagTypes.Id3v2, true);
					break;
			}
		}
		public void FillFromCtdb(CUETools.CTDB.CTDBResponseMeta cdEntry, int firstAudio)
		{
			this.Year = cdEntry.year ?? "";
			this.Genre = cdEntry.genre ?? "";
			this.Artist = cdEntry.artist ?? "";
			this.Title = cdEntry.album ?? "";
			this.DiscNumber = cdEntry.discnumber ?? "";
			this.TotalDiscs = cdEntry.disccount ?? "";
			this.DiscName = cdEntry.discname ?? "";
            this.Comment = cdEntry.extra ?? "";
			this.Barcode = cdEntry.barcode ?? "";
			this.ReleaseDate = cdEntry.releasedate ?? "";
			this.Country = cdEntry.country ?? "";
			this.Genre = cdEntry.genre ?? "";
			this.Label = "";
            this.LabelNo = "";
			if (cdEntry.label != null && cdEntry.label.Length > 0)
			{
				var listLabel = new List<string>();
				var listLabelNo = new List<string>();
				foreach (var l in cdEntry.label)
				{
					listLabel.Add(l.name ?? "");
					listLabelNo.Add(l.catno?? "");
				}

				if (listLabel.Find(s => s != listLabel[0]) == null)
					this.Label = listLabel[0];
				else
					this.Label = string.Join(";", listLabel.ToArray());
				if (listLabelNo.Find(s => s != listLabelNo[0]) == null)
					this.LabelNo = listLabelNo[0];
				else
					this.LabelNo = string.Join(";", listLabelNo.ToArray());
			}
            this.AlbumArt.Clear();
            if (cdEntry.coverart != null)
                this.AlbumArt.AddRange(cdEntry.coverart);
			if (cdEntry.track != null && cdEntry.track.Length >= this.Tracks.Count)
			{
                if (cdEntry.track.Length - this.Tracks.Count != firstAudio)
                    firstAudio = 0;
				for (int i = 0; i < this.Tracks.Count; i++)
				{
					this.Tracks[i].Title = cdEntry.track[i + firstAudio].name ?? "";
                    this.Tracks[i].Artist = cdEntry.track[i + firstAudio].artist ?? cdEntry.artist ?? "";
					this.Tracks[i].Comment = cdEntry.track[i + firstAudio].extra ?? "";
				}
			}
        }
		/// <summary>
		///    Constructs and initializes a new instance of <see
		///    cref="File" /> for a specified file abstraction with an
		///    average read style.
		/// </summary>
		/// <param name="abstraction">
		///    A <see cref="IFileAbstraction" /> object to use when
		///    reading from and writing to the file.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///    <paramref name="abstraction" /> is <see langword="null"
		///    />.
		/// </exception>
		public File(File.IFileAbstraction abstraction, CUETools.Processor.CUEToolsTagger _tagger)
			: base (abstraction)
		{
			tagger = _tagger;
			// Make sure we have a tag.
			switch (tagger)
			{
				case CUETools.Processor.CUEToolsTagger.APEv2:
					GetTag(TagTypes.Ape, true);
					break;
				case CUETools.Processor.CUEToolsTagger.ID3v2:
					GetTag(TagTypes.Id3v2, true);
					break;
			}
		}