当前位置: 首页>>代码示例>>C#>>正文


C# ISampleProvider类代码示例

本文整理汇总了C#中ISampleProvider的典型用法代码示例。如果您正苦于以下问题:C# ISampleProvider类的具体用法?C# ISampleProvider怎么用?C# ISampleProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISampleProvider类属于命名空间,在下文中一共展示了ISampleProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AudioStreamModifier

        public AudioStreamModifier(ISampleProvider sample, double rateMult, int pitchDelta)
        {
            _sample = sample;
            WaveFormat = _sample.WaveFormat;

            _soundTouch = new SoundTouch<float, double>();

            channelCount = sample.WaveFormat.Channels;
            _soundTouch.SetSampleRate(sample.WaveFormat.SampleRate);
            _soundTouch.SetChannels(channelCount);

            rateMult = (rateMult - 1) * 100;
            _soundTouch.SetTempoChange(rateMult);
            _soundTouch.SetPitchSemiTones(pitchDelta*0.25f);
            _soundTouch.SetRateChange(1.0f);

            _soundTouch.SetSetting(SettingId.UseQuickseek, 1);
            _soundTouch.SetSetting(SettingId.UseAntiAliasFilter, 1);

            _soundTouch.SetSetting(SettingId.SequenceDurationMs, 40);
            _soundTouch.SetSetting(SettingId.SeekwindowDurationMs, 15);
            _soundTouch.SetSetting(SettingId.OverlapDurationMs, 8);

            sourceReadBuffer = new float[(WaveFormat.SampleRate * channelCount * readDurationMilliseconds) / 1000];
            soundTouchReadBuffer = new float[sourceReadBuffer.Length * 10]; // support down to 0.1 speed
        }
开发者ID:GAIPS-INESC-ID,项目名称:FAtiMA-Toolkit,代码行数:26,代码来源:AudioStreamModifier.cs

示例2: AutoDisposeSampleProvider

 public AutoDisposeSampleProvider(ISampleProvider provider,
      IEnumerable<IDisposable> disposables)
 {
     this._provider = provider;
     this._disposables = new CompositeDisposable(disposables);
     this.WaveFormat = provider.WaveFormat;
 }
开发者ID:Kei-Nanigashi,项目名称:StarryEyes,代码行数:7,代码来源:AutoDisposeFileReader.cs

示例3: EnvelopeSampleProvider

 public EnvelopeSampleProvider(ISampleProvider source, List<ExpPoint> envelope, double skipOver)
 {
     this.source = source;
     foreach (var pt in envelope) this.envelope.Add(pt.Clone());
     int skipOverSamples = (int)(skipOver * WaveFormat.SampleRate / 1000);
     ConvertEnvelope(skipOverSamples);
 }
开发者ID:KineticIsEpic,项目名称:OpenUtau,代码行数:7,代码来源:EnvelopeSampleProvider.cs

示例4: AddMixerInput

 /// <summary>
 /// Adds a new mixer input
 /// </summary>
 /// <param name="mixerInput">Mixer input</param>
 public void AddMixerInput(ISampleProvider mixerInput)
 {
     // we'll just call the lock around add since we are protecting against an AddMixerInput at
     // the same time as a Read, rather than two AddMixerInput calls at the same time
     lock (sources)
     {
         if (this.sources.Count >= maxInputs)
         {
             throw new InvalidOperationException("Too many mixer inputs");
         }
         this.sources.Add(mixerInput);
     }
     if (this.waveFormat == null)
     {
         this.waveFormat = mixerInput.WaveFormat;
     }
     else
     {
         if (this.WaveFormat.SampleRate != mixerInput.WaveFormat.SampleRate ||
             this.WaveFormat.Channels != mixerInput.WaveFormat.Channels)
         {
             throw new ArgumentException("All mixer inputs must have the same WaveFormat");
         }
     }
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:29,代码来源:MixingSampleProvider.cs

示例5: SpectrumProvider

		// Constructor, sets the {@link Decoder}, the sample window size and the
		// hop size for the spectra returned. Say the sample window size is 1024
		// samples. To get an overlapp of 50% you specify a hop size of 512 samples,
		// for 25% overlap you specify a hopsize of 256 and so on. Hop sizes are of
		// course not limited to powers of 2.
		// 
		// @param decoder The decoder to get the samples from.
		// @param sampleWindowSize The sample window size.
		// @param hopSize The hop size.
		// @param useHamming Wheter to use hamming smoothing or not.
		public SpectrumProvider(ISampleProvider decoder, int sampleWindowSize, int hopSize, bool useHamming)
		{
			if(decoder == null)
				throw new ArgumentException("Decoder must be != null");

			if(sampleWindowSize <= 0)
				throw new ArgumentException("Sample window size must be > 0");
			if(hopSize <= 0)
				throw new ArgumentException("Hop size must be > 0");

			if(sampleWindowSize < hopSize)
				throw new ArgumentException("Hop size must be <= sampleSize");


			this.decoder = decoder;
			this.samples = new float[sampleWindowSize];
			this.nextSamples = new float[sampleWindowSize];
			this.tempSamples = new float[sampleWindowSize];
			this.hopSize = hopSize;
			fft = new FFT(sampleWindowSize, 44100);

			// calculate averages based on a miminum octave width of 22 Hz
			// split each octave into three bands
			// this should result in 30 averages
			//fft.LogAverages(22, 3);
			
			if(useHamming)
				fft.Window(FFT.HAMMING);

			decoder.Read(samples, 0, samples.Length);
			decoder.Read(nextSamples, 0, nextSamples.Length);
		}
开发者ID:LuckyLuik,项目名称:AudioVSTToolbox,代码行数:42,代码来源:SpectrumProvider.cs

示例6: RemoveMixerInput

 /// <summary>
 /// Removes a mixer input
 /// </summary>
 /// <param name="mixerInput">Mixer input to remove</param>
 public void RemoveMixerInput(ISampleProvider mixerInput)
 {
     lock (sources)
     {
         this.sources.Remove(mixerInput);
     }
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:11,代码来源:MixingSampleProvider.cs

示例7: SampleToWaveProvider

 /// <summary>
 /// Initializes a new instance of the WaveProviderFloatToWaveProvider class
 /// </summary>
 /// <param name="source">Source wave provider</param>
 public SampleToWaveProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat)
     {
         throw new ArgumentException("Must be already floating point");
     }
     this.source = source;
 }
