Project

General

Profile

Bug #683571

Client plays wrong music tracks

Added by Jacob Nevins 2 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Client
Target version:
Start date:
Due date:
% Done:

0%


Description

Using S2_6 with mqtx modpack.
  • Menu music and initial peace music played OK.
  • When a war action occurr, music is reset but is still one of the peaceful tracks.
  • When I leave the game a quit to the menu, it starts the music again but still playing one of the peaceful tracks.

I haven't figured out exactly what's going on. I believe the client is requesting the correct tags, but audio.c is picking inappropriate sound files.

0006-Fix-reselecting-the-only-track-matching-the-tag.patch View (1.09 KB) Marko Lindqvist, 2017-07-16 11:58 PM

0006-Fix-track-selection.patch View (1.95 KB) Marko Lindqvist, 2017-07-17 09:21 PM

0003-Fix-track-selection.patch View (1.95 KB) Marko Lindqvist, 2017-07-18 02:27 PM

History

#1 Updated by Jacob Nevins 2 months ago

In my copy of mqtx.musicspec:
  • music_menu = "mqtx/mqtx-freeciv-music_start-menu.ogg"
  • music_victory = "mqtx/mqtx-freeciv-new-game.ogg"
  • music_defeat = "mqtx/mqtx-freeciv-new-game.ogg"
  • music_*_peace_0 = "mqtx/mqtx-freeciv-music_all-game01.ogg"
  • music_*_peace_1 = "mqtx/mqtx-freeciv-music_all-game03.ogg"
  • music_*_combat = "mqtx/mqtx-freeciv-music_all-game02.ogg"

Excerpts from a "-d 4" log:

Start freeciv-gtk2, initial menu music. OK.

4: in real_audio_play_music() [/home/jtn/src/freeciv/git26/client/audio.c::518]: audio_play_music('music_menu', '(null)')
3: in sdl_audio_play() [/home/jtn/src/freeciv/git26/client/audio_sdl.c::108]: Playing file "/home/jtn/.freeciv/2.6/mqtx/mqtx-freeciv-music_start-menu.ogg" on music channel

On starting game. Peaceful music. OK.

4: in real_audio_play_music() [/home/jtn/src/freeciv/git26/client/audio.c::518]: audio_play_music('music_tropical_peace', '(null)')
4: in fc_rand_debug() [/home/jtn/src/freeciv/git26/utility/rand.c::129]: fc_rand(2) = 1 at /home/jtn/src/freeciv/git26/client/audio.c:437
3: in sdl_audio_play() [/home/jtn/src/freeciv/git26/client/audio_sdl.c::108]: Playing file "/home/jtn/.freeciv/2.6/mqtx/mqtx-freeciv-music_all-game03.ogg" on music channel

On declaring war (having signed a ceasefire and then immediately broken it). Tag OK, chosen music is peaceful (wrong).

4: in receive_packet_player_info_100() [/home/jtn/src/freeciv/git26/common/packets_gen.c::8720]:   got field 'mood'
...
4: in real_audio_play_music() [/home/jtn/src/freeciv/git26/client/audio.c::518]: audio_play_music('music_tropical_combat', '(null)')
4: in fc_rand_debug() [/home/jtn/src/freeciv/git26/utility/rand.c::129]: fc_rand(1) = 0 at /home/jtn/src/freeciv/git26/client/audio.c:437
3: in sdl_audio_play() [/home/jtn/src/freeciv/git26/client/audio_sdl.c::108]: Playing file "/home/jtn/.freeciv/2.6/mqtx/mqtx-freeciv-music_all-game01.ogg" on music channel

On leaving the (client-spawned) game. Tag OK, chosen music is peaceful (wrong).

4: in real_audio_play_music() [/home/jtn/src/freeciv/git26/client/audio.c::518]: audio_play_music('music_menu', '(null)')
...
3: in sdl_audio_play() [/home/jtn/src/freeciv/git26/client/audio_sdl.c::108]: Playing file "/home/jtn/.freeciv/2.6/mqtx/mqtx-freeciv-music_all-game03.ogg" on music channel
3: in agents_disconnect() [/home/jtn/src/freeciv/git26/client/agents/agents.c::402]: Playing file "/home/jtn/.freeciv/2.6/mqtx/mqtx-freeciv-music_all-game03.ogg" on music channel
4: in agents_disconnect() [/home/jtn/src/freeciv/git26/client/agents/agents.c::402]: agents_disconnect()

#2 Updated by Jacob Nevins 2 months ago

It would be lovely if the result of fixing this didn't gratuitously restart the music in the case where the musicset doesn't define different peaceful and combat music (etc).

This is fiddly, though, given the way our style system is specified. Probably need to check whether currently playing filename is in the new set of candidates and leave it playing if so. Might be a new ticket.

#3 Updated by Marko Lindqvist 2 months ago

There's at least one bug in how audio_play_tag() /* Cannot exclude the only track */ works. It increases j by one after the loop, but by then files0 has already been overwritten by NULL of the non-existent second track as array index j has been 0 and not 1.

#4 Updated by Marko Lindqvist 2 months ago

Fix for the note #3 problem

#5 Updated by Marko Lindqvist 2 months ago

- Code cleanup
- Also return correct track number when newly selected track has lower number than excluded track

#6 Updated by Marko Lindqvist 2 months ago

- Fix crash

#7 Updated by Marko Lindqvist 2 months ago

The current patch has been pushed. Not closing this ticket as the issue is not likely to be completely fixed yet.

Also available in: Atom PDF