Duke4.net Forums: Changing Music ingame - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Changing Music ingame

User is offline   Maisth 

#1

Is it possible to change the music while playing the game? example

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?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2

Yes, there is a CON command. "starttrackslot <episode> <level>"

This post has been edited by Hendricks266: 12 September 2017 - 06:10 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#3

*starttrackslot
1

User is offline   Maisth 

#4

Is there a tutorial to where i can learn CON?

Also which CON is the one i should use for this effect?
0

User is offline   Zaxtor 

#5

My mod has music changing when you head to bosses etc.

If you quit the game and return, music stays changed until a code undo it.
0

User is offline   Zaxtor 

#6

Example I do..


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
0

User is offline   Zaxtor 

#7

I use the trick not just for bosses or music of levels changing.

0

User is offline   MusicallyInspired 

  • The Sarien Encounter

#8

Hendricks, is the code in the latest version yet for MOD music? Will/does it have the capability to playback certain arrangements of patterns similar to Unreal's UMX files? I'd love to experiment with that.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #9

MOD, XM, IT, and S3M are fully supported on all platforms.

What in here would do what you want? http://xmp.sourceforge.net/libxmp.html
0

User is offline   oasiz 

  • Dr. Effector

#10

I think these four would get musicians pretty far (two first allowing a ton already).

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.
1

User is offline   MusicallyInspired 

  • The Sarien Encounter

#11

Those are great ideas! The fading in/out of channels and patterns for sure. What I was specifically looking for in my post was at least the option to change which part of the "pattern playlist" to start playing, which can be looped on their own. This screenshot of OpenMPT shows the "pattern playlist" or "timeline" above the visible pattern. You can see the pattern numbers aren't sequential and are set by the composer. The gaps in between pattern segments in the timeline are self-contained loopable segments of the song that are isolated from the rest of the song. I don't know what it's called to be able to pick which spot along the timeline to start playing. Unreal's UMX files have the same gaps to ensure no other sections are played and it can switch between them for dynamic playback (enemy spots you, generic wandering, some other event). I guess from that link you shared the proper commands would be related to the "int xmp_next_position(xmp_context c)",
"int xmp_prev_position(xmp_context c)", and "int xmp_set_position(xmp_context c, int pos)" entries.

Posted Image

This post has been edited by MusicallyInspired: 13 September 2017 - 12:24 PM

0

User is offline   Mark 

#12

Being a non technical guy, I didn't read through the whole list. It would be handy to have precise control over the music files stop/start for areas in a map. But a lot of those other features look to me to be gimmicks of very limited or no use for the average mapper. But hey, if its easy to implement those without side effects I say go for it.
0

User is offline   MusicallyInspired 

  • The Sarien Encounter

#13

The average mapper, no. But for composer mappers it opens a world of possibilities!

This post has been edited by MusicallyInspired: 13 September 2017 - 12:48 PM

0

User is offline   oasiz 

  • Dr. Effector

#14

Looks like they used a system I had in mind as well, practically calling & returning from "subtunes" inside the file, trapped in a pattern order.
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 :)
1

User is offline   Mark 

#15

I don't doubt for a second that the features are powerful and cool and exciting for musicians. But I'm sticking to my assessment that 95 percent of mappers won't make use of most of them. I hope to be proved wrong and our maps and mods are laced with the effects. But I'm not going to bet on it.

This post has been edited by Mark.: 13 September 2017 - 01:29 PM

0

User is offline   MusicallyInspired 

  • The Sarien Encounter

#16

That's no reason not to add the funcitonality. Half the mappers probably don't even use CON code itself at all.

View Postoasiz, on 13 September 2017 - 12:55 PM, said:

Looks like they used a system I had in mind as well, practically calling & returning from "subtunes" inside the file, trapped in a pattern order.
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

0

User is offline   Mark 

#17

I never said don't add it. Here is my quote from a previous post..." But hey, if its easy to implement those without side effects I say go for it."

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

1

User is offline   Maisth 

#18

Does DukePlus have an exclusive option? since it adds a bunch of new stuff in it
0

User is online   Danukem 

  • Duke Plus Developer

#19

View PostMaisth, on 13 September 2017 - 05:56 PM, said:

Does DukePlus have an exclusive option? since it adds a bunch of new stuff in it


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?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options