/// <summary>
        /// Creates and initializes an new instance using drive and track number.
        /// </summary>
        /// <param name="drive">Drive letter of the drive where the audio CD is inserted.</param>
        /// <param name="trackNo">Number of the track to play. The number of the first track is 1.</param>
        /// <returns>The new instance.</returns>
        public static BassCDTrackInputSource Create(char drive, uint trackNo)
        {
            BassCDTrackInputSource inputSource = new BassCDTrackInputSource(drive, trackNo);

            inputSource.Initialize();
            return(inputSource);
        }
        /// <summary>
        /// Creates and initializes an instance of <see cref="BassCDTrackInputSource"/> using a given virtual audio CD file path.
        /// </summary>
        /// <param name="cdTrackFilePath">The file path of the CD track in the form <c>"D:\\Track03.cda"</c> to be handled by the instance.</param>
        /// <returns>The new instance of <see cref="BassCDTrackInputSource"/>.</returns>
        public static BassCDTrackInputSource Create(string cdTrackFilePath)
        {
            if (string.IsNullOrEmpty(cdTrackFilePath) || cdTrackFilePath.Length != 14)
            {
                throw new ArgumentException(string.Format("Given file path '{0}' is no audio CD file path of the form 'D:\\Track03.cda'", cdTrackFilePath));
            }
            char drive   = char.ToUpper(cdTrackFilePath[0]);
            byte trackNo = byte.Parse(cdTrackFilePath.Substring(8, 2));

            return(BassCDTrackInputSource.Create(drive, trackNo));
        }
        public bool SwitchTo(BassCDTrackInputSource other)
        {
            if (other.Drive != _drive)
            {
                return(false);
            }

            BassStream stream = _bassStream;

            if (stream != null && BassCd.BASS_CD_StreamSetTrack(stream.Handle, other.BassTrackNo))
            {
                Log.Debug("BassCDTrackInputSource: Simply switched the current track to drive '{0}', track {1}", other.Drive, other.TrackNo);
                _trackNo = other._trackNo;
                _length  = other._length;
                stream.UpdateLocalFields();
                other.Dispose();
                return(true);
            }
            Log.Debug("BassCDTrackInputSource: Could not simply switch the current track to drive '{0}', track {1}", other.Drive, other.TrackNo);
            return(false);
        }
    public bool SwitchTo(BassCDTrackInputSource other)
    {
      if (other.Drive != _drive)
        return false;

      BassStream stream = _bassStream;
      if (stream != null && BassCd.BASS_CD_StreamSetTrack(stream.Handle, other.BassTrackNo))
      {
        Log.Debug("BassCDTrackInputSource: Simply switched the current track to drive '{0}', track {1}", other.Drive, other.TrackNo);
        _trackNo = other._trackNo;
        _length = other._length;
        stream.UpdateLocalFields();
        other.Dispose();
        return true;
      }
      Log.Debug("BassCDTrackInputSource: Could not simply switch the current track to drive '{0}', track {1}", other.Drive, other.TrackNo);
      return false;
    }
 /// <summary>
 /// Creates and initializes an new instance using drive and track number.
 /// </summary>
 /// <param name="drive">Drive letter of the drive where the audio CD is inserted.</param>
 /// <param name="trackNo">Number of the track to play. The number of the first track is 1.</param>
 /// <returns>The new instance.</returns>
 public static BassCDTrackInputSource Create(char drive, uint trackNo)
 {
   BassCDTrackInputSource inputSource = new BassCDTrackInputSource(drive, trackNo);
   inputSource.Initialize();
   return inputSource;
 }