Audio problems when I run certain (Java based) programs

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Audio problems when I run certain (Java based) programs

Post by Dennola4 »

Running: Salix 13.1.2 XCFE

Hey guys,

this is a weird problem. I am a Go player, and the clients I use are:

http://files.gokgs.com/javaBin/cgoban-nfa.jnlp
http://www.pandanet.co.jp/java/gGo/down ... 1.0.tar.gz

Sometimes when I run the one of these programs the sound doesn't work. I have obviously checked to make sure the program's sound option hasn't reset to "off" as a default. Anyway, after this happens I find that I also lose sound on my system -- for instance, playing .MP3 or .AVI files -- and I must restart X (ALT+Prnt Scrn+K) to get sound back.

Any ideas what's going on and why?

EDIT: It just happened again. The message from VLC is:
VLC failed to initialize your sound output device (if any).
Please update alsa-lib to version 1.0.23-2-g8d80d5f or higher to try to fix this issue.
:?: :?: :?: :?: :?: :?:
There are no stupid questions.
User avatar
knome
Donor
Posts: 163
Joined: 20. Dec 2012, 19:36
Location: UK

Re: Audio problems when I run certain (Java based) programs

Post by knome »

I'm running 14.0 so my suggestions may not work for you...

When you have no sound, su to root in a Terminal and do

Code: Select all

service list | grep alsa
If alsa is off check whether it's set to run at system start.

