解决方案 »
- vs2008单元测试有没有类似Nunit的ExpectedException?
- 紧急求助! 自定义类访问控件!
- Windows API函数的参数
- AxWMPLib.AxWindowsMediaPlayer出现异常是什么原因(急)
- VS 2008 绑定数据源时报错
- 基础程序编写,急啊!!!!路过看看也好啊
- SQL Server中的数据导出为XML格式的文件?
- C#+ACCESS问题
- 请教高手,<>c__DisplayClass1 class2,报错不知道这个什么意思,请帮忙还原
- 高分求教---如何使用HttpContext在一次Web请求中共享数据
- C#窗体程序,读取ANSI编码的txt文件,导致无法判断其中的汉字
- Postmessage多窗口同时后台点击鼠标问题
附上源码
在Visual Studio里面创建Windows应用程序,把相关的DLL复制到bin\debug下,在添加相关引用,再在输入以下内容:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tao.OpenAl;
using System.IO;namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); //String path = @".\Sounds\soundeffect1.wav";
String path = "soundeffect1.wav";
Alut.alutInit();
int buffer = -1;
Al.alGenBuffers(1, out buffer); int errorCode = Al.alGetError();
System.Diagnostics.Debug.Assert(errorCode == Al.AL_NO_ERROR); int format;
float frequency;
int size;
//报错的地方
System.Diagnostics.Debug.Assert(File.Exists(path));
IntPtr data = Alut.alutLoadMemoryFromFile(path, out format, out size, out frequency);
System.Diagnostics.Debug.Assert(data != IntPtr.Zero);
// Load wav data into the generated buffer.
Al.alBufferData(buffer, format, data, size, (int)frequency);
}
}
}