Пример #1
0
		public void Run(DataStream strOut)
		{
			if (ProgressNotifier != null)
				ProgressNotifier.Reset();

			for (int i = 0; i < Format.Channels; i++) {
				Format.HistoricalValues[i, 0] = 0;
				Format.HistoricalValues[i, 1] = 0;
			}

			int samplesEncoded = 0;
			var samples = new SampleEnumerator(Samples);
			foreach (var sampleBlock in samples.Get(Format.SamplesPerChunk)) {
				// Mix chunk channels
				for (int i = 0; i < Format.Channels; i++)
					WriteChunk(sampleBlock, i, strOut);

				samplesEncoded += sampleBlock.GetLength(0);
				if (ProgressNotifier != null)
					ProgressNotifier.Update(samplesEncoded, SamplesToEncode);
			}

			if (ProgressNotifier != null)
				ProgressNotifier.End();
		}
Пример #2
0
        public void Run(DataStream strOut)
        {
            if (ProgressNotifier != null)
            {
                ProgressNotifier.Reset();
            }

            for (int i = 0; i < Format.Channels; i++)
            {
                Format.HistoricalValues[i, 0] = 0;
                Format.HistoricalValues[i, 1] = 0;
            }

            int samplesEncoded = 0;
            var samples        = new SampleEnumerator(Samples);

            foreach (var sampleBlock in samples.Get(Format.SamplesPerChunk))
            {
                // Mix chunk channels
                for (int i = 0; i < Format.Channels; i++)
                {
                    WriteChunk(sampleBlock, i, strOut);
                }

                samplesEncoded += sampleBlock.GetLength(0);
                if (ProgressNotifier != null)
                {
                    ProgressNotifier.Update(samplesEncoded, SamplesToEncode);
                }
            }

            if (ProgressNotifier != null)
            {
                ProgressNotifier.End();
            }
        }