No sound (but with music)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ceferino (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Game runs without sound in Lubuntu (Ubuntu 15.04). In fact, running the game from console reports error in loading audio files.
I downloaded source and attempted to debug. After carefull analysis I surprised to find that the error comes from a 'for' loop located in file "src/audio.cc", function
void audio :: cargar_
(which means "loading sounds")
... at line 144, where it reads
for (i=0; i<12; i++)
For some reason the loop runs over i=11 when it shouldn't up to 12, leading to error later and so program does not use the sounds. Nowhere in the rest of the code the value of i is changed. The problem seems to be with the for loop itself and the way it is compiled. This suggests an error (potentially serious) with the g++ compiler.
I quick way to resolve this problem is to change line 144 to
for (i=0; i<12.0; i++)
... and after compilation, the sound now works.
I used Codeblocks to help compiling and testing.
EDIT:
I found the error in the source code.
In file src/audio.h in line 52,
Mix_Chunk *sonidos[11];
should be changed to
Mix_Chunk *sonidos[12];
Previously, in the for loop I described above the index of sonidos array goes out-of-bounds, though there is no report that this happens when running the program but instead it gives the unexpected behavior.
description: | updated |
description: | updated |
The original author moved the source code from Google Code to GitHub https:/ /github. com/hugoruscitt i/donceferino, this bug is solved there.