Problems with four JACK playback devices (SOLVED)

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
tmac
Established Member
Posts: 8
Joined: Mon Jun 21, 2010 8:58 pm

Problems with four JACK playback devices (SOLVED)

Post by tmac »

Hi! Anybody able to help me with the following?:

I use Debian Sid with jack2 on a laptop with a NVIDIA hd-audio card. Basically, when I start jack it presents me with four playback devices within the system category in the Connections configuration in qjackctl:

playback_1
playback_2
playback_3
playback_4

Now, when I connect to playback_1 and 2, audio is played through the internal laptop speakers and not through the line out. If I connect to playback_3 and 4, I have the complete opposite.

So what I do is to connect to both the stereo pair 1/2, as well as 3/4. Then it works in all situations.\

However, I want auto-connections to do this for me. When I start some Jack-aware audio program it only automatically connects to playnack_1 and 2, leaving me to connect the two others manually if I'm using my computer speakers through line out...

Any way of having Jack define both stereo pairs (1+2 and 3+4) as default playback devices so that autoconnections appears to both pairs?

In case it is relevant, I include the following info: In order to get the autoswitching between internal and external speakers working on my computer (Asus X5DID), I've included the following line in /etc/modprobe.d/alsa-base.conf:

options snd-hda-intel model=asus

With this choice, the internal speaker is automatically cut off when I plug something into the line out, and vice versa, which is how I want it.

Ideally, I'd want to reduce the four jack playback devices two only one pair, and still have alsa do the auto cut-off of the unwanted playback device (internal speaker vs line out).

The second best solution is configure jack in some way so that autoconnections are made to both pairs of jack playback devices.

Thanks!
Torquil
Last edited by tmac on Sun Aug 22, 2010 10:51 am, edited 1 time in total.
brummer

Re: Problems with four JACK playback devices

Post by brummer »

tmac wrote:Ideally, I'd want to reduce the four jack playback devices two only one pair
you could do that with a ~/.asoundrc , create a master slave plug or a virtual device for your sound-card.
http://alsa.opensrc.org/.asoundrc

greats brummer
tmac
Established Member
Posts: 8
Joined: Mon Jun 21, 2010 8:58 pm

Re: Problems with four JACK playback devices

Post by tmac »

Thanks, but I guess my problem is that I cannot identify these four playback devices (or two stereo) within my ALSA sound system. The output of 'aplay -L' is:

null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=NVidia
HDA NVidia, ALC269 Analog
Default Audio Device
front:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
Front speakers
surround40:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=NVidia,DEV=0
HDA NVidia, ALC269 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=NVidia_1
HDA NVidia, NVIDIA HDMI
HDMI Audio Output

On this list, the only working playback device is "default". I.e., when I use "aplay -D NAME 1.wav", the only values of "NAME" that will not give an error messages are "null" and "default". Otherwise, I get e.g in the case of using the name "front" (or 'front:NVidia'):

tmac@asus ~$ aplay -D front 1.wav
Playing WAVE '1.wav' : Float 32 bit Little Endian, Rate 44100 Hz, Stereo
aplay: set_params:1053: Sample format non available
Available formats:
- S16_LE
- S32_LE

When I use '-D default', I get sound that is automatically routed to the correct speaker when I take the "line out" plug in and out of the socket.

On the other hand, JACK is working with four playback channels that I'm not able to find within ALSA... The output of 'jackd -v dalsa -dhw:0' is:

