Eventos Actuales |
No hay eventos actualmente
|
| | Autor | Mensaje |
---|
Caballero

Barra de Salud : 
Mensajes : 321
Reputación : 56 Monedas de oro : 990 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Música en loop. Sáb Feb 18, 2017 10:30 am | |
| Hola y muy buenas, me gustaría poner música en un mapa y no sé cómo, la cuestión es que yo detesto la música del juego y por ello siempre la tengo quitada. Pero quiero que haya música en el mapa, y sea obligatoria básicamente, por lo cual quiero que la música no se reproduzca como música en sí, sino como sonido. Explico como es en el mapa:- No hay música de ambiente. - Aparece un jefe y la música comienza a reproducirse en bucle (recuerden, como sonido). - Cuando el jefe muere, esta música (reproducida como sonido en realidad), deja de reproducirse. Espero puedan ayudarme con esto saludos.
 |
|  | | 

Barra de Salud : 
Mensajes : 3543
Reputación : 677 Monedas de oro : 11074 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Sáb Feb 18, 2017 7:22 pm | |
| [gui]Acciones Sonido - Play Música Sonido - Stop music Inmediatamente [/gui] Son acciones en GUI  Opción en el editor de sonido Creo que no necesitarías nada más |
|  | | Soldado

Barra de Salud : 
Mensajes : 72
Reputación : 3 Monedas de oro : 216 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Sáb Feb 18, 2017 7:43 pm | |
| se te recomienda que lo pongan como musica, hasta donde se para poner algo como sonido tiene que ser en un formato diferente que no seria recomendable para algo de la duracion de una musica porque pesaria mucho aunque como en la ultima version ya permite que el mapa pese mas de 8mb, podrias hacerlo y normal pero no se si esto afecte al tiempo de carga y haga que tarde mas o este lento |
|  | | 

Barra de Salud : 
Mensajes : 3543
Reputación : 677 Monedas de oro : 11074 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Sáb Feb 18, 2017 7:55 pm | |
| - @Lorchipdelta escribió:
- se te recomienda que lo pongan como musica, hasta donde se para poner algo como sonido tiene que ser en un formato diferente que no seria recomendable para algo de la duracion de una musica porque pesaria mucho aunque como en la ultima version ya permite que el mapa pese mas de 8mb, podrias hacerlo y normal pero no se si esto afecte al tiempo de carga y haga que tarde mas o este lento
Pues el tamaño del mapa no afecta practicamente en nada al cargado del mapa(solo la primera vez que se ve el modelo importado, o sea, durante la precarga, que se hace luego de que se cargue el mapa pero antes de empezar a jugarlo) Un mapa carga lento cuando tienes muchos datos de objetos, sobre todo: Muchas unidades personalizadas, habilidades personalizadas de MUCHOS niveles, es más, una habilidad de 100 niveles laguea SUMAMENTE tu mapa, a menos que hagas unos truquillos usando widgetizer y conocimiento del motor del juego y por supuesto, muchos objetos o destructibles |
|  | | 

