Пример #1
0
        public override bool GetFormat(out int rate, out int channels, out OutputStreamFormat format)
        {
            var _rate     = default(int);
            var _channels = default(int);
            var _format   = default(OutputStreamFormat);

            this.PipelineManager.WithPipeline(pipeline =>
            {
                if (pipeline != null)
                {
                    _rate     = pipeline.Output.Rate;
                    _channels = pipeline.Output.Channels;
                    if (pipeline.Output.Flags.HasFlag(BassFlags.Float))
                    {
                        _format = OutputStreamFormat.Float;
                    }
                    else
                    {
                        _format = OutputStreamFormat.Short;
                    }
                }
            });
            rate     = _rate;
            channels = _channels;
            format   = _format;
            return(true);
        }
Пример #2
0
            private void Update(int rate, int channels, OutputStreamFormat format)
            {
                if (this.Rate == rate && this.Channels == channels && this.Format == format)
                {
                    return;
                }

                this.Rate     = rate;
                this.Channels = channels;
                this.Format   = format;

                if (format == OutputStreamFormat.Short)
                {
                    this.Samples16 = this.Renderer.Output.GetBuffer <short>(TimeSpan.FromMilliseconds(this.Renderer.Duration.Value));
                    this.Samples32 = new float[this.Samples16.Length];
                }
                else if (format == OutputStreamFormat.Float)
                {
                    this.Samples32 = this.Renderer.Output.GetBuffer <float>(TimeSpan.FromMilliseconds(this.Renderer.Duration.Value));
                }

                //TODO: Only realloc if required.
                switch (this.Mode)
                {
                default:
                case OscilloscopeRendererMode.Mono:
                    this.Values   = new float[1, this.Width];
                    this.Elements = CreateElements(1, this.Width, this.Height);
                    this.Peaks    = new float[1];
                    break;

                case OscilloscopeRendererMode.Seperate:
                    this.Samples  = new float[this.Channels, this.Samples32.Length];
                    this.Values   = new float[this.Channels, this.Width];
                    this.Elements = CreateElements(this.Channels, this.Width, this.Height);
                    this.Peaks    = new float[this.Channels];
                    break;
                }
            }
Пример #3
0
            private void Update(int rate, int channels, OutputStreamFormat format)
            {
                if (this.Rate == rate && this.Channels == channels && this.Format == format)
                {
                    return;
                }

                this.Rate     = rate;
                this.Channels = channels;
                this.Format   = format;

                if (format == OutputStreamFormat.Short)
                {
                    this.Samples16 = this.Renderer.Output.GetBuffer <short>(TimeSpan.FromMilliseconds(this.Renderer.UpdateInterval));
                    this.Samples32 = new float[this.Samples16.Length];
                }
                else if (format == OutputStreamFormat.Float)
                {
                    this.Samples32 = this.Renderer.Output.GetBuffer <float>(TimeSpan.FromMilliseconds(this.Renderer.UpdateInterval));
                }
                this.Samples = new float[this.Channels, this.Samples32.Length];

                this.Values        = new float[channels];
                this.ValueElements = new Int32Rect[channels];

                if (this.Renderer.ShowRms.Value)
                {
                    this.Rms         = new float[channels];
                    this.RmsElements = new Int32Rect[channels];
                }
                if (this.Renderer.ShowPeaks.Value)
                {
                    this.PeakElements = new Int32Rect[channels];
                    this.Holds        = new int[channels];
                }
            }
Пример #4
0
 public abstract bool GetFormat(out int rate, out int channels, out OutputStreamFormat format);