c++ - alutCreateBufferHelloWorld() 中的openal

标签 c++ openal

我再次需要你的帮助来编写 openal

我是一般编程的新手>>并开始通过 vc++ 6 学习 openal

我正在从 sdk1.1 附件的文档中学习

并有这个程序

#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <al.h>
#include <alc.h>
#include <alut.h>
#pragma comment(lib, "openal32.lib")
#pragma comment(lib, "alut.lib")


 ALCdevice *alcOpenDevice(ALCdevice *device);


 ALCenum alcGetError( ALCdevice *device );



 ALuint buffer ;
ALuint source;

// Position of the source sound.
ALfloat SourcePos[] = { 0.0, 0.0, 0.0 };

// Velocity of the source sound.
ALfloat SourceVel[] = { 0.0, 0.0, 0.0 };


// Position of the Listener.
ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };

// Velocity of the Listener.
ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };

// Orientation of the Listener. (first 3 elements are "at", second 3 are "up")
// Also note that these should be units of '1'.
ALfloat ListenerOri[] = { 0.0, 0.0, -1.0,  0.0, 1.0, 0.0 };



int  main()
{




alGenSources(1,&source);








 alSourcei (source, AL_BUFFER,  alutCreateBufferHelloWorld ());  

    alSourcef (source, AL_PITCH,    10.0      );
    alSourcef (source, AL_GAIN,     10.0      );
    //alSourcefv(source, AL_POSITION, SourcePos);
    //alSourcefv(source, AL_VELOCITY, SourceVel);
//  alSourcei (source, AL_LOOPING,  loop     );


alSourcePlay(source);


 alDeleteSources(1, &source);
return 0;

};

我有一个错误

C:\Users\Toshiba\Desktop\Graduation Project\OpenAL\open AL test\EX\mi\ãÇá\7\9\Cpp9.cpp(55):错误 C2065:“alutCreateBufferHelloWorld”:未声明的标识符 执行 cl.exe 时出错。

我不知道问题出在哪里

非常感谢

最佳答案

它要么找不到 alut.h header ,在这种情况下,您可能也会收到错误,要么您的 ALUT 版本太旧,因此没有 alutCreateBufferHelloWorld API。

关于c++ - alutCreateBufferHelloWorld() 中的openal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1693499/

相关文章:

c++ - C++中两个线程的互斥量

c++ - 不完整类型上的 std::is_constructible

c++ - 如何在 C++ 中使用指针创建输入法

c++ - 未知大小复杂度的堆栈分配

audio - 使用 OpenAL 进行时间拉伸(stretch)

c++ - 如何启动我的简单 hello world 程序?

c++ - 通过openAL将录制的音频另存为.wav

ios - OpenAL 随机停止播放某些声音,只能通过重启来修复

audio - 如何使用 openAL (java) 重新加载 wav 文件

c - 在 C 中使用 libopus 编码 pcm 并解码 opus 数据