コード例 #1
0
 private void convertWaveFormat(WaveFormat wf)
 {
     if (wf.WaveFormatTag == AudioEncoding.Extensible)
     {
         owf = new OwnWaveFormatExtensible(wf.SampleRate, wf.BitsPerSample, wf.Channels, ((WaveFormatExtensible)wf).SubFormat, ((WaveFormatExtensible)wf).ChannelMask);
     }
     else
     {
         owf = new OwnWaveFormat(wf.SampleRate, wf.BitsPerSample, wf.Channels, wf.WaveFormatTag, wf.ExtraSize);
     }
 }
コード例 #2
0
        private void decodeWaveFormat(TcpClient tcpClient)
        {
            BinaryFormatter b = new BinaryFormatter();
            object          wf;

            wf = b.Deserialize(tcpClient.GetStream());
            if (((OwnWaveFormat)wf).WaveFormatTag == AudioEncoding.Extensible)
            {
                OwnWaveFormatExtensible owfx = (OwnWaveFormatExtensible)wf;
                _waveFormat = new WaveFormatExtensible(owfx.SampleRate, owfx.BitsPerSample, owfx.Channels, owfx.SubFormat, owfx.ChannelMask);
            }
            else
            {
                OwnWaveFormat owf = (OwnWaveFormat)wf;
                _waveFormat = new WaveFormat(owf.SampleRate, owf.BitsPerSample, owf.Channels, owf.WaveFormatTag, owf.ExtraSize);
            }
        }