Page 1 of 2
Audio output device - controlling Subsonic's selection?

Posted:
Sun Feb 28, 2010 2:34 pm
by tmaddison
Seems like an easy one, but I can't figure it out...
I've got subsonic on a WinXP machine with three audio cards. It's my media center, I use one to output from the DVR software to the TV (via HDMI audio), one to output to an audio distribution system to the whole house, and one to output to the local stereo.
The card used for the local stereo is a plain vanilla Soundblaster Live! card of some sort. It is set in Windows to be the default audio output device for the machine.
When I run subsonic in jukebox mode, the audio comes out of the HDMI audio out, meaning it's going to the TV....
I've tried changing the Win default audio device back and forth to every device in the machine, rebooting, trying again, starting and stopping the service between changes, etc. No change.
Meanwhile, Windows sounds DO come out of the SB card (and therefore out of the stereo) and Win Media Player outputs to it (if I select that device), so I know it's working and is considered the default for the machine....
Now, I've installed and uninstalled Subsonic a few times during this process, one random thought in my mind is that maybe I had HDMI audio set as default on one of those installs and it picked it up....
Regardless, is there some way to force Subsonic to output to a specific device?
I've found one posting on the forum that mentions editing a file that ends in a .sh suffix with a line of code, but I can't find that file on my machine...
Is there a file of settings somewhere where I can force it to use the right device? Also, side question, but in case it's germane, in Windows how does one address the device - by the name shown in the device manager, or is there some enumerator that ID's devices in some other way?

Posted:
Sun Mar 07, 2010 1:34 am
by tmaddison
No one out there has any ideas? Seems like I would not be the only one with more than one audio card in a server and some need to direct subsonic's output to a specific card....?

Posted:
Wed Mar 10, 2010 6:31 am
by tmaddison
Some further troubleshooting...
Tried disabling all sound cards in the machine except the default card - Soundblaster Live. Subsonic then worked, in both local machine playback mode and jukebox mode from a client machine.
If I then enable the HDMI audio, Subsonic stops working in jukebox mode, HOWEVER if I play it back using a browser on the server, it plays back using the local player on the server..
So... somehow it figures out how to send output to the default audio card when it's playing through the web browser on the server machine (Firefox, in case THAT means anything) but in the exact same configuration it uses a different sound card to output to in jukebox mode when being operated via web interface on a client? Hunh?

Posted:
Wed Mar 10, 2010 2:31 pm
by tmaddison
Clarification... when I say enabling the HDMI makes Subsonic "stop working" what I mean is it then switches the output audio to the HDMI output rather than the default audio device on the machine, but ONLY in Jukebox mode.
Playing music using the local player in a web browser on the server machine results in audio output from the default audio device on the server.
Playing music using the local player in a web browser on a client machine results in audio output from the default audio device on the client machine.
Just can't get Subsonic to send audio to the default audio device on the server when I'm trying to use it as a jukebox, which was the entire purpose, of course!

Posted:
Sun Mar 06, 2011 8:50 pm
by maxslug

Posted:
Wed Mar 16, 2011 5:11 am
by tmaddison
Thanks, but unfortunately this doesn't work on my Win box. A whole list of errors.... From the language and references in the posting I assume this is a Linux workaround... Am I missing something or is that just the issue?

Posted:
Thu Mar 17, 2011 11:10 pm
by maxslug
tmaddison wrote:Thanks, but unfortunately this doesn't work on my Win box. A whole list of errors.... From the language and references in the posting I assume this is a Linux workaround... Am I missing something or is that just the issue?
Java is java, the work around should work but you may need to invoke the tools differently.

Posted:
Thu Mar 17, 2011 11:27 pm
by tmaddison
Thanks - I'm certainly NOT a Java guru, but when I create a file called "audioDevList.java" on my Win box with the text you've given and attempt the two command lines shown I get nothing but errors. Output below -
--------------------------------------------------------------------
D:\>dir audio*
Volume in drive D is TMLaptopD
Volume Serial Number is F6B4-D101
Directory of D:\
03/15/2011 10:07 PM 396 audioDevList.java
1 File(s) 396 bytes
0 Dir(s) 65,327,276,032 bytes free
D:\>javac audioDevList.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
D:\>java audioDevList
Exception in thread "main" java.lang.NoClassDefFoundError: audioDevList
Caused by: java.lang.ClassNotFoundException: audioDevList
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: audioDevList. Program will exit.
-------------------------------------------------------------------------
Now... if the point is to find the device's ID in Windows, there IS a "Device Instance ID" in the windows device manager. In this case mine shows
HDAUDIO\FUNC_01&VEN_14F1&DEV_5045&SUBSYS_17AA3C2E&REV_1001\4&12403059&0&0001
and I'm not sure what portion of that (or all) would be the proper section to plug into the Subsonic config, but I'll try it and see if anything works...

