Ver Mensaje Individual
  #5  
Antiguo 27-07-2006
dicatek dicatek is offline
Miembro
 
Registrado: jun 2006
Posts: 46
Reputación: 0
dicatek Va por buen camino
Compartiendo buffers

LECCIÓN4
Si tu quieres usar un sonido varias veces no es necesario cargarlo constantemente, basta con compartir el buffer usado.
Modifica el numsources a 4, pero deja el numbuffers a 3. Añade un nuevo nombre al nuevo source:

Código Delphi [-]
walk2 = 3;


En el evento oncreate necesitamos inicializar el nuevo source:

Código Delphi [-]
SourcePos[0] := -8.0;
SourcePos[1] := 0.0;
SourcePos[2] := -8.0;
AlSourcei ( source[walk2], AL_BUFFER, buffer[walk]);
AlSourcef ( source[walk2], AL_PITCH, 1.0 );
AlSourcef ( source[walk2], AL_GAIN, 0.2 );
AlSourcefv ( source[walk2], AL_POSITION, @sourcepos);
AlSourcefv ( source[walk2], AL_VELOCITY, @sourcevel);
AlSourcei ( source[walk2], AL_LOOPING, AL_TRUE);


You see instead of using buffer[walk2] we use buffer[walk] again. If you want you could use the same walk sound again and again.
For playing the new source it is easiest to create some new buttons for playing and stopping it.

If you feel up to it you really should change the way sourcepos and sourcevel are used. Instead of sharing it for all sounds you should give each source its own sourcepos and sourcevel.
Lección4
Responder Con Cita