示例#1
0
        void PlayWave(byte[] PCMBytes)
        {
            MemoryStream ms_PCM = new MemoryStream(PCMBytes,44,PCMBytes.Length-44);
            MemoryStream ms_Wave = new MemoryStream();

            _pcm.SavePcmToWav(ms_PCM, ms_Wave, 16, 8000, 1);

            WaveMediaStreamSource WaveStream = new WaveMediaStreamSource(ms_Wave);
            mediaElement1.SetSource(WaveStream);
            mediaElement1.Play();
        }
示例#2
0
        void OpenWavFile()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog().Value)
            {
                Stream s = ofd.File.OpenRead();
                WaveMediaStreamSource wavMss = new WaveMediaStreamSource(s);
                mediaElement1.SetSource(wavMss);
                mediaElement1.Play();
            }
        }