/// <summary> /// /// </summary> /// <exception cref="System.ArgumentException"></exception> /// <param name="filename"></param> /// <param name="preScan"></param> /// <param name="tag"></param> /// <returns></returns> public static PullSoundStreamBase CreateFileStreamPrimitive(string filename, bool preScan = false, List <KeyValuePair <string, object> > tag = null) { PullSoundStreamBase self = new BASSDecodeStreamAdapter(filename, true, preScan); if (tag == null) { tag = Tags.MetaTag.readTagByFilename(filename, false); } if (tag != null) { KeyValuePair <string, object> gain = tag.Find((match) => match.Key == "REPLAYGAIN_ALBUM_GAIN"); if (gain.Value != null) { self = new ReplayGainOverrideFilter(self, Util.Util.parseDouble(gain.ToString())); } } var range = RetrieveAccurateRange(filename, self.LengthSample, tag); if ((range != null) && self.LengthSample > (range.Item1 + range.Item2)) { self = new RangeFilter(self, range.Item1, range.Item2); } return(self); }
private static PullSoundStreamBase ApplyTrackRange(PullSoundStreamBase self, CD.Track track) { var RangeOffset = GetFrame2Sample(self, track.Start); var RangeLength = track.End > track.Start ? GetFrame2Sample(self, track.End - track.Start) : self.LengthSample - RangeOffset; var gain = track.getTagValue("ALBUM GAIN"); if (gain != null) { self = new ReplayGainOverrideFilter(self, Util.Util.parseDouble(gain.ToString())); } self = new RangeFilter(self, RangeOffset, RangeLength); return(self); }