Windows Phone 7中音频录制

http://bbs.51cto.com/archiver/tid-863385.html

void microphone_BufferReady(object sender, EventArgs e)
            {
                this.Dispatcher.BeginInvoke(() =>
                {
                    microphone.GetData(buffer);

                    stream.Write(buffer, 0, buffer.Length);

                    TimeSpan tsTemp = timer.Elapsed;
                    TextBlockSeconds.Text = tsTemp.Hours.ToString().PadLeft(2, '0') + ":" + tsTemp.Minutes.ToString().PadLeft(2, '0') + ":" + tsTemp.Seconds.ToString().PadLeft(2, '0');

    if(timer.Elapsed.Seconds >5)
    DoStop();

                });
            }

            private void ButtonRecord_Click(object sender, RoutedEventArgs e)
            {
                DisableRecordButton();

                timer = new Stopwatch();
                timer.Start();

                stream = new MemoryStream();

                TextBlockSeconds.Text = "00:00:00";
                TextBlockStatus.Text = "Recording: ";

                microphone.BufferDuration = TimeSpan.FromMilliseconds(500);
                buffer = new byte[microphone.GetSampleSizeInBytes(microphone.BufferDuration)];

                microphone.BufferReady += new EventHandler<EventArgs>(microphone_BufferReady);

                microphone.Start();
            }

    private void DoStop()
            {

if (timer.IsRunning)
                timer.Stop();

            if (microphone.State == MicrophoneState.Started)
            {
                microphone.Stop();
                TextBlockStatus.Text = "Stopped: Ready to save";
            }
            else
            {
                TextBlockStatus.Text = "Ready: ";
            }

            TextBlockSeconds.Text = string.Empty;

            EnableRecordButton();
            }

 http://www.cnblogs.com/zhangyafeng/archive/2009/12/10/1621213.html

http://www.devdiv.com/thread-23384-1-1.html

流媒体播放

http://www.silverlightchina.net/html/zhuantixilie/winphone7/2011/0930/10757.html

http://www.silverlightchina.net/plus/search.php?kwtype=0&keyword=%D2%F4%C6%B5&searchtype=titlekeyword

http://www.silverlightchina.net/plus/search.php?kwtype=0&keyword=Audio&searchtype=titlekeyword

http://www.silverlightchina.net/html/developer/silverlight/2010/0521/1166.html

http://www.cnblogs.com/imobiler/archive/2010/12/23/1914353.html

转载于:https://www.cnblogs.com/Kingly/archive/2011/10/08/2201842.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值