![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
|
|
#1
|
|||
|
|||
|
Múltiples sonidos en movimiento
LECCIÓN3
Un sonido en movimiento no tiene demasiada complicación, pero ¿qué ocurre cuando tenemos varios sonidos en movimiento? Para realizar la siguiente lección, necesitaremos como base, el código hecho en la lección2. El uso de sonidos múltiples no tiene la complicación que parece. En la unidad de la lección2 debemos añadir una sección de constantes ( ) que contenga el siguiente codigo:
Este código significa que tendremos tres buffers y tres sources. Tambien debemos dar nombres sencillos a dichos recursos. La variable buffer y source necesitan ser modificados de la siguiente manera:
That gives you an array of buffers and an array of sources. Now every buffer has to be initialised in the oncreate event:
y cada sonido debe ser cargado:
Tambien hemos de localizar cada source:
Debes añadir lo mismo para el sondidp "ding" y "zap". Para reproducir un único sonido debemos de aplicar la siguiente función:
Lo mismo ocurre si queremos detener o pausar un sonido. Puedes crear botones para reproducir, pausar o detener cada sonido o bien crear un botón para reproducirlos todos a la vez. The ontimer event also needs calls to multiple sources instead of one. You should have an idea on thow to change this. Ahora todos los sonidos se mueven en la misma dirección y esto no es muy interesante. Change the ontimer event so that it only updates the walk source. In front of setting the source for ding and zap place something like this:
You may also want to lower the gain (loudnes) of ding and zap to 0.2 The walk could use a boost to 1.5 . But you could place ding and zap further away to make them sound softer. Lección3 |
|
#2
|
|||
|
|||
|
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:
En el evento oncreate necesitamos inicializar el nuevo source:
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 |
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Que usais para programar en php? | chux | HTML, Javascript y otros | 22 | 18-08-2006 16:38:31 |
| programar para windows CE | ronalg | Varios | 8 | 31-08-2005 09:06:13 |
| Programar para APPLE | eduarcol | Varios | 0 | 27-02-2005 20:59:56 |
| Programación Orientada a Aspectos | marcoszorrilla | Debates | 17 | 06-04-2004 23:18:27 |
| Programar para PDA | Novás | Varios | 2 | 02-12-2003 15:06:30 |
|