Package: zsnes Version: 1.510-2 Followup-For: Bug #470410 Hi,
I got same problem. And I have investigated the source code of zsnes. (zsnes-1.510/src/linux/audio.c) First of all, I put "printf" at many places. And I know the important function "SoundWriteSamples_ao" is never called. It seems the execution is stopped at this: pthread_cond_wait(&audio_wait, &audio_mutex); //Wait for signal Normally, the execution will be unblocked when pthread_cond_broadcast(&audio_wait); //Send signal is called in other thread. But it seems doesn't unblock the thread. I found a interested things in the source code. Although audio_wait must be initialized before using it, here is a code for initialization: if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) { puts("pthread_create() failed."); } else if (pthread_mutex_init(&audio_mutex, 0)) { puts("pthread_mutex_init() failed."); } else if (pthread_cond_init(&audio_wait, 0)) { puts("pthread_cond_init() failed."); } Creates a thread, and then initializes the mutex. Hmmm... I think these order are wrong. Before audio_wait has initialized, it may be referred in the thread newly created. I changed the order as follow (initialize the mutex before creating a thread) and zsens sound has works correctly. if (pthread_mutex_init(&audio_mutex, 0)) { puts("pthread_mutex_init() failed."); } else if (pthread_cond_init(&audio_wait, 0)) { puts("pthread_cond_init() failed."); } else if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) { puts("pthread_create() failed."); } I hope this helps, -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core) Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages zsnes depends on: ii libao2 0.8.8-4 Cross Platform Audio Output Librar ii libc6 2.7-10 GNU C Library: Shared libraries ii libgcc1 1:4.3.0-3 GCC support library ii libgl1-mesa-glx [libgl 7.0.3~rc2-2 A free implementation of the OpenG ii libpng12-0 1.2.15~beta5-3 PNG library - runtime ii libsdl1.2debian 1.2.13-2 Simple DirectMedia Layer ii libstdc++6 4.3.0-3 The GNU Standard C++ Library v3 ii zlib1g 1:1.2.3.3.dfsg-11 compression library - runtime zsnes recommends no packages. -- no debconf information
diff -ur zsnes-1.510.orig/src/linux/audio.c zsnes-1.510/src/linux/audio.c --- zsnes-1.510.orig/src/linux/audio.c 2007-01-10 10:19:12.000000000 +0900 +++ zsnes-1.510/src/linux/audio.c 2008-04-08 16:32:57.000000000 +0900 @@ -177,11 +177,7 @@ } else { - if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) - { - puts("pthread_create() failed."); - } - else if (pthread_mutex_init(&audio_mutex, 0)) + if (pthread_mutex_init(&audio_mutex, 0)) { puts("pthread_mutex_init() failed."); } @@ -189,6 +185,10 @@ { puts("pthread_cond_init() failed."); } + else if (pthread_create(&audio_thread, 0, SoundThread_ao, 0)) + { + puts("pthread_create() failed."); + } InitSampleControl(); }