コード例 #1
0
 public override bool Add(BassOutputStream stream)
 {
     if (this.Queue.Contains(stream.ChannelHandle))
     {
         Logger.Write(this, LogLevel.Debug, "Stream is already enqueued: {0}", stream.ChannelHandle);
         return(false);
     }
     Logger.Write(this, LogLevel.Debug, "Adding stream to the queue: {0}", stream.ChannelHandle);
     //If there's nothing in the queue then we're starting.
     if (this.Queue.Count() == 0)
     {
         var flags = default(BassCrossfadeFlags);
         if (this.Behaviour.Start)
         {
             flags = BassCrossfadeFlags.FadeIn;
         }
         else
         {
             flags = BassCrossfadeFlags.None;
         }
         BassUtils.OK(BassCrossfade.ChannelEnqueue(stream.ChannelHandle, flags));
         return(true);
     }
     BassUtils.OK(BassCrossfade.ChannelEnqueue(stream.ChannelHandle));
     return(true);
 }
コード例 #2
0
        public override int Position(BassOutputStream stream)
        {
            var count          = default(int);
            var channelHandles = BassCrossfade.GetChannels(out count);

            return(channelHandles.IndexOf(stream.ChannelHandle));
        }
コード例 #3
0
 public void PreviewResume()
 {
     if (this.Fading || this.Behaviour.PauseResume)
     {
         this.Fading = false;
         BassCrossfade.StreamFadeIn();
     }
 }
コード例 #4
0
 public void PreviewPause()
 {
     if (this.Behaviour.PauseResume)
     {
         this.Fading = true;
         BassCrossfade.StreamFadeOut();
     }
 }
コード例 #5
0
 protected virtual void OnDisposing()
 {
     Logger.Write(this, LogLevel.Debug, "Releasing BASS CROSSFADE.");
     BassCrossfade.Free();
     if (this.BassStreamPipelineFactory != null)
     {
         this.BassStreamPipelineFactory.CreatingPipeline -= this.OnCreatingPipeline;
     }
 }
コード例 #6
0
 public override void Connect(IBassStreamComponent previous)
 {
     //BassUtils.OK(BassGapless.SetConfig(BassGaplessAttriubute.KeepAlive, true));
     Logger.Write(this, LogLevel.Debug, "Creating BASS CROSSFADE stream with rate {0} and {1} channels.", this.Rate, this.Channels);
     this.ChannelHandle = BassCrossfade.StreamCreate(this.Rate, this.Channels, this.Flags);
     if (this.ChannelHandle == 0)
     {
         BassUtils.Throw();
     }
 }
コード例 #7
0
 public override void Reset()
 {
     Logger.Write(this, LogLevel.Debug, "Resetting the queue.");
     foreach (var channelHandle in this.Queue)
     {
         Logger.Write(this, LogLevel.Debug, "Removing stream from the queue: {0}", channelHandle);
         BassCrossfade.ChannelRemove(channelHandle);
     }
     this.ClearBuffer();
 }
コード例 #8
0
 public override bool Remove(BassOutputStream stream, Action <BassOutputStream> callBack)
 {
     if (!this.Queue.Contains(stream.ChannelHandle))
     {
         Logger.Write(this, LogLevel.Debug, "Stream is not enqueued: {0}", stream.ChannelHandle);
         return(false);
     }
     Logger.Write(this, LogLevel.Debug, "Removing stream from the queue: {0}", stream.ChannelHandle);
     //If there's only one stream in the queue then we're stopping.
     //Block so the fade out behaviour can be applied before Reset is called.
     if (this.Queue.Count() == 1)
     {
         BassUtils.OK(BassCrossfade.StreamReset(this.Behaviour.Stop));
         callBack(stream);
         return(true);
     }
     //Fork so fade out doesn't block the next track being enqueued.
     this.Dispatch(() =>
     {
         BassUtils.OK(BassCrossfade.ChannelRemove(stream.ChannelHandle));
         callBack(stream);
     });
     return(true);
 }
コード例 #9
0
 public BassCrossfadeStreamInputBehaviour()
 {
     BassUtils.OK(BassCrossfade.Init());
     Logger.Write(this, LogLevel.Debug, "BASS CROSSFADE Initialized.");
 }