Halflife: [HL] Music restarts upon level change

Created on 24 Feb 2013  路  19Comments  路  Source: ValveSoftware/halflife

When activating a trigger that starts an .mp3 file, map changes will cause the song to start all over again rather than continue playing between level loads. It also restarts when the .mp3 file is COMPLETELY FINISHED.

This happens in the Linux version of Half-Life. Does it happen with Windows users too?

Feature Request Half-Life reviewed

Most helpful comment

@mikela-valve Can you look into this one?

All 19 comments

I just noticed this problem as well, both with the normal 48kbps soundtrack, and with custom content 128kbps MP3's. It's readily apparent during the tram ride, though luckily the audio is shut off by the map before a level transition at the end. However, no such luck later in anomalous materials. The music that plays when you pick up the HEV suit will restart when you transition levels; and will even restart after a level transition when the music had already finished. :( It never ends!

I'm running Windows 7 with the latest Half-Life version:

Protocol version 48
Exe version 1.1.2.2/Stdio (valve)
Exe build: 14:12:58 Feb 25 2013 (5968)

Yeah, there is an issue with the music. Those MP3s should play like CD audio tracks: only once and independent of loading saves and changing levels. Just like in the WON version of Half-Life.

Did some more experimenting with this. It's definitely happening all over Half-Life 1; but strangely not in Opposing Force or Blue Shift. It also happens with music triggered by levels and by music set to play through console commands.

Easiest way to reproduce it is to find a level transition you can cross back and forth between, play the 28th track (cd play 28) wait for it to finish (it's a short track) and then cross the transition; it'll start playing again every time, up until a new song is triggered at which point THAT song will start playing again after a level transition.

Still running Windows 7

Protocol version 48
Exe version 1.1.2.2/Stdio (valve)
Exe build: 18:02:44 Apr 3 2013 (6005)

BS and OF are broken. HL is partially fixed. Those games should play music just like I said above.

BS and OF just stop playing music when they hit a level transition (they don't play the RIGHT music, but that's another issue). They don't have this weird music restart glitch.

I'm not entirely sure it's possible for Half-Life to play an audio file during a load screen (CD music is different because that's handled on a hardware/operating system level). If it's not, then maybe it's possible for Half-Life to remember where the sound got cut off at and start it again once the level loads, but I'm just speculating at this point.

It is possible. My patched WON Game of the Year version has MP3 decoder and it plays music just like CD audio tracks.

Any ETA on when this will be fixed? (Especially since the music has been upgraded to 128 kbps) It surprising how mood breaking it is for the HEV music to repeat over and over. It sucks all the pre-reacter incident eeriness from the game...

I wonder if this was intentionally added as a way to get the opening tram music to play during the entire tram ride, since Half-Life kills the audio on level transitions. In which case I wonder if it's possible to turn it off for the rest of the game? Though if I had to choose between one and the other, I'd go with the music not restarting at all.

Maybe an alternative could be to alter the levels to start the tram music at the start of every map during the tram ride?

Okay, man was this subsystem busted. Assorted changes over the years meant the mp3 soundtrack wasn't playing for the right amount of time, I've gone through it now and I believe I have it back the way it used to be.

You are a beautiful person, Alfred. Thank you very much. If you're going to PAX Prime this year and I run into you, I owe you a coke or something! :smile:

Couple of notes about the current system

  1. In Half-Life it works BEAUTIFULLY. The music plays all during the tram level, and gets cuts off at the end like it's supposed to, and music will play during and after level transitions and not restart infinitely. Fantastic. The only minor issue I've found is that music will keeping playing even through saving and loading, but if it stayed that was I wouldn't shed any tears :smile:
  2. In Op4 and Blue Shift, the music will play through the level transition, but then stop after the level had loaded, strangely enough. You'd think the problem would be during the transition, not after! EDIT: This seems to happen with third party mods as well.

Anywho, thanks again!

EDIT: Just noticed an anomaly. In map c1a0c (the beginning of Unforeseen Consequences) the music track that plays (Half-Life07.mp3) will continue to loop constantly until a new track plays. When I get time tomorrow, I'll run through the game looking to see if any more do this, but the only one I've found is the opening tram music which is supposed to loop.

Also, a new wrinkle on the things replaying when you start a new game or load a save game, apparently you load a game while one of these looping songs is playing, instead of continuing to play the song until it's finished, it'll restart when the game loads and then restart after every level transition like the glitch of yore.

Yeah, this thread needs to be reopen.

Start a new game (or load a map with the music track), than start Hazard Course or Multiplayer, the music will reappear.

Okay, I finally checked the other tracks in the game and none of the other ones have the issue, so it's just the one from c1a0c that's repeating unnecessarily.

What about opposing force? At the beginning of Worlds Collide and the lift to the final boss, the autosave or load function cuts the music off...I know it's a really minor issue, but I love the in game music, and this sort of thing makes me want to go back to owning the retail. In any case, please don't ignore opposing force's music issue. Thanks for fixing HL looping music btw, just got the update and it seems to work fine.

@mikela-valve I retested c1a0c and the music still continues to play after starting another map using the map command. This also happens with other music, for example starting c0a0 and then changing map.

I think music should be stopped when using the map command. changelevel and changelevel2 should continue to play music. It's not ideal since not all uses are supposed to do that but there is no way to specify whether a changelevel is programmatic or a user command.

As far as music stopping for all other games goes, a better way to detect whether music should be stopped is needed.

Currently this is handled in GameUI, CGameUI::ConnectToServer:

if ( /*CZero career checks*/ )
{
  //Omitted
}
else
{
  if ( strcasecmp(game, "valve") )
    engine->pfnClientCmd("mp3 stop\n");
  baseuifuncs->ActivateGameUI();
}

I think the simplest solution is adding a liblist.gam entry to control this. Other ways are unreliable, for example checking if you're playing a singleplayer game would fix it for all games but would break it for multiplayer. Ideally you could add an interface that lets GameUI query the client dll but that could get complicated.

Feedback from Facepunch user Marphy Black:
There's a lot of redundant reporting in these threads as well as conflicting reports apparently as a result of Alfred making some changes in 2013 (which I don't recall). This is in addition to the misinformaiton by a few people describing incorrect behavior. I'll summarize the intended behavior:

  • Music tracks are typically called by trigger_cdaudio entities. These tracks only play once. They should continue playing uninterrupted through load zones.
  • Music can also be called in the worldspawn. These music tracks start immediately upon map load, loop indefinitely, and continue playing even when entering other maps even where no worldspawn music is defined. This is how the music during the intro tram ride plays through the whole ride (initially starting due to c0a0's worldspawn). The tracks should continue playing uninterrupted through load zones. Tracks called by this method will stop playing when a trigger_cdaudio call interrupts them. This could be with a new track, as in the case of what stops the music that starts playing at the beginning Unforeseen Consequences, or by a null track. In c0a0d, the end of the tram ride, there's a trigger_cdaudio entity (targetname "cd_audio_stop") with health set to "-1" to force the music to end with silence.

The bugs affecting music as of the current Steam build:

  • If the game folder is not "valve", any music track that's playing will cut off at load zones. This is not intended behavior, especially evident in Opposing Force where a few music triggers are intentionally placed right before a map transition.
  • If the game or mod has a looping menu music track set (gamestartup.mp3 present in the resource folder), starting a new game either in singleplayer or multiplayer will sometimes allow the menu music to keep playing in-game where it will continue on a loop. The issue resolves itself if an actual in-game track is triggered or if the player restarts the game (without exiting). In short, starting a new game twice will ensure the problem is circumvented by force.

This report claims there's a problem where music tracks would restart after a map load. I have never experienced this, but the user in question says this occurred on Linux, and it may have been fixed by Alfred in 2013, so I can't confirm anything now. Truthfully, this is a terrible and confusing report that looks to be conflating two issues: music unnecessarily restarting after loads and music not playing through loads. The former no longer seems to be an issue, if it ever was. The latter is the actual problem still at hand.

I also have the same problem (a song triggered before a map-load being cut-off) occur with Windows (7) in Blue-Shift (Steam Version)

In the chapter "Captive Freight" (ba_yard4, ) It happens when I enter the open window of the (Freight Management Offices) before encountering HECU units in a warehouse. The music starts preparing for impending combat, but upon rounding the corner (and loading the next part of the map) the map loads, the music starts playing again for about one second and then abruptly stops.

_(I saw this thread and was suggested by steam support to ask about it on Half Life Github)_

@mikela-valve Can you look into this one?

7 years on... still not fixed...

7 years on... still not fixed...

At least is on a milestone now, Valve has other priorities, it's understandable sadly.

i dont know anything about coding but i would imagine this would be a simple issue to fix, at least considering theyve already fixed it in the base game

Was this page helpful?
0 / 5 - 0 ratings