Posted:
Thu Mar 17, 2011 11:30 pm
by maxslug
tmaddison wrote:Thanks - I'm certainly NOT a Java guru
me neither

tmaddison wrote:D:\>javac audioDevList.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
Here's your problem. You need the java compiler installed. You can install java in two flavors : run only (JRE) or run+compile (JDK). See
http://www.java.com/en/download/faq/techinfo.xml
You will need to install the JDK (free) to be able to compile a java app.
-m

Posted:
Thu Mar 17, 2011 11:47 pm
by tmaddison
Makes sense. My project for tonight.... Thanks.

Posted:
Fri Mar 18, 2011 2:42 am
by tmaddison
OK, compiling it works, it now reports the audio device list, great.
Unfortunately, however, my Win box does not appear to have any files named subsonic_run.sh
I know the .sh is a linux thing so I did a search on the machine for *subsonic_run*, no luck.
Opened up a bunch of files in the \program files\subsonic directory to see if any of them looked like configuration files and had any entries that looked similar to this, nothing I could see, although I would think subsonic.properties might be a good place for it to go.
Since this IS Windows and the world revolves around the registry, did a search of the registry for subsonic. Found some keys in the section below that seem to relate to devices in Subsonic, but nothing similar to the suggested settings. I suspect a new reg key entry would have to be made but figuring THAT one out is way beyond me...
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\LEGACY_SUBSONIC\0000
... and that's where I dead-end...
Gotta be a way, hopefully this is on some list for future updates. Can't imagine I'm the only guy in the world with more than one sound card on a machine and a need to specify which one for Subsonic to use...!

Posted:
Fri Mar 18, 2011 3:32 am
by GJ51
Go into the services listing for the host computer and highlight Subsonic. Right-click and open the properties dialog. Click on the Log On tab. Change from Local System account to a user account with admin rights.
No guarantees, but it's worth a try.

Posted:
Fri Mar 18, 2011 2:05 pm
by tmaddison
Sorry, I'm missing the point on that one... I have no issue with failure of the Subsonic service to start or run, that's all fine. I'm just looking for a configuration option that will allow me to point Subsonic's output in Jukebox mode to a specific sound card on the machine, rather than using the windows default device or whatever it chooses by whatever means it makes that choice.
Just for the heck of it I tried this and restarted. Subsonic ran fine before the change, then ran fine after the change, no apparent differences there, but the change also did not expose any configuration options to me that were not there before...
What are you getting at here, what do you think the effect of this permissions change should be on the ability to choose a specific sound card?

Posted:
Fri Mar 18, 2011 2:19 pm
by 3R3
from the wiki:
Selecting the Soundcard
From 22763 ...
First you need to find out what your soundcards are named in the sound library used in Java.
Create a file called audioDevList.java and copy this in it :
import java.io.*;
import javax.sound.sampled.*;
public class audioDevList{
public static void main(String args[]){
//Get and display a list of
// available mixers.
Mixer.Info[] mixerInfo =
AudioSystem.getMixerInfo();
System.out.println("Available mixers:");
for(int cnt = 0; cnt < mixerInfo.length;
cnt++){
System.out.println(mixerInfo[cnt].
getName());
}//end for loop
}
}
Now run
javac audioDevList.java
java audioDevList
Here is a sample output
Available mixers:
NVidia [plughw:0,3]
NVidia [plughw:0,7]
NVidia [plughw:0,8]
NVidia [plughw:0,9]
Intel [plughw:1,0]
CX8801 [plughw:2,0]
Port NVidia [hw:0]
Port Intel [hw:1]
Port CX8801 [hw:2]
Next modify your subsonic_run.sh (/usr/bin/subsonic for Ubuntu package install) and add this line. Note the single quotes and the hash mark(#) before the sound card name. Those are required.
'-Djavax.sound.sampled.SourceDataLine=#NVidia [plughw:0,7]' \
Restart subsonic and you're g2g
This works under win and linux. For win, the only thing for you to find out is what file calls java with SS and all its parameters (including the above for sound card selection). This file is under c:\program files\Subsonic\ by default. its called
subsonic-service.exe.vmoptions just add the parameter line from the above wiki excerpt as a new line into this file. restart server and go!

Posted:
Fri Mar 18, 2011 2:24 pm
by bushman4
To send options to the windows service version, modify the following file:
%ProgramFiles%\Subsonic\subsonic-service.exe.vmoptions
And add the "-Djavax.sound.sampled.SourceDataLine=" line. Leave off the single quotes.
That is the "windows equivalent" of subsonic_run.sh.
hth,