在WinCE7上使用C#播放MP3 [英] Play MP3 using C# on WinCE7
问题描述
大家好
我从
下载了nAudio DLL CodePlex ,并尝试编写代码来播放MP3音频文件!
I downloaded nAudio DLLs from CodePlex , and tryed to write a code to play an MP3 audio file!
我刚刚复制粘贴代码,但它有一个错误,我不知道如何解决!
I just did Copy-Paste the code, but it has an error I don't know how to solve!
这是我复制的代码:
private void btn_Play_Click(object sender, EventArgs e)
{
waveOutDevice = new WaveOut();
audioFileReader = new AudioFileReader("Horrorshow - Thoughtcrime (Doin' My Think).mp3");
waveOutDevice.Init(audioFileReader);
waveOutDevice.Play();
}
private void btn_Stop_Click(object sender, EventArgs e)
{
CloseWaveOut();
}
private void CloseWaveOut()
{
if (waveOutDevice != null)
{
waveOutDevice.Stop();
}
if (mainOutputStream != null)
{
audioFileReader.Dispose();
audioFileReader = null;
}
if (waveOutDevice != null)
{
waveOutDevice.Dispose();
waveOutDevice = null;
}
}
错误是:
名称' mainOutputStream '在当前上下文中不存在
推荐答案
在我看来这个示例是不完整的或者应该阅读
Looks to me like the example is incomplete OR should read
if (audioFileReader!= null)
{
audioFileReader.Dispose();
audioFileReader = null;
}
您确定NAudio支持CompactFramework吗? 虽然一些StackOverflow问题指出了这个方向,但我并没有感觉回答者真正理解Windows CE是否参与其中。 而且我从CodePlex获得的关于
紧凑框架的信息也不多。
Are you sure that NAudio supports the CompactFramework? While some StackOverflow questions point that direction, I didn't get the feeling that the answerer really understood that Windows CE was involved. And I don't get a lot from CodePlex about Compact Framework either.
我从Compact Framework需要多媒体的极少数情况我编写了一个C ++ DLL来处理令人厌恶的是DirectShow或WMP Active X控件(取决于我的目标平台),然后使用P / Invoke调用我的C ++
DLL。
The rare occasions I have needed multimedia from the Compact Framework I have written a C++ DLL to deal with the abomination that is DirectShow or the WMP Active X control (depended on my target platform) and then used P/Invoke to call my C++ DLL.
这篇关于在WinCE7上使用C#播放MP3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!