[Pkg-games-ubuntu] [Bug 1470270] Re: No sound (but with music)

Luis perdigao at virginmedia.com
Wed Jul 1 21:23:34 UTC 2015


** Description changed:

  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 (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];

** Description changed:

  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.

-- 
You received this bug notification because you are a member of
Debian/Ubuntu Games Team, which is subscribed to ceferino in Ubuntu.
https://bugs.launchpad.net/bugs/1470270

Title:
  No sound (but with music)

Status in ceferino package in Ubuntu:
  New

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_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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ceferino/+bug/1470270/+subscriptions



More information about the Pkg-games-ubuntu mailing list