Instead of restarting X you can restart alsa (if it's off) with

Code: Select all

service restart alsa
Image
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Audio problems when I run certain (Java based) programs

Post by Dennola4 »

Hey knome,

The tip for how to restart alsa is great.... Googled "How to resart Alsa Slackware" and got this thread, which was interesting but not useful: http://www.linuxquestions.org/questions ... er-617190/

I'll wait until the next instance of this error to try your other suggestion, though in the meantime here is what my /etc/rc.d/rc.alsa looks like (just in case there's something obvious that I'm not seeing):

Code: Select all

#!/bin/sh
# Load the mixer settings and OSS compatibility for ALSA.
# (the Advanced Linux Sound Architecture)

# A function to load the ALSA mixer settings:
load_alsa_mixer() {
  if [ -r /etc/asound.state ]; then
    echo "Loading ALSA mixer settings:  /usr/sbin/alsactl restore"
    /usr/sbin/alsactl restore
  else
    # It's possible a user might not want to set a default sound state.
    # In that case, do this:  touch /etc/no.asound.state
    if [ ! -r /etc/no.asound.state ]; then
      echo "Setting default ALSA mixer settings."
      # set default mixer volumes for ALSA
      # Taken from the alsaconfig script.
      amixer -s -q <<EOF
set Master 75% unmute
set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front 75% unmute
set Front -12dB
set PCM 90% unmute
set PCM 0dB
mixer Synth 90% unmute
mixer Synth 0dB
mixer CD 90% unmute
mixer CD 0dB
# mute mic
set Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
set PCM,1 90% unmute
set PCM,1 0dB
# Trident/YMFPCI/emu10k1
set Wave 100% unmute
set Music 100% unmute
set AC97 100% unmute
# CS4237B chipset:
set 'Master Digital' 75% unmute
# Envy24 chips with analog outs
set DAC 90% unmute
set DAC -12dB
set DAC,0 90% unmute
set DAC,0 -12dB
set DAC,1 90% unmute
set DAC,1 -12dB
# some notebooks use headphone instead of master
set Headphone 75% unmute
set Headphone -12dB
set Playback 100% unmute
# turn off digital switches
set "SB Live Analog/Digital Output Jack" off
set "Audigy Analog/Digital Output Jack" off
EOF
      echo "Storing default ALSA mixer settings:  /usr/sbin/alsactl store"
      /usr/sbin/alsactl store
    fi
  fi
}

# A function to load the ALSA OSS compat modules:
load_alsa_oss_modules() {
  if ! cat /proc/modules | tr _ - | grep -wq snd-pcm-oss ; then
    echo "Loading OSS compatibility modules for ALSA."
    modprobe snd-pcm-oss
    modprobe snd-seq-oss
    modprobe snd-mixer-oss
  fi
}

# If hotplug or something else has loaded the ALSA modules, then
# simply load the mixer settings and make sure the OSS compat
# modules are loaded:
if [ -d /proc/asound ]; then
  load_alsa_oss_modules
  load_alsa_mixer
else
  # If there are ALSA modules defined in /etc/modprobe.conf, but
  # ALSA is not yet loaded, then load the modules now:
  DRIVERS=$(modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | tr -s "[[:blank:]]" " " | cut -d " " -f 3)
  if [ ! "$DRIVERS" = "" ]; then
    echo "Loading ALSA kernel modules."
    for module in $DRIVERS; do
      modprobe $module
    done
  fi
  # If ALSA is now up, then load the mixer settings and OSS modules:
  if [ -d /proc/asound ]; then
    load_alsa_oss_modules
    load_alsa_mixer
  fi
fi
Thanks.
There are no stupid questions.
User avatar
knome
Donor
Posts: 163
Joined: 20. Dec 2012, 19:36
Location: UK

Re: Audio problems when I run certain (Java based) programs

Post by knome »

My rc.alsa has some different filepaths/names but that's probably due to differences between 13.1.2 and 14.0 unless you've updated something and alsa has got left behind. You could try reinstalling alsa.

Here's my rc.alsa but please use it for reference only

Code: Select all

#!/bin/sh
# Load the mixer settings and OSS compatibility for ALSA.
# (the Advanced Linux Sound Architecture)

# A function to load the ALSA mixer settings:
load_alsa_mixer() {
  if [ -r /var/lib/alsa/asound.state ]; then
    echo "Loading ALSA mixer settings:  /usr/sbin/alsactl restore"
    /usr/sbin/alsactl restore
  else
    # It's possible a user might not want to set a default sound state.
    # In that case, do this:  touch /var/lib/alsa/no.asound.state
    if [ ! -r /var/lib/alsa/no.asound.state ]; then
      echo "Setting default ALSA mixer settings."
      # set default mixer volumes for ALSA
      # Taken from the alsaconfig script.
      amixer -s -q <<EOF
set Master 75% unmute
set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front 75% unmute
set Front -12dB
set PCM 90% unmute
set PCM 0dB
mixer Synth 90% unmute
mixer Synth 0dB
mixer CD 90% unmute
mixer CD 0dB
# mute mic
set Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
set PCM,1 90% unmute
set PCM,1 0dB
# Trident/YMFPCI/emu10k1
set Wave 100% unmute
set Music 100% unmute
set AC97 100% unmute
# CS4237B chipset:
set 'Master Digital' 75% unmute
# Envy24 chips with analog outs
set DAC 90% unmute
set DAC -12dB
set DAC,0 90% unmute
set DAC,0 -12dB
set DAC,1 90% unmute
set DAC,1 -12dB
# some notebooks use headphone instead of master
set Headphone 75% unmute
set Headphone -12dB
set Playback 100% unmute
# turn off digital switches
set "SB Live Analog/Digital Output Jack" off
set "Audigy Analog/Digital Output Jack" off
EOF
      echo "Storing default ALSA mixer settings:  /usr/sbin/alsactl store"
      /usr/sbin/alsactl store
    fi
  fi
}

# A function to load the ALSA OSS compat modules:
load_alsa_oss_modules() {
  if modprobe -c | tr _ - | grep -wq snd-pcm-oss ; then
    if ! cat /proc/modules | tr _ - | grep -wq snd-pcm-oss ; then
      echo "Loading OSS compatibility modules for ALSA."
      modprobe snd-pcm-oss
      modprobe snd-seq-oss
      modprobe snd-mixer-oss
    fi
  fi
}

# If hotplug or something else has loaded the ALSA modules, then
# simply load the mixer settings and make sure the OSS compat
# modules are loaded:
if [ -d /proc/asound ]; then
  load_alsa_oss_modules
  load_alsa_mixer
else
  # If there are ALSA modules defined in /etc/modprobe.d/*, but
  # ALSA is not yet loaded, then load the modules now:
  DRIVERS=$(modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | tr -s "[[:blank:]]" " " | cut -d " " -f 3)
  if [ ! "$DRIVERS" = "" ]; then
    echo "Loading ALSA kernel modules."
    for module in $DRIVERS; do
      modprobe $module
    done
  fi
  # If ALSA is now up, then load the mixer settings and OSS modules:
  if [ -d /proc/asound ]; then
    load_alsa_oss_modules
    load_alsa_mixer
  fi
fi
Image
User avatar
Dennola4
Posts: 172
Joined: 7. Sep 2010, 18:25
Location: San Diego, CA, USA

Re: Audio problems when I run certain (Java based) programs

Post by Dennola4 »

The two files are identical.

It happened again, and I used the suggested:

Code: Select all

service restart alsa
Still got the message:
VLC failed to initialize your sound output device (if any).
Please update alsa-lib to version 1.0.23-2-g8d80d5f or higher to try to fix this issue.
I then deleted (read: renamed) /etc/asound.state and ran service restart alsa again, and this time it worked. So I guess I can do that every time it happens, but to mark this "SOLVED" I'd like to actually stop it from happening. I'll wait for responses, and if I don't see anything useful in a few weeks I'll just mark it SOLVED anyway.

:|
There are no stupid questions.
User avatar
knome
Donor
Posts: 163
Joined: 20. Dec 2012, 19:36
Location: UK

Re: Audio problems when I run certain (Java based) programs

Post by knome »

Dennola4 wrote:The two files are identical.
No, they aren't. Look again. Example - you have "/etc/asound.state", I have "/var/lib/alsa/asound.state". I don't know whether that makes any difference.

Have you tried?...
update alsa-lib to version 1.0.23-2-g8d80d5f or higher
Image
djemos
Salix Warrior
Posts: 1465
Joined: 29. Dec 2009, 13:45
Location: Greece

Re: Audio problems when I run certain (Java based) programs

Post by djemos »

Code: Select all

djemos@slackel:~$ ls -l /etc/asound.state 
lrwxrwxrwx 1 root root 28 Σεπ  12 23:42 /etc/asound.state -> ../var/lib/alsa/asound.state
On slackware 14.0 /etc/asound.state is a link point to /var/lib/alsa/asound.state
Post Reply