tmac@asus ~$ /usr/bin/jackd -v -dalsa -dhw:0
jackdmp 1.9.6
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2010 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
Cannot lock down memory area (Cannot allocate memory)
Jack: Create non RT thread
Jack: ThreadHandler: start
Jack: JackSocketServerChannel::Open
Jack: Bind: addr.sun_path /dev/shm/jack_default_1000_0
Jack: JackSocketServerChannel::BuildPoolTable size = 1
Jack: JackEngine::Open
Jack: Connect: addr.sun_path /dev/shm/jack_default_1000_0
Jack: playback device hw:0
Jack: capture device hw:0
Jack: JackDriver::Open capture_driver_name = hw:0
Jack: JackDriver::Open playback_driver_name = hw:0
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.1000_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Jack: JackGraphManager::SetBufferSize size = 1024
Jack: JackConnectionManager::DirectConnect first: ref1 = 0 ref2 = 0
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 0 ref2 = 0
Jack: JackDriver::SetupDriverSync driver sem in flush mode
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
Using ALSA driver HDA-Intel running on card 0 - HDA NVidia at 0xfae78000 irq 23
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
Jack: JackEngine::ClientInternalOpen: name = freewheel
Jack: JackEngine::AllocateRefNum ref = 1
Jack: JackPosixSemaphore::Allocate name = jack_sem.1000_default_freewheel val = 0
Jack: JackEngine::NotifyAddClient: name = freewheel
Jack: JackConnectionManager::DirectConnect first: ref1 = 1 ref2 = 1
Jack: JackGraphManager::ConnectRefNum cur_index = 0 ref1 = 1 ref2 = 1
Jack: JackDriver::SetupDriverSync driver sem in flush mode
Jack: JackGraphManager::SetBufferSize size = 1024
Jack: JackAudioDriver::Attach fBufferSize 1024 fSampleRate 48000
Jack: JackGraphManager::AllocatePortAux port_index = 1 name = system:capture_1 type = 32 bit float mono audio
Jack: JackConnectionManager::AddOutputPort ref = 0 port = 1
Jack: JackAudioDriver::Attach fCapturePortList 1
Jack: JackGraphManager::AllocatePortAux port_index = 2 name = system:capture_2 type = 32 bit float mono audio
Jack: JackConnectionManager::AddOutputPort ref = 0 port = 2
Jack: JackAudioDriver::Attach fCapturePortList 2
Jack: JackGraphManager::AllocatePortAux port_index = 3 name = system:playback_1 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 3
Jack: JackAudioDriver::Attach fPlaybackPortList 3
Jack: JackGraphManager::AllocatePortAux port_index = 4 name = system:playback_2 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 4
Jack: JackAudioDriver::Attach fPlaybackPortList 4
Jack: JackGraphManager::AllocatePortAux port_index = 5 name = system:playback_3 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 5
Jack: JackAudioDriver::Attach fPlaybackPortList 5
Jack: JackGraphManager::AllocatePortAux port_index = 6 name = system:playback_4 type = 32 bit float mono audio
Jack: JackConnectionManager::AddInputPort ref = 0 port = 6
Jack: JackAudioDriver::Attach fPlaybackPortList 6
Jack: Clock source : system clock via clock_gettime
Jack: JackServer::Start
Jack: JackThreadedDriver::Start
Jack: Create non RT thread
Jack: ThreadHandler: start
Jack: JackThreadedDriver::Init IsRealTime
Cannot use real-time scheduling (RR/10)(1: Operation not permitted)
AcquireSelfRealTime error
Jack: Create non RT thread
Jack: ThreadHandler: start
Jack: JackSocketServerChannel::ClientCreate socket
Jack: JackSocketServerChannel::BuildPoolTable size = 2
Jack: fSocketTable i = 1 fd = 7
Jack: fPollTable i = 1 fd = 7
.
.
etc etc

As you can see it adds four "input ports" which are the playback devices. But I'm not sure how to access those through ALSA.

I tried to start jackd using the ALSA device name 'default' (/usr/bin/jackd -v -dalsa -ddefault) but that gave me no Jack input or output ports at all.

I'm sure I'll find out eventually. It will just take some hard work as usual :D
tmac
Established Member
Posts: 8
Joined: Mon Jun 21, 2010 8:58 pm

Re: Problems with four JACK playback devices (SOLVED)

Post by tmac »

Woohoo! It was as easy as specifying the number of channels for jackd. Withint qjackctl I just selected

"Input channels: 2"
"Output channels: 2"

It corresponds to adding the arguments "-i2 -o2" to the jackd command line.

Now I only have playback_1 and playback_2, and the audio is correctly routed when I plug/unplug line out on my computer. :)
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: Problems with four JACK playback devices (SOLVED)

Post by raboof »

cool, thanks for sharing the solution
Post Reply