Beispiel #1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            Grid rootPanel = (Grid)this.FindName("rootPanel");

            line = (Polyline)this.FindName("plOscilloscope");

            Size size = rootPanel.RenderSize;

            length = size.Width - 20;
            height = Math.Min(length / 2, size.Height - 20);
            start  = new Point(10, size.Height / 2);

            await socket.Task;
            RatingStream rateStream = new RatingStream(socket.Task.Result.OutputStream.AsStreamForWrite());

            rateStream.WriteRateCalculated += rateStream_WriteRateCalculated;
            capturer.Stream.OutputStream    = rateStream;
            capturer.Start();
        }
Beispiel #2
0
        public void ActivationPostTask()
        {
            MAudioFormat format = capturer.Format;
            int          ratio  = format.NumberOfChannels * format.SampleRate / COMMON_FREQ;

            switch (format.EncodingType)
            {
            case MAudioEncodingType.PCM16bits:
                capturer.Stream.OutputStream =
                    new ConverterStream(new ShortSimplifier(client, ratio, 1));
                break;

            case MAudioEncodingType.Float:
                capturer.Stream.OutputStream =
                    new ConverterStream(new FloatSimplifier(new FloatToPCMConverter(client), ratio, 1));
                break;
            }
            capturer.Start();
        }
Beispiel #3
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            capturer = new MAudioCapturer();
            var ignore = capturer.InitializeAsync().
                         ContinueWith((preTask) =>
            {
                MAudioFormat format = capturer.Format;
                int ratio           = format.NumberOfChannels * format.SampleRate / 16000;

                switch (format.EncodingType)
                {
                case MAudioEncodingType.PCM16bits:
                    capturer.Stream.OutputStream =
                        new ConverterStream(new ShortSimplifier(client, ratio, 1));
                    break;

                case MAudioEncodingType.Float:
                    capturer.Stream.OutputStream =
                        new ConverterStream(new FloatSimplifier(new FloatToPCMConverter(client), ratio, 1));
                    break;
                }
                capturer.Start();
            });
        }