Barra de Salud : 
Mensajes : 978
Reputación : 113 Monedas de oro : 1247 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Sáb Feb 18, 2017 9:31 pm | |
| Yo uso este código para mis mapas (en ALPRO lo uso para reproducir un loop en el character select), no necesitas tener conocimientos avanzados en jass para poder usarlo, allí te proporcione un mapa ejemplo para que veas como se usa:
https://mega.nz/#!Co02HDwT!rtPHeZ4Jkma0N-fnZl0ccrdzctE3rAZBJEarTnipl6o
- Usa la tecla Esc para reproducir un sonido al azar.
[jass]library SoundTools/* ************************************************************************************************* * * ********************************************************************************************* * */ uses /* * */ DimensionalArray /* hiveworkshop.com/forums/submissions-414/snipet-dimensional-array-265011/ * */ TimerUtils /* * ********************************************************************************************* * * SoundFx * ¯¯¯¯¯¯¯ * v1.0.1.2 * by Trigger edge * * This library is designed to play sounds every 0.03 seconds without pauses * and reduce the use of handles per sound (4 per Sound). * * API: * ¯¯¯ * struct SoundFx extends array * * readonly real duration * * static method create takes string file, boolean looping, boolean is3D returns SoundFx * static method createEx takes string file, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns SoundFx * method stop takes boolean fadeOut returns nothing * * method operator isPlaying takes nothing returns boolean * method operator volume= takes integer vol returns nothing * method operator pitch= takes integer pitch returns nothing * * method play takes nothing returns nothing * method playOnUnit takes unit u returns nothing * method playOnPoint takes real x, real y, real z returns nothing * method playForPlayer takes player p returns nothing * * Credits: * ¯¯¯¯¯¯¯ * - Rising_Dusk, Magtheridon96: SoundUtils/SoundTools * ***********************************************************************************************/
globals private constant integer MULTI_SOUND_SIZE=4
private Array sn=0 private integer next=0 private integer size=0
private player forPlayer=null private timer mainTimer=CreateTimer()
private player array stackPlayer private sound array stackSound private integer array soundInstance endglobals
struct Sound extends array readonly real duration
private real lastPitch private integer index private method operator sound takes nothing returns sound if(MULTI_SOUND_SIZE==.index)then set .index=0 endif set .index=.index+1 return sn[this][.index].sound endmethod
method operator volume= takes integer vol returns nothing local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) call SetSoundVolume(sn[this][i].sound,vol) set i=i-1 endloop endmethod
method operator isPlaying takes nothing returns boolean local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) return GetSoundIsPlaying(sn[this][i].sound) set i=i-1 endloop return false endmethod
method operator isLoading takes nothing returns boolean local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) return GetSoundIsLoading(sn[this][i].sound) set i=i-1 endloop return false endmethod
method operator pitch= takes integer pitch returns nothing local integer i=MULTI_SOUND_SIZE //due to the bugged pitch native, we need this workaround snippet in order to make it work if(.isPlaying or .isLoading)then loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,1/.lastPitch) call SetSoundPitch(sn[this][i].sound,pitch) set i=i-1 endloop set .lastPitch=pitch else if(1==pitch)then loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,1.0001) set i=i-1 endloop set .lastPitch=1.0001 else loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,pitch) set i=i-1 endloop set .lastPitch=pitch endif endif endmethod
private static method onSoundExpire takes nothing returns nothing local timer t=GetExpiredTimer() call StopSound(sn[GetTimerData(t)].sound,false,false) call ReleaseTimer(t) endmethod private static method executeSounds takes nothing returns nothing loop exitwhen(0==next) if(GetSoundIsPlaying(stackSound[next]))then call StopSound(stackSound[next],false,false) endif if(null==stackPlayer[next])then call StartSound(stackSound[next]) elseif(null!=stackPlayer[next] and GetLocalPlayer()==stackPlayer[next])then call StartSound(stackSound[next]) endif call TimerStart(NewTimerEx(GetHandleId(stackSound[next])),thistype(soundInstance[next]).duration,false,function thistype.onSoundExpire) set stackSound[next]=null set stackPlayer[next]=null set next=next-1 endloop endmethod private method filterPlay takes sound s, player p returns nothing if(0<.duration)then set next=next+1 set stackSound[next]=s set stackPlayer[next]=p set soundInstance[next]=this call ResumeTimer(mainTimer) debug else debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"[Sound] error: attempted to play null sound") endif endmethod
method play takes nothing returns nothing call .filterPlay(.sound,null) endmethod method playOnUnit takes unit u returns nothing local sound s=.sound call AttachSoundToUnit(s,u) call .filterPlay(s,null) set s=null endmethod method playOnPoint takes real x, real y, real z returns nothing local sound s=.sound call SetSoundPosition(s,x,y,z) call .filterPlay(s,null) set s=null endmethod method playForPlayer takes player p returns nothing call .filterPlay(.sound,p) endmethod static method createEx takes string file, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns Sound local thistype this=size+1 local integer i=MULTI_SOUND_SIZE local integer id=StringHash(file) local sound s if(not sn[id].has.integer)then set .duration=GetSoundFileDuration(file)*.001 if(0==.duration)then return 0 endif set size=this set sn[id].integer=this loop exitwhen(0==i) set s=CreateSound(file,looping,is3D,stopwhenoutofrange,fadeInRate,fadeOutRate,eaxSetting) call SetSoundVolume(s,127) if(is3D)then call SetSoundDistances(s,600,10000) call SetSoundDistanceCutoff(s,3000) call SetSoundConeAngles(s,0,0,127) call SetSoundConeOrientation(s,0,0,0) endif set sn[this][i].handle=s set sn[GetHandleId(s)].handle=s set i=i-1 endloop set s=null return this else return sn[id].integer endif endmethod static method create takes string file, boolean looping, boolean is3D returns Sound return createEx(file,looping,is3D,true,10,10,"") endmethod method stop takes boolean fadeOut returns nothing local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) call StopSound(sn[this][i].sound,false,fadeOut) set i=i-1 endloop endmethod private static method onInit takes nothing returns nothing set sn=Array.create() call TimerStart(mainTimer,0,false,function thistype.executeSounds) endmethod endstruct endlibrary[/jass]   |
|  | | Caballero

