No production sounds on some maps (8018)

Bug #1592692 reported by toptopple
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
kaputtnik

Bug Description

No production sounds audible on some maps while one others. Conditions yet to be determined; perhaps a fault related to map age and format?

Tested: Build 8018, playing Romans, building = sawmill
Tested maps with sound emerging: Far North
Tested maps without sound emerging: Strands of Malac'Mor, Glacier Lake

Save-games attached.

Tags: sounds

Related branches

Revision history for this message
toptopple (7010622-q-deactivatedaccount) wrote :
GunChleoc (gunchleoc)
Changed in widelands:
milestone: none → build19-rc1
kaputtnik (franku)
Changed in widelands:
status: New → Confirmed
Revision history for this message
kaputtnik (franku) wrote :

I can confirm this with the attached savegames and a new game with map Glacier Lake.

Open Glacier lake in editor and saving at another locations results in the same behavior: No Sound for the sawmill. So i guess its not a fault to map age and format, because all map related things get saved new.

Creating a new map with snow terrains results also in the same: No sound for the sawmill.

Revision history for this message
kaputtnik (franku) wrote :

I assume there is something wrong with the function stereo_position() in sound_handler.cc. It calculates the position of a sound and if it is in the viewport. Under some circumstances it returns -1 (not in viewport) although the sound should be played (f.e. the sawmill is in the viewport)

If you play the map "Glacier lake" as second player, the sawmill sound is played if it is on the right half of the screen.

This would also explain my observation commented in https://bugs.launchpad.net/widelands/+bug/1500531/comments/5

Someone else should look into that further :-)

Revision history for this message
toptopple (7010622-q-deactivatedaccount) wrote :

What is remarkable here is that the error only affects production sounds, other types of sounds like workers and animals so far are not reported to be affected. Either this implies that only production sounds are under the stereo calculation or some more intricate condition is at work!

Revision history for this message
kaputtnik (franku) wrote :

No, that isn't true. F.e. the several sounds of "wood_cutting" are not to hear or the shout from the woodcutter when the tree is just cutted: "timber"

Attached is a savegame for testing. It contains only one tribe so that investigating isn't violated with sounds from an addtional tribe.

Revision history for this message
kaputtnik (franku) wrote :

Seems like the viewport is not correct calculated.

The linked branch has some logoutput.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Be carefull with that savegame only_one_tribe.wgf there is no need to produce planks
unless you increase the value in the ecomonmy...

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Played that only_one_tribe.wgf via ./widelands --xres=800 --xres=600 --fullscreen=false

sounds like the sawing sound _is_ played when the sawmill is in the upper left corner,
but I don here it when it is in the lower right corner. Same applies for woodcutters
"himba". Look like the "Border" is reached when the upper left corner is at (3,2) or such.

Revision history for this message
kaputtnik (franku) wrote :

Assuming:
The viewport is the whole screen, so it should have maximum values of the players display resolution. I think this is used here to pay attention if the game is running in window mode. F.e. 800x600 and the window is positioned in the upper right corner of the display. So a sound source from the left side of the window game is played near the middle of stereo. Is this correct? Is this needed?

Nevertheless the values of viewport are sometimes much greater than the screen resolution, and that's the culprit here. But i couldn't find where the viewport is calculated :-S

Revision history for this message
kaputtnik (franku) wrote :

I was wrong before :-D

The culprit is (was) that the calculation of positions did not care of the wharparound. Adding a call to MapviewPixelFunctions::normalize_pix should do the trick. But i don't understand why the viewpoint must be substracted from the soundposition ...

The code may could be better, but i am not able to do so. I have added some comments and leaved the log output.

Could someone please test the attached branch if this fixes this? And maybe could take a look at the code to make it better (if this solves the bug) :-)

kaputtnik (franku)
Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → kaputtnik (franku)
Revision history for this message
toptopple (7010622-q-deactivatedaccount) wrote :

Looks good with several test games. Changed to "Fixed".

Changed in widelands:
status: In Progress → Fix Committed
Revision history for this message
kaputtnik (franku) wrote :

Thanks :-)

GunChleoc (gunchleoc)
Changed in widelands:
status: Fix Committed → Fix Released
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build19-rc1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.