0

I'm getting problems with this code. I'm trying to use OpenAL. A sound SDK developed by the makers of OpenGL. When I use this code:

#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <al/al.h>
#include <al/alc.h>
#include <al/alu.h>
#include <al/alut.h>

ALuint Buffer;
ALuint Source;

float SourcePos[]={0.0f,0.0f,0.0f};
float SourceVel[]={0.0f,0.0f,0.0f};
float ListenerPos[]={0.0f,0.0f,0.0f};
float ListenerVel[]={0.0,0.0,0.0};
float ListenerOri[]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};

ALboolean LoadALData()
{
	ALenum format;
	ALsizei size;
	ALvoid* data;
	ALsizei freq;
	ALboolean loop;

	alGenBuffers(1, &Buffer);
	if(alGetError() != AL_NO_ERROR)
		return AL_FALSE;

	alutLoadWAVFile("sound.wav", &format, &data, &size, &freq, &loop);
	alBufferData(Buffer, format, data, size, freq);
	alUnloadWav(format, data, size, freq);

	alGenSources(1, &Source);
	if(alGetError() != AL_NO_ERROR)
		return AL_TRUE;

	return AL_FALSE;
}

void SetListenerValues()
{
	alListenerfv(AL_POSITION, ListenerPos);
	alListenerfv(AL_VELOCITY, ListenerVel);
	alListenerfv(AL_ORIENTATION, ListenerOri);
}

int main(int argc, char *argv[])
{
	alutInit(NULL, 0);
	alGetError();

	if(LoadALData() == AL_FALSE)
	{
		printf("Error loading data...");
		return 0;
	}

	SetListenerValues();

	atexit(KillALData);


	return 0;
}

I get these errors: Error 1 error C3861: 'alutLoadWAVFile': identifier not found 30 Error 2 error C3861: 'alUnloadWav': identifier not found 32 Error 3 error C2065: 'KillALData' : undeclared identifier 61

3
Contributors
8
Replies
9
Views
8 Years
Discussion Span
Last Post by fuggles
0

I've haven't used this library but from what I've seen...

#include <al/al.h>
//#include <al/alc.h>
//#include <al/alu.h>
#include <al/alut.h>

I've only seen al.h and alut.h included. the others are internal libraries and may be interferring with thedefinitions?

0

But I copied that directly from the example on the website... And everyone else says it works for them.

0

Don't you need to link libraries to build your executable? Linkers need lib files that are the libraries or interfaces to DLL's which are the libraries.

0

They all exist. And they are including now. But I still get the identifier error.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.