| | Autor | Mensaje |
---|
Caballero

Barra de Salud : 
Mensajes : 321
Reputación : 57 Monedas de oro : 991 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 : 3665
Reputación : 733 Monedas de oro : 11250 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 : 73
Reputación : 3 Monedas de oro : 221 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 : 3665
Reputación : 733 Monedas de oro : 11250 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 : 115 Monedas de oro : 1249 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 : 57 Monedas de oro : 991 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 : 57 Monedas de oro : 991 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.
| |
| |
| Eventos Actuales |
No hay eventos actualmente
|
Últimos temas | » animación con sistema de rayos  Vie Ago 05, 2022 5:26 pm por Maty» Modelos Rip HOTS para WC3 + Extra Miér Ago 03, 2022 5:01 pm por asav» Has Tu DOTA y no jodas mas [+IA] = By ArOn Mar Ago 02, 2022 10:33 pm por Manucho» Arenas de Batallas Dom Jul 31, 2022 1:48 am por jhontorisimo» [SISTEMA] Acumulación/Agrupación de items (Estilo DOTA) • Lun Jul 25, 2022 8:40 pm por Phantom Walker» Más Armas de Warhammer 40k (WIP) Lun Jul 25, 2022 2:53 am por Becientodos» Battle Troll (Troll de Batalla) - LOTR Vie Jul 15, 2022 8:02 pm por jose moreno» APORTE-Estructuras Protoss Starcraft II Vie Jul 15, 2022 12:23 pm por jak777» APORTE-Unidades Protoss Starcraft II Vie Jul 15, 2022 11:50 am por jak777» Ultralisk Vie Jul 15, 2022 11:47 am por jak777» Pack de modelos de Warhammer 40k Miér Jul 13, 2022 10:42 pm por Becientodos» "Pack" de cilindros para modelar Miér Jul 13, 2022 10:33 pm por Becientodos» Oleadas de creeps Miér Jul 13, 2022 3:52 pm por jose moreno» Archimonde Sexy Mar Jul 05, 2022 3:49 am por kadakash» AI O IA Mar Jun 28, 2022 7:36 pm por Maty |
Los posteadores más activos de la semana | |
¿Quién está en línea? | En total hay 12 usuarios en línea: 0 Registrados, 0 Ocultos y 12 Invitados :: 2 Motores de búsqueda Ninguno El record de usuarios en línea fue de 341 durante el Lun Nov 04, 2019 3:14 pm |
|