public RenderItemSampleProvider(RenderItem renderItem)
 {
     this.RenderItem = renderItem;
     var cachedSampleProvider = new CachedSoundSampleProvider(RenderItem.Sound);
     var offsetSampleProvider = new OffsetSampleProvider(new EnvelopeSampleProvider(cachedSampleProvider, RenderItem.Envelope, RenderItem.SkipOver))
     {
         DelayBySamples = (int)(RenderItem.PosMs * cachedSampleProvider.WaveFormat.SampleRate / 1000),
         TakeSamples = (int)(RenderItem.DurMs * cachedSampleProvider.WaveFormat.SampleRate / 1000),
         SkipOverSamples = (int)(RenderItem.SkipOver * cachedSampleProvider.WaveFormat.SampleRate / 1000)
     };
     this.signalChain = offsetSampleProvider;
     this.firstSample = offsetSampleProvider.DelayBySamples + offsetSampleProvider.SkipOverSamples;
     this.lastSample = this.firstSample + offsetSampleProvider.TakeSamples;
 }
        public RenderItemSampleProvider(RenderItem renderItem)
        {
            this.RenderItem = renderItem;
            var cachedSampleProvider = new CachedSoundSampleProvider(RenderItem.Sound);
            var offsetSampleProvider = new OffsetSampleProvider(new EnvelopeSampleProvider(cachedSampleProvider, RenderItem.Envelope, RenderItem.SkipOver))
            {
                DelayBySamples  = (int)(RenderItem.PosMs * cachedSampleProvider.WaveFormat.SampleRate / 1000),
                TakeSamples     = (int)(RenderItem.DurMs * cachedSampleProvider.WaveFormat.SampleRate / 1000),
                SkipOverSamples = (int)(RenderItem.SkipOver * cachedSampleProvider.WaveFormat.SampleRate / 1000)
            };

            this.signalChain = offsetSampleProvider;
            this.firstSample = offsetSampleProvider.DelayBySamples + offsetSampleProvider.SkipOverSamples;
            this.lastSample  = this.firstSample + offsetSampleProvider.TakeSamples;
        }