示例#1
0
 public BassResamplerStreamComponent(BassResamplerStreamComponentBehaviour behaviour, BassOutputStream stream, IBassStreamPipelineQueryResult query)
 {
     this.Behaviour = behaviour;
     this.Query     = query;
     this.Rate      = behaviour.Output.Rate;
     this.Channels  = stream.Channels;
     this.Flags     = BassFlags.Decode;
     if (this.Behaviour.Output.Float)
     {
         this.Flags |= BassFlags.Float;
     }
 }
示例#2
0
 public BassResamplerStreamComponent(BassResamplerStreamComponentBehaviour behaviour, BassOutputStream stream)
 {
     if (BassUtils.GetChannelDsdRaw(stream.ChannelHandle))
     {
         throw new InvalidOperationException("Cannot resample DSD streams.");
     }
     this.Behaviour = behaviour;
     this.Rate      = behaviour.Output.Rate;
     this.Channels  = stream.Channels;
     this.Flags     = BassFlags.Decode;
     if (this.Behaviour.Output.Float)
     {
         this.Flags |= BassFlags.Float;
     }
 }
示例#3
0
 public static bool ShouldCreateResampler(BassResamplerStreamComponentBehaviour behaviour, BassOutputStream stream, IBassStreamPipelineQueryResult query)
 {
     if (BassUtils.GetChannelDsdRaw(stream.ChannelHandle))
     {
         //Cannot resample DSD.
         return(false);
     }
     if (behaviour.Output.EnforceRate && behaviour.Output.Rate != stream.Rate)
     {
         //Rate is enforced and not equal to the stream rate.
         return(true);
     }
     if (!query.OutputRates.Contains(stream.Rate))
     {
         //Output does not support the stream rate.
         return(true);
     }
     //Something else.
     return(false);
 }