Changing Music ingame
#1 Posted 12 September 2017 - 05:50 PM
You start with Music A when you start playing But then you come to a new area and then music changes to Music B
Is this possible?
#2 Posted 12 September 2017 - 05:57 PM
This post has been edited by Hendricks266: 12 September 2017 - 06:10 PM
#4 Posted 12 September 2017 - 06:13 PM
Also which CON is the one i should use for this effect?
#5 Posted 12 September 2017 - 06:17 PM
If you quit the game and return, music stays changed until a code undo it.
#6 Posted 12 September 2017 - 06:29 PM
Those are the gamevar codes to make your music changer work (has to be above the state for music changer)
gamevar musicVolume -1 0
gamevar musicLevel -1 0
gamevar MUSBLOCK 0 0
state reset_musicALL
setvar musicVolume -1
setvar musicLevel -1
ends
(boss music)
state trigger_music12
ifvarg musicVolume -1
setuserdef[THISACTOR].volume_number 3
ifvarg musicLevel -1
starttrackvar 12
setuserdef[THISACTOR].volume_number 3
ends
(I have several for diff boss musics so we put more than 1 state)
// music resetter and triggerer events
onevent EVENT_RESETPLAYER
state reset_musicALL
endevent
onevent EVENT_ENTERLEVEL
state reset_musicALL
endevent
onevent EVENT_LOADGAME
ifvare MUSBLOCK 12 { state trigger_music12 }
endevent
effector or inside the boss when he dies.
this makes the thing work when you're in then same sector, kinda like a touchplate pointing down.
useractor notenemy ACTORNAMEFORMUSIC
cstator 32768 (so you can't see the actor in game)
getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2
{
setvar MUSBLOCK 0
state reset_musicALL
starttrack 2
killit
}
enda
Now the music starter
useractor notenemy ACTORNAMEFORMUSICSTART
cstator 32768
getactor[THISACTOR].sectnum temp
getplayer[THISACTOR].cursectnum temp2
ifvarvare temp temp2
{
setvar MUSBLOCK 12
setvar musicVolume 0
setvar musicLevel 0
state trigger_music12
killit
}
enda
Don't forget to put that under all the codes to reset when you die or when you beat a level.
onevent EVENT_RESETPLAYER
setvar MUSBLOCK 0
endevent
#7 Posted 12 September 2017 - 06:58 PM
#8 Posted 13 September 2017 - 04:01 AM
#9 Posted 13 September 2017 - 07:31 AM
What in here would do what you want? http://xmp.sourceforge.net/libxmp.html
#10 Posted 13 September 2017 - 12:07 PM
Player control
> int xmp_channel_mute(xmp_context c, int chn, int status)
> int xmp_channel_vol(xmp_context c, int chn, int vol)
-- These would allow fading/muting channels in / out depending on situation (like some extra synth kicking in due to an event)
> void xmp_inject_event(xmp_context c, int chn, struct xmp_event *event)
-- This would allow injecting events to do stuff like "ok, guitar instrument should jump to this pattern" and that hypotetical pattern 7 could have an effect loop of patterns 7-8-9-7-8-9 until an injected effect calls it back.
Think of like injecting call/return in the middle of a pattern. Pitch slides/bpm and all sorts of things are dynamically possible when injecting effects.
Module playing
> void xmp_get_frame_info(xmp_context c, struct xmp_frame_info *info)
-- If a transition is desired, one could potentially monitor when the end of a pattern has been reached to inject that transition or mute/unmute channels for seamless transitions.
#11 Posted 13 September 2017 - 12:22 PM
"int xmp_prev_position(xmp_context c)", and "int xmp_set_position(xmp_context c, int pos)" entries.
This post has been edited by MusicallyInspired: 13 September 2017 - 12:24 PM
#12 Posted 13 September 2017 - 12:26 PM
#13 Posted 13 September 2017 - 12:48 PM
This post has been edited by MusicallyInspired: 13 September 2017 - 12:48 PM
#14 Posted 13 September 2017 - 12:55 PM
Those three entries you linked are something I looked at before, not 100% if it allows seamless but theoretically if you jumped to the same relative pattern position, it should still hit the beats at the same order. Some instruments might just jump in/out instead of a nice crossfade or at the end of a pattern (unless you jump straight to a start/end)
However, enabling these is never a bad thing!
Mark, it's actually more than just a gimmick I'd say.. Imagine some games where the music adds in some guitars / etc.. dynamically when you're in combat, gracefully transitioning back to a more mellow state without jumping between streamed audio files.
Module music is incredibly flexible and generally a much better option than stock MIDI as you can manipulate it on the fly quite a lot. Something like iMuse seen in lucasarts games achieve a similar end result.
You can even make a rather seamless 50min mix out of 10min worth of material with just some code and shuffling around of patterns
#15 Posted 13 September 2017 - 01:26 PM
This post has been edited by Mark.: 13 September 2017 - 01:29 PM
#16 Posted 13 September 2017 - 02:01 PM
oasiz, on 13 September 2017 - 12:55 PM, said:
Those three entries you linked are something I looked at before, not 100% if it allows seamless but theoretically if you jumped to the same relative pattern position, it should still hit the beats at the same order. Some instruments might just jump in/out instead of a nice crossfade or at the end of a pattern (unless you jump straight to a start/end)
However, enabling these is never a bad thing!
I'm sure there's some functions in there for detecting if a pattern has played through to the end or not. Either way, you could fade all channels out manually and restart at a different index position, that's a way to do it.
This post has been edited by MusicallyInspired: 13 September 2017 - 02:03 PM
#17 Posted 13 September 2017 - 02:50 PM
But knowing the backlog of eduke32 fixes and features on the dev's list, if its not an easy thing to do I would hope it gets a lower priority.
This post has been edited by Mark.: 13 September 2017 - 02:54 PM
#18 Posted 13 September 2017 - 05:56 PM
#19 Posted 13 September 2017 - 06:43 PM
Maisth, on 13 September 2017 - 05:56 PM, said:
No, I never did anything with music in that mod. I've added music related features in some other mods, though. What specifically are you looking for?