   openAl, Allegro, SDL?
  hi people!! I´m developing an small project using glut, but I need to play some sounds while playing the game but I don´t know which library is the better for that. I made a search with google and I found 3 recommendations: SDL, Allegro and openAL, I download openAl and a few tutorials about it, but I can´t use openAL library with Borland C++ Builder 6, after I tried with SDL, but I found many errors trying to compile my project too. I guess I made something wrong.Could somebody help me to install and configure openAl or SDL for Borland C++ Builder 6 ?Thanks everybody, and forgiveme, I´m not good writing words in English.   
The solution is free Visual C 2005 Express.Actually, I haven't used Borland since version 5, so I can't say which is better, but I really enjoy VC2005 express.Since you're already committed to OpenGL, I think SDL complements it very well.  However, I'm not experienced with glut, so someone else might be able to help you more.PS:  Your English is better than my Spanish!   ;  Thanks, but I need to use Borland C++ Builder 6 because it´s the IDE used in the University where I study. Anyway, thanks for the recommendation.   ;Quote:Original post by drake1983hi people!! I´m developing an small project using glut, but I need to play some sounds while playing the game but I don´t know which library is the better for that. I made a search with google and I found 3 recommendations: SDL, Allegro and openAL, I download openAl and a few tutorials about it, but I can´t use openAL library with Borland C++ Builder 6, after I tried with SDL, but I found many errors trying to compile my project too. I guess I made something wrong.Could somebody help me to install and configure openAl or SDL for Borland C++ Builder 6 ?Thanks everybody, and forgiveme, I´m not good writing words in English.Good luck. I can't even get SDL to work with MinGW. It's mainly targeted towards Linux. As for OpenAl, I haven't tried it, I wouldn't know.;Quote:Original post by drake1983Thanks, but I need to use Borland C++ Builder 6 because it´s the IDE used in the University where I study. Anyway, thanks for the recommendation.Well, it might be that you built it wrong with SDL, but I don't want to blame you outright!  I believe SDL requires code generation to be set for Multi-threaded dlls (/MD).Aside from that, OpenAL is pretty good.  I was under the impression that Allegro was an integrated engine (or framework, if you prefer), rather than an audio API.@BringBackFuturama:I don't think SDL is targeted at Linux.  One of their big features is being cross-platform, and it works wonderfully with VC2005.  I did have some frustration in setting it up, so maybe there's just a higher barrier to entry?   ;  You´re right, Allegro is an integrated engine. That´s why I need to set up openAL or SDL, I just need to load a sound in wav format and play it, but glut don´t have that capabilities.   ;Quote:Original post by templewulf@BringBackFuturama:I don't think SDL is targeted at Linux.  One of their big features is being cross-platform, and it works wonderfully with VC2005.  I did have some frustration in setting it up, so maybe there's just a higher barrier to entry?I don't think they want me using SDL...or anyone who doesn't understand things pretty well. Which is ironic, because it's supposed to be a simplified library. I can't get it on my VS 2005, MinGW or anything else for that matter. It keeps giving me errors when I try to compile after setting it up. I've given up on that though. I'm sucking it up and doing .NET development like the monopoly wants.;Quote:Original post by BringBackFuturamaI don't think they want me using SDL...or anyone who doesn't understand things pretty well. Which is ironic, because it's supposed to be a simplified library. I can't get it on my VS 2005, MinGW or anything else for that matter. It keeps giving me errors when I try to compile after setting it up. I've given up on that though. I'm sucking it up and doing .NET development like the monopoly wants.The reason SDL is somewhat hard to setup is that it is made for any existing platform and compiler. It is not tailor made for Windows like other libraries. That said it really isn't that hard, and I'm sure with the Alternative Game Library Forum's help, you could get it running.Drake, If all you need is to play simple Wavs, have you tried PlaySound? It has some drawbacks (I think it only plays one sound at a time), but if that's all you need, it's simple.   ;  Hi, I would help you but I don't know anything about borland builder 6. Maybe you can post some error codes and / or describe what you've done, this would help getting some feedback.If you want to use OpenAL, you can use it with Alut which simplifies things greatly. For SDL, I would recommend using SDL_Mixer on top of SDL.You could also check out FMOD, free for non-commercial use. It has an import library for borland which uses the c interface.Good luck.   ;  These are the errors when I tried to compile the code above to test openAl in my computer using Borland C+++ Builder 6:Build  [Linker Error] Unresolved external '_alListenerfv' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alGenBuffers' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alBufferData' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alGenSources' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alGetError' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alSourcef' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alSourcefv' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alSourcei' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alSourcePlay' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJ  [Linker Error] Unresolved external '_alSourceStop' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRADOR\ESCRITORIO\OAL\UNIT1.OBJThis is the code://---------------------------------------------------------------------------#pragma hdrstop/#include &lt;gl/glut.h&gt;#include "AL/alut.h"#include &lt;stdlib.h&gt;#include &lt;stdio.h&gt;#define NUM_BUFFERS 3#define NUM_SOURCES 3#define NUM_ENVIRONMENTS 1ALfloat listenerPos[]={0.0,0.0,4.0};ALfloat listenerVel[]={0.0,0.0,0.0};ALfloat source0Pos[]={ -2.0, 0.0, 0.0};ALfloat source0Vel[]={ 0.0, 0.0, 0.0};ALfloat source1Pos[]={ 2.0, 0.0, 0.0};ALfloat source1Vel[]={ 0.0, 0.0, 0.0};ALfloat source2Pos[]={ 0.0, 0.0, -4.0};ALfloat source2Vel[]={ 0.0, 0.0, 0.0};ALuint buffer[NUM_BUFFERS];ALuint source[NUM_SOURCES];ALuint environment[NUM_ENVIRONMENTS];int GLwin ;ALsizei size,freq;ALenum format;ALvoid *data;int ch;void init(void){glClearColor(0.0,0.0,0.0,1.0) ;ALint error;ALboolean loop=1;alListenerfv(AL_POSITION,listenerPos);alListenerfv(AL_VELOCITY,listenerVel);alGenBuffers(NUM_BUFFERS,buffer);if ((error = alGetError()) != AL_NO_ERROR){printf("- Error creating buffers !!\n");exit(1);}alutLoadWAVFile("c.wav",&format,&data,&size,&freq,&loop);alBufferData(buffer[0],format,data,size,freq);alutUnloadWAV(format,data,size,freq);alutLoadWAVFile("b.wav",&format,&data,&size,&freq,&loop);alBufferData(buffer[1],format,data,size,freq);alutUnloadWAV(format,data,size,freq);alutLoadWAVFile("a.wav",&format,&data,&size,&freq,&loop);alBufferData(buffer[2],format,data,size,freq);alutUnloadWAV(format,data,size,freq);alGenSources(NUM_SOURCES,source);if ((error = alGetError())!=AL_NO_ERROR){printf("- Error creating sources !!\n");exit(2);}alSourcef(source[0],AL_PITCH,1.0f);alSourcef(source[0],AL_GAIN,1.0f);alSourcefv(source[0],AL_POSITION,source0Pos);alSourcefv(source[0],AL_VELOCITY,source0Vel);alSourcei(source[0],AL_BUFFER,buffer[0]);alSourcei(source[0],AL_LOOPING,AL_TRUE);alSourcef(source[1],AL_PITCH,1.0f);alSourcef(source[1],AL_GAIN,1.0f);alSourcefv(source[1],AL_POSITION,source1Pos);alSourcefv(source[1],AL_VELOCITY,source1Vel);alSourcei(source[1],AL_BUFFER,buffer[1]);alSourcei(source[1],AL_LOOPING,AL_TRUE);alSourcef(source[2],AL_PITCH,1.0f);alSourcef(source[2],AL_GAIN,1.0f);alSourcefv(source[2],AL_POSITION,source2Pos);alSourcefv(source[2],AL_VELOCITY,source2Vel);alSourcei(source[2],AL_BUFFER,buffer[2]);alSourcei(source[2],AL_LOOPING,AL_TRUE);}void display(void){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;glPushMatrix() ;glRotatef(20.0,1.0,1.0,0.0) ;glPushMatrix() ;glTranslatef(source0Pos[0],source0Pos[1],source0Pos[2]) ;glColor3f(1.0,0.0,0.0) ;glutWireCube(0.5) ;glPopMatrix() ;glPushMatrix() ;glTranslatef(source2Pos[0],source2Pos[1],source2Pos[2]) ;glColor3f(0.0,0.0,1.0) ;glutWireCube(0.5) ;glPopMatrix() ;glPushMatrix() ;glTranslatef(source1Pos[0],source0Pos[1],source0Pos[2]) ;glColor3f(0.0,1.0,0.0) ;glutWireCube(0.5) ;glPopMatrix() ;//the listenerglPushMatrix() ;glTranslatef(listenerPos[0],listenerPos[1],listenerPos[2]) ;glColor3f(1.0,1.0,1.0) ;glutWireCube(0.5) ;glPopMatrix() ;glPopMatrix() ;glutSwapBuffers() ;}void reshape(int w, int h) // the reshape function{glViewport(0,0,(GLsizei)w,(GLsizei)h) ;glMatrixMode(GL_PROJECTION) ;glLoadIdentity() ;gluPerspective(60.0,(GLfloat)w/(GLfloat)h,1.0,30.0) ;glMatrixMode(GL_MODELVIEW) ;glLoadIdentity() ;glTranslatef(0.0,0.0,-6.6) ;}void keyboard(unsigned char key, int x, int y){switch(key){case '1':alSourcePlay(source[0]);break;case '2':alSourcePlay(source[1]);break;case '3':alSourcePlay(source[2]);break;case '4':alSourceStop(source[0]);break;case '5':alSourceStop(source[1]);break;case '6':alSourceStop(source[2]);break;case 'a':case 'A':listenerPos[0]-= 0.1 ;alListenerfv(AL_POSITION,listenerPos);break ;case 's':case 'S':listenerPos[0] += 0.1 ;alListenerfv(AL_POSITION,listenerPos);break ;case 'q':case 'Q':listenerPos[2] -= 0.1 ;alListenerfv(AL_POSITION,listenerPos);break ;case 'z':case 'Z':listenerPos[2] += 0.1 ;alListenerfv(AL_POSITION,listenerPos);break ;case 27 :alSourceStop(source[2]);alSourceStop(source[1]);alSourceStop(source[0]);alutExit();glutDestroyWindow(GLwin) ;exit(0) ;default:break ;}glutPostRedisplay() ;}int main(int argc, char** argv){//initialise glutglutInit(&argc, argv) ;glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ;glutInitWindowSize(400,400);alutInit(&argc, argv) ;GLwin = glutCreateWindow("OpenAL & OpenGL | www.dev-gallery.com") ;init() ;glutDisplayFunc(display) ;glutKeyboardFunc(keyboard) ;glutReshapeFunc(reshape) ;glutMainLoop() ;return 0;} [Edited by - drake1983 on June 7, 2006 8:37:20 AM]