开发者ID:Shadetheartist,项目名称:Numboard-2.0,代码行数:12,代码来源:SampleToWaveProvider.cs

示例8: MeteringSampleProvider

 /// <summary>
 /// Initialises a new instance of MeteringSampleProvider 
 /// </summary>
 /// <param name="source">source sampler provider</param>
 /// <param name="samplesPerNotification">Number of samples between notifications</param>
 public MeteringSampleProvider(ISampleProvider source, int samplesPerNotification)
 {
     this.source = source;
     this.channels = source.WaveFormat.Channels;
     this.maxSamples = new float[channels];
     this.SamplesPerNotification = samplesPerNotification;
     this.args = new StreamVolumeEventArgs() { MaxSampleValues = this.maxSamples }; // create objects up front giving GC little to do
 }
开发者ID:jayfar,项目名称:NAudio_1.5_Updates,代码行数:13,代码来源:MeteringSampleProvider.cs

示例9: BalanceSampleProvider

 /// <summary>
 /// Initializes a new instance of BalanceSampleProvider
 /// </summary>
 /// <param name="source">Source Sample Provider</param>
 public BalanceSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 2)
         throw new InvalidOperationException("Input wave format must be stereo!");
     _source = source;
     LeftVolume = 1.0f;
     RightVolume = 1.0f;
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:12,代码来源:BalanceSampleProvider.cs

示例10: AddSource

 public void AddSource(ISampleProvider source, TimeSpan delayBy)
 {
     ISampleProvider _source;
     if (source.WaveFormat.Channels == 1) _source = new MonoToStereoSampleProvider(source);
     else if (source.WaveFormat.Channels == 2) _source = source;
     else return;
     mix.AddMixerInput(new OffsetSampleProvider(_source) { DelayBy = delayBy });
 }
开发者ID:KineticIsEpic,项目名称:OpenUtau,代码行数:8,代码来源:TrackSampleProvider.cs

示例11: FilteredSampleProvider

		public const float StandardBufferSizeSeconds = 0.05f;	// 1/20 second buffer

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="centreFrequency">For BiQuad filters</param>
		/// <param name="q">For BiQuad filters</param>
		public FilteredSampleProvider(ISampleProvider sourceProvider, float centreFrequency, float q) {
			this.sourceProvider = sourceProvider;
			channels = WaveFormat.Channels;
			StandardBufferSize = (int)WaveFormat.SecondsToSamples(StandardBufferSizeSeconds);
			filters = new BiQuadFilter[channels];
			for (int n = 0; n < channels; n++) {
				filters[n] = BiQuadFilter.BandPassFilterConstantPeakGain(WaveFormat.SampleRate, centreFrequency, q);
			}
		}
开发者ID:nikkilocke,项目名称:AlbumRecorder,代码行数:16,代码来源:FilteredSampleProvider.cs

示例12: Equalizer

 public Equalizer(ISampleProvider sourceProvider, EqualizerBand[] bands)
 {
     this.sourceProvider = sourceProvider;
     this.bands = bands;
     channels = sourceProvider.WaveFormat.Channels;
     bandCount = bands.Length;
     filters = new BiQuadFilter[channels, bands.Length];
     CreateFilters();
 }
开发者ID:cplaster,项目名称:RockBox,代码行数:9,代码来源:Equalizer.cs

示例13: MonoToStereoSampleProvider

 /// <summary>
 /// Initializes a new instance of MonoToStereoSampleProvider
 /// </summary>
 /// <param name="source">Source sample provider</param>
 public MonoToStereoSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 1)
     {
         throw new ArgumentException("Source must be mono");
     }
     this.source = source;
     this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(source.WaveFormat.SampleRate, 2);
 }
开发者ID:hanistory,项目名称:hasuite,代码行数:13,代码来源:MonoToStereoSampleProvider.cs

示例14: PanningSampleProvider

 /// <summary>
 /// Initialises a new instance of the PanningSampleProvider
 /// </summary>
 /// <param name="source">Source sample provider, must be mono</param>
 public PanningSampleProvider(ISampleProvider source)
 {
     if (source.WaveFormat.Channels != 1)
     {
         throw new ArgumentException("Source sample provider must be mono");
     }
     this.source = source;
     this.waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(source.WaveFormat.SampleRate, 2);
     this.panStrategy = new SinPanStrategy();
 }
开发者ID:Shadetheartist,项目名称:Numboard-2.0,代码行数:14,代码来源:PanningSampleProvider.cs

示例15: Equalizer

 public Equalizer(ISampleProvider sourceProvider, ObservableCollection<IEqualizerBand> bands)
 {
     _sourceProvider = sourceProvider;
     _bands = bands;
     _channels = sourceProvider.WaveFormat.Channels;
     _lockObj = new object();
     foreach (IEqualizerBand band in _bands) band.PropertyChanged += EqualizerBandPropertyChanged;
     _bands.CollectionChanged += BandsOnCollectionChanged;
     _filters = new List<BiQuadFilter[]>();
     CreateFilters();
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:11,代码来源:Equalizer.cs


注:本文中的ISampleProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。