2015-07-01 21:23:34 |
Luis |
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_sonidos(void)
(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. |
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_sonidos(void)
(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]; |
|
2015-07-01 21:26:18 |
Luis |
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_sonidos(void)
(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]; |
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_sonidos(void)
(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. |
|