保存wav文件的对话框 [英] save dialog box for wav file

查看:85
本文介绍了保存wav文件的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提供保存文件对话框来保存wav文件。它完全适用于文本文件,但我需要为.wav文件做什么?

我的代码是:

I want to provide save file dialog box to save wav file. It perfectly works with text file, but what do I have to do for .wav file?
My code is:

Stream myStream;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();

saveFileDialog1.Filter = "wav (*.wav)|*.wav|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;

if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{           
    if ((myStream = saveFileDialog1.OpenFile()) != null)
    {
        // Code to write the stream goes here.
        myStream.Write(record.wav);
        myStream.Close();
    }
}
mciSendString("save recsound c:\\record.wav", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
Computer c = new Computer();
c.Audio.Stop();

推荐答案

如果你有一个音频比特流你要播放为WAV文件,然后你需要添加WAV标题来指定它是什么类型的音频:



http://en.wikipedia.org/wiki/WAV [ ^ ]

http: //www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html [ ^ ]

https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ [ ^ ]
If you have an audio bitstream that you want to play back as WAV file, then you need to add the WAV header to specify what type of audio it is:

http://en.wikipedia.org/wiki/WAV[^]
http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html[^]
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/[^]


这篇关于保存wav文件的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