Beispiel #1
0
        public AudioVisualizer(Pipeline pipeline) : base(pipeline)
        {
            InConnector = CreateInputConnectorFrom <AudioBuffer>(pipeline, nameof(In));
            resampler   = new AudioResampler(this, new AudioResamplerConfiguration()
            {
                OutputFormat = WaveFormat.Create16kHz1ChannelIeeeFloat()
            });
            InConnector.Out.PipeTo(resampler.In, DeliveryPolicy.Unlimited);
            resampler.Out.Do(Process);
            PipelineCompleted += OnPipelineCompleted;

            display.PropertyChanged += (sender, e) => {
                if (e.PropertyName == nameof(display.AudioImage))
                {
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Image)));
                }
            };
        }
Beispiel #2
0
        public void WaveFormat_Create16kHz1ChannelIeeeFloat()
        {
            // Define "native" WAVEFORMATEX structure for IEEE float PCM
            byte[] formatBytes = new byte[]
            {
                0x03, 0x00,             // FormatTag = 3
                0x01, 0x00,             // Channels = 1
                0x80, 0x3e, 0x00, 0x00, // SamplesPerSec = 16000
                0x00, 0xfa, 0x00, 0x00, // AvgBytesPerSec = 64800
                0x04, 0x00,             // BlockAlign = 4
                0x20, 0x00,             // BitsPerSample = 32
                0x00, 0x00,             // ExtraSize = 0
            };

            // Create equivalent managed WaveFormat object
            WaveFormat format = WaveFormat.Create16kHz1ChannelIeeeFloat();

            // Verify against expected
            this.MarshalAndVerify(format, formatBytes);
        }
Beispiel #3
0
 private void ButtonCreate16kHz1ChannelIeeeFloat_Click(object sender, RoutedEventArgs e)
 {
     Update(WaveFormat.Create16kHz1ChannelIeeeFloat());
 }