# Possible SDL\_dibaudio.c bug

**URL:** <https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621>\
**Category:** SDL Development\
**Created:** [January 24, 2000, 11:54am UTC](https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621 "2000-01-24T11:54:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus\_F.X.J\_Oberhum](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@Markus\_F.X.J\_Oberhum](https://discourse.libsdl.org/u/Markus_F.X.J_Oberhum)\
**Post date:** [January 24, 2000, 11:54am UTC](https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621/1 "2000-01-24T11:54:26Z")

</div>

I’ve experienced some strange problems with my pysol-sound-server  
when running on a NT4 Server (in a Linux vmware box).

After walking through the source I’ve found the following very  
suspicous code fragment - please have a look at this (completely  
untested) patch.

— SDL-1.0.2/src/audio/win32/SDL\_dibaudio.c Tue Jan 4 06:12:05 2000  
+++ SDL-1.0.2/src/audio/win32/SDL\_dibaudio.c.fixed Mon Jan 24 12:43:38 2000  
@@ -112,7 +112,7 @@  
return;

```
    /* Increment which buffer is currently playing */

```

- 

```
  SDL_mutexV(var_lock);

```

- 

```
  SDL_mutexP(var_lock);
  --SHARED_buffers_queued;

```

#ifdef SOUND\_DEBUG  
fprintf(stderr, “Finished playing buffer %d\n”, SHARED\_playing);

BTW, will there be a bug fix release 1.0.3 in the near future ?

Markus

---- Markus F.X.J. Oberhumer \<@Markus\_F.X.J\_Oberhum\> ----  
---- [http://wildsau.idv.uni-linz.ac.at/mfx/](http://wildsau.idv.uni-linz.ac.at/mfx/) ----  
---- 5E CB 5C 85 DE AF 9E BF E9 DA 7E 6A 39 F8 CC 67 ----

```
                         3 WARPS TO URANUS
```

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [January 24, 2000, 4:30pm UTC](https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621/2 "2000-01-24T16:30:53Z")

</div>

> I’ve experienced some strange problems with my pysol-sound-server  
> when running on a NT4 Server (in a Linux vmware box).

Sound tends to be a little interesting on vmware. 🙂

> After walking through the source I’ve found the following very  
> suspicous code fragment - please have a look at this (completely  
> untested) patch.

Thanks! I didn’t actually write this code. Your fix will be in the  
1.0.3 release of SDL which should be in a few days.

> — SDL-1.0.2/src/audio/win32/SDL\_dibaudio.c Tue Jan 4 06:12:05 2000  
> +++ SDL-1.0.2/src/audio/win32/SDL\_dibaudio.c.fixed Mon Jan 24 12:43:38 2000  
> @@ -112,7 +112,7 @@  
> return;
> 
> ```
> /* Increment which buffer is currently playing */
> 
> ```
> 
> - 
> 
> ```
> SDL_mutexV(var_lock);
> 
> ```
> 
> - 
> 
> ```
> SDL_mutexP(var_lock);
> --SHARED_buffers_queued;
> 
> ```
> 
> #ifdef SOUND\_DEBUG  
> fprintf(stderr, “Finished playing buffer %d\n”, SHARED\_playing);

```
-Sam Lantinga (slouken at devolution.com)

```

Lead Programmer, Loki Entertainment Software–  
“Any sufficiently advanced bug is indistinguishable from a feature”  
– Rich Kulawiec

---

<div class="post-metadata">

**Author:** ![Markus\_F.X.J\_Oberhum](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@Markus\_F.X.J\_Oberhum](https://discourse.libsdl.org/u/Markus_F.X.J_Oberhum)\
**Post date:** [January 24, 2000, 5:45pm UTC](https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621/3 "2000-01-24T17:45:11Z")

</div>

Actually it’s not too bad.

The problem I’m currently hunting down seems to be triggered  
by playing looped samples that are shorter than the audio  
buffer size. They stop after the third loop or so.

As the background MOD music keeps playing perfectly clean and  
this doesn’t happen under Win98 and Linux I suspect  
some SDL related problem/bug.

Well, this is just a wild guess - maybe someone with a native NT  
around could check.

Markus

---- Markus F.X.J. Oberhumer \<@Markus\_F.X.J\_Oberhum\> ----  
---- [http://wildsau.idv.uni-linz.ac.at/mfx/](http://wildsau.idv.uni-linz.ac.at/mfx/) ----  
---- 5E CB 5C 85 DE AF 9E BF E9 DA 7E 6A 39 F8 CC 67 ----

```
                         3 WARPS TO URANUSOn 24-Jan-2000 Sam Lantinga wrote:

```

> > I’ve experienced some strange problems with my pysol-sound-server  
> > when running on a NT4 Server (in a Linux vmware box).
> 
> Sound tends to be a little interesting on vmware. 🙂

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [January 24, 2000, 5:46pm UTC](https://discourse.libsdl.org/t/possible-sdl-dibaudio-c-bug/1621/4 "2000-01-24T17:46:33Z")

</div>

> Actually it’s not too bad.

> The problem I’m currently hunting down seems to be triggered  
> by playing looped samples that are shorter than the audio  
> buffer size. They stop after the third loop or so.

> As the background MOD music keeps playing perfectly clean and  
> this doesn’t happen under Win98 and Linux I suspect  
> some SDL related problem/bug.

> Well, this is just a wild guess - maybe someone with a native NT  
> around could check.

Can you post a link to a complete small code-sample that we can use  
to test?

```
-Sam Lantinga (slouken at devolution.com)

```

Lead Programmer, Loki Entertainment Software–  
“Any sufficiently advanced bug is indistinguishable from a feature”  
– Rich Kulawiec
