高手帮忙看一下C#里面关于ALUT的问题
我在程序里面写了这句话
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);
但是不知道string path应该写成什么样子。
我试过
path = "soundeffect1.wav";
也试过
path = @".\Sounds\soundeffect1.wav"
但是都不行
soundeffect1.wav文件放在<PorjectName>\<PorjectName>\bin\Debug\Sounds中
Debug下有exe
这个应该怎么办?Alut.alutLoadMemoryFromFile中的filename应该怎么写啊?
求助。。。 c# ALUT path filename --------------------编程问答-------------------- 我还尝试过把wav文件放在debug下,也尝试过导入到项目里面,但都不行。
附上源码
在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);
}
}
}
补充:.NET技术 , C#