Barra de Salud : 
Mensajes : 321
Reputación : 56 Monedas de oro : 990 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Lun Feb 20, 2017 10:04 am | |
| - @Marcos_M escribió:
- [gui]Acciones
Sonido - Play Música Sonido - Stop music Inmediatamente [/gui]
Son acciones en GUI
 Opción en el editor de sonido
Creo que no necesitarías nada más Lo hago en un mapa, lo pruebo, y te lo mando, es que ya lo intenté así, pero no funcionaba. |
|  | | Caballero

Barra de Salud : 
Mensajes : 321
Reputación : 56 Monedas de oro : 990 Monedas de Platino : 0 
Inventario :  
 | (#) Tema: Re: Música en loop. Sáb Mar 18, 2017 2:21 pm | |
| - @Trigger.edge escribió:
- Yo uso este código para mis mapas (en ALPRO lo uso para reproducir un loop en el character select), no necesitas tener conocimientos avanzados en jass para poder usarlo, allí te proporcione un mapa ejemplo para que veas como se usa:
https://mega.nz/#!Co02HDwT!rtPHeZ4Jkma0N-fnZl0ccrdzctE3rAZBJEarTnipl6o
- Usa la tecla Esc para reproducir un sonido al azar.
[jass]library SoundTools/* ************************************************************************************************* * * ********************************************************************************************* * */ uses /* * */ DimensionalArray /* hiveworkshop.com/forums/submissions-414/snipet-dimensional-array-265011/ * */ TimerUtils /* * ********************************************************************************************* * * SoundFx * ¯¯¯¯¯¯¯ * v1.0.1.2 * by Trigger edge * * This library is designed to play sounds every 0.03 seconds without pauses * and reduce the use of handles per sound (4 per Sound). * * API: * ¯¯¯ * struct SoundFx extends array * * readonly real duration * * static method create takes string file, boolean looping, boolean is3D returns SoundFx * static method createEx takes string file, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns SoundFx * method stop takes boolean fadeOut returns nothing * * method operator isPlaying takes nothing returns boolean * method operator volume= takes integer vol returns nothing * method operator pitch= takes integer pitch returns nothing * * method play takes nothing returns nothing * method playOnUnit takes unit u returns nothing * method playOnPoint takes real x, real y, real z returns nothing * method playForPlayer takes player p returns nothing * * Credits: * ¯¯¯¯¯¯¯ * - Rising_Dusk, Magtheridon96: SoundUtils/SoundTools * ***********************************************************************************************/
globals private constant integer MULTI_SOUND_SIZE=4
private Array sn=0 private integer next=0 private integer size=0
private player forPlayer=null private timer mainTimer=CreateTimer()
private player array stackPlayer private sound array stackSound private integer array soundInstance endglobals
struct Sound extends array readonly real duration
private real lastPitch private integer index private method operator sound takes nothing returns sound if(MULTI_SOUND_SIZE==.index)then set .index=0 endif set .index=.index+1 return sn[this][.index].sound endmethod
method operator volume= takes integer vol returns nothing local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) call SetSoundVolume(sn[this][i].sound,vol) set i=i-1 endloop endmethod
method operator isPlaying takes nothing returns boolean local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) return GetSoundIsPlaying(sn[this][i].sound) set i=i-1 endloop return false endmethod
method operator isLoading takes nothing returns boolean local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) return GetSoundIsLoading(sn[this][i].sound) set i=i-1 endloop return false endmethod
method operator pitch= takes integer pitch returns nothing local integer i=MULTI_SOUND_SIZE //due to the bugged pitch native, we need this workaround snippet in order to make it work if(.isPlaying or .isLoading)then loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,1/.lastPitch) call SetSoundPitch(sn[this][i].sound,pitch) set i=i-1 endloop set .lastPitch=pitch else if(1==pitch)then loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,1.0001) set i=i-1 endloop set .lastPitch=1.0001 else loop exitwhen(0==i) call SetSoundPitch(sn[this][i].sound,pitch) set i=i-1 endloop set .lastPitch=pitch endif endif endmethod
private static method onSoundExpire takes nothing returns nothing local timer t=GetExpiredTimer() call StopSound(sn[GetTimerData(t)].sound,false,false) call ReleaseTimer(t) endmethod private static method executeSounds takes nothing returns nothing loop exitwhen(0==next) if(GetSoundIsPlaying(stackSound[next]))then call StopSound(stackSound[next],false,false) endif if(null==stackPlayer[next])then call StartSound(stackSound[next]) elseif(null!=stackPlayer[next] and GetLocalPlayer()==stackPlayer[next])then call StartSound(stackSound[next]) endif call TimerStart(NewTimerEx(GetHandleId(stackSound[next])),thistype(soundInstance[next]).duration,false,function thistype.onSoundExpire) set stackSound[next]=null set stackPlayer[next]=null set next=next-1 endloop endmethod private method filterPlay takes sound s, player p returns nothing if(0<.duration)then set next=next+1 set stackSound[next]=s set stackPlayer[next]=p set soundInstance[next]=this call ResumeTimer(mainTimer) debug else debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"[Sound] error: attempted to play null sound") endif endmethod
method play takes nothing returns nothing call .filterPlay(.sound,null) endmethod method playOnUnit takes unit u returns nothing local sound s=.sound call AttachSoundToUnit(s,u) call .filterPlay(s,null) set s=null endmethod method playOnPoint takes real x, real y, real z returns nothing local sound s=.sound call SetSoundPosition(s,x,y,z) call .filterPlay(s,null) set s=null endmethod method playForPlayer takes player p returns nothing call .filterPlay(.sound,p) endmethod static method createEx takes string file, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns Sound local thistype this=size+1 local integer i=MULTI_SOUND_SIZE local integer id=StringHash(file) local sound s if(not sn[id].has.integer)then set .duration=GetSoundFileDuration(file)*.001 if(0==.duration)then return 0 endif set size=this set sn[id].integer=this loop exitwhen(0==i) set s=CreateSound(file,looping,is3D,stopwhenoutofrange,fadeInRate,fadeOutRate,eaxSetting) call SetSoundVolume(s,127) if(is3D)then call SetSoundDistances(s,600,10000) call SetSoundDistanceCutoff(s,3000) call SetSoundConeAngles(s,0,0,127) call SetSoundConeOrientation(s,0,0,0) endif set sn[this][i].handle=s set sn[GetHandleId(s)].handle=s set i=i-1 endloop set s=null return this else return sn[id].integer endif endmethod static method create takes string file, boolean looping, boolean is3D returns Sound return createEx(file,looping,is3D,true,10,10,"") endmethod method stop takes boolean fadeOut returns nothing local integer i=MULTI_SOUND_SIZE loop exitwhen(0==i) call StopSound(sn[this][i].sound,false,fadeOut) set i=i-1 endloop endmethod private static method onInit takes nothing returns nothing set sn=Array.create() call TimerStart(mainTimer,0,false,function thistype.executeSounds) endmethod endstruct endlibrary[/jass] Hola Marshall, no me percaté de que me habías respondido, gracias. Estuve editando otras cosas mientras tanto, y anoche encontré una respuesta en la hive que me sirvió y que no es muy complicada. Este mensaje va para vos también @Marcos_M ya que solucioné mi problema, pero ahora, ¿me podrian decir si este deto causa algún leak? acá les dejo la captura: |
|  | |
 | (#) Tema: Re: Música en loop.  | |
| |
|  | | |
Temas similares |  |
|
| Permisos de este foro: | No puedes responder a temas en este foro.
| |
| |
| Últimos temas | » Hardcore Ninja [IA] Hoy a las 10:26 am por GhxBronie» Generador de Nombres Hoy a las 3:40 am por Satoshi» Modelos Final Fantasy Tactics Hoy a las 3:34 am por Satoshi» Crear Oleadas de Unidades Ayer a las 10:40 pm por GhxBronie» Crear Respawn de Jungla al estilo Dota Ayer a las 10:39 pm por GhxBronie» Crear Bonificación a Coste de Maná/Segundo Ayer a las 10:38 pm por GhxBronie» APORTE MODELOS 3D DE EL JUEGO "SMITE"  Jue Ene 14, 2021 8:06 pm por israelxd03» Ayuda - Reunir unidades y hacer accion Miér Ene 13, 2021 7:08 pm por Lordarkangel» Buen dia, preguntando desdpues de tiempo Miér Ene 13, 2021 6:51 pm por neruvian» Unidad que no pueda ser atacado por aliados Miér Ene 13, 2021 6:39 pm por neruvian» Has Tu DOTA y no jodas mas [+IA] = By ArOn Miér Ene 13, 2021 1:01 pm por fernando54988» DotA 6.83d_AI 1.8 "Kokox" Español Miér Ene 13, 2021 12:53 pm por fernando54988» [Anuncio] Sistema de "Especialidades" o "Profesiones" del editor Jue Ene 07, 2021 9:16 am por PENSATIVO197» [TUTORIAL] Optimizar un mapa al 200%!!! • Jue Ene 07, 2021 9:07 am por PENSATIVO197» Explicación de Datos en Spells Estándar V2 Lun Ene 04, 2021 2:12 pm por GhxBronie |
Los posteadores más activos de la semana | |
|