StopMusic and RestartMusic

Moderator: GZDoom Developers

JL_Harkster
Posts: 94
Joined: Wed Sep 13, 2006 2:03 pm
Location: In front of a Baron, holding a Plasma Rifle

StopMusic and RestartMusic

Post by JL_Harkster »

You already have SetMusic to change music on the fly, how hard could it be to start and stop it?

I saw some old threads on the forum asking for control over music looping. With this, it could just be done manually with ACS given that you know the length of the song beforehand.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Unfortunately it's not that simple, since music continues when you pause the game or go to the menu, but the game timer does not.

In ZDCMP, Bio had to put a message in the credits to the effect of "please don't pause or go to the menu during the credits!" because he wanted it timed to the music track.

Also, these functions are basically available now. "stopmusic" can be achieved already by sending a blank string to setmusic, and restart by first sending a blank string, then setting the music again.
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

Say, how long has that URL been your custom tittle Risen?
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Since about Thursday. We just launched it. I've been waiting to see who would notice first. :)
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Hey I noticed it 12 hours ago! But I didn't talk about it because I didn't think it was ready yet or something... I mean the screenshots aren't clickable and all.

Anyway, there is a workaround for the "music desyncs from cutscene when paused or menu open" problem. You make the music a sound, then attach it to an actor or play a local sound through ACS. Sounds are pausable.

The downside to this is that the music slider in the Options menu will have no effect on this "music" you play.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Of course this can be implemented. Code for pausing music already exists. However, keep in mind that you won't be able to control the music's position so the use of such a function is more or less limited.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Nash wrote:Hey I noticed it 12 hours ago! But I didn't talk about it because I didn't think it was ready yet or something... I mean the screenshots aren't clickable and all.
At least a few people noticed on Thursday, given the site's traffic stats.

We're not going to provide any larger screenshots. At least some of the fun of playing this the first time will be recognizing how we've changed E1 as you go along, so providing lots of high-resolution screenshots would detract from the game experience. What you can see here gives you a general idea, but the inability to see detail here is intentional.
User avatar
Siggi
Posts: 3288
Joined: Sun Oct 03, 2004 8:57 am
Preferred Pronouns: They/Them
Location: South Africa

Post by Siggi »

I was wondering, does ZDoom know when the music currently playing has started a new loop?

I was thinking it would be nice for the music for a specific stage to have an intro, then a loop. The idea being, you'd set a specific track for the music in the level when the level begins, and when the 1st track ends changed to another 2nd track which loops.

I have no idea how possible this is, either currently, or as a feature suggestion. It's just something I think of asking every now and then.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Tracked music (.mod, .it, .xm, .s3m etc) has commands that tell the song to loop at a specific pattern so it is kind of possible.

You'd be limited to tracked music and still at the mercy of the main menu and pausing.
JL_Harkster
Posts: 94
Joined: Wed Sep 13, 2006 2:03 pm
Location: In front of a Baron, holding a Plasma Rifle

Post by JL_Harkster »

Psycho Siggi wrote:I was wondering, does ZDoom know when the music currently playing has started a new loop?

I was thinking it would be nice for the music for a specific stage to have an intro, then a loop. The idea being, you'd set a specific track for the music in the level when the level begins, and when the 1st track ends changed to another 2nd track which loops.

I have no idea how possible this is, either currently, or as a feature suggestion. It's just something I think of asking every now and then.
With a midi, if you knew the length of the music, you can write a script that does this yourself. Just have the script wait for a specified period of time until the length of the midi passes, then change the music to the new piece.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

That will work, but the main menu doesn't stop the music so it'll desync again.

It'll be slightly better if the MIDI isn't looped (which is uncommon for downloaded MIDIs - you'd have to do it yourself in a MIDI editor). The music will just stop earlier before the next music change.

For cutscenes that have to sync with music, I came up with a solution by making the song an MP3 or OGG, then play it as a sound by using the ACS function AmbientSound().

Sounds can be paused and will continue playing where it stopped when unpaused, and it works for the main menu too.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Could a MAPINFO option be added to pause the music on pause/menu?
User avatar
Enjay
 
 
Posts: 27160
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

Risen wrote:Could a MAPINFO option be added to pause the music on pause/menu?
Or could there even be a MAPINFO entry to define pause/menu music like a lot of games have?
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

Oooh! I would really really really love the ability to define a separate main menu music!

If that gets added... don't forget that the map music should resume where it left off when you accessed the menu, and not play back from the beginning.
User avatar
Jimmy
 
 
Posts: 4728
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Post by Jimmy »

Nash wrote:Oooh! I would really really really love the ability to define a separate main menu music!
If you wanted a way round this that's already possible in this version of ZDoom, just create an outside sector with a texture that looks like a menu. Place a camera in the sector and bind Esc to launch into the script to go to the custom "menu".

Of course, you'd have to know a lot of ACS, and I don't know how you would go about halting gameplay ENTIRELY with this method, but it's a suggestion nonetheless.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”