[LAU] jack firewire + built in audio

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Wednesday, September 25, 2013 - 4:36 pm

--089e013cbebc72800704e737dac7
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi

Just wanted to check if there's an official approach to my situation:

I have a macbook pro, sometimes I use the built in sound card (jack with
alsa backend) and sometimes I use a MOTU soundcard (jack with firewire
backend from ffado).

I switch from one to other all the time, multiple times per day. I have
several issues with that:

- For each sound card I need to boot jack with different settings
(basically just different backend ).
- The names for the connections are different, for alsa they appear as
'system_0', etc. for firewire they are 'firewire_pcm'.
- Going from one config to the other I need to stop jack and restart it
with the new settings.

In OSX to switch from one sound card to another, it's as simple as removing
the firewire cable and sound will migrate to the internal sound card,
plugging it back again migrates again to firewire ( I had firewire as
default).

I would like to mimick the OSX behaviour as close as possible.

Currently I have a script at startime that checks for the existence of
/dev/fw1 and boots with the right parameters [1]

Also in supercollider I have to run this code [2] at startup to connect to
right inputs/outputs.

I was just wondering if there is a simpler solution to this, or if there is
some plan to make it easier to switch soundcard with jack in the future ?

Would there be any way to monitor firewire appearing and disappearing and
running an appropriate script ?

thanks,
Miguel Negr=E3o

[1]

The script is written in Haskell:

#!/usr/bin/env runhaskell
{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}

import Shelly
import Shelly.Background
import Prelude hiding (FilePath)
import qualified Data.Text.Lazy as T
import qualified Data.ByteString.Char8 as B
import Control.Concurrent
import Data.List (isInfixOf, sort)
import Text.Shakespeare.Text (lt)
import Filesystem.Path.CurrentOS hiding (fromText, (<.>))
import Text.ShellEscape
import System.Environment

runC x xs =3D catchany_sh (run x xs) (\_ -> return "x" )

main =3D shelly.verbosely $ do
runC "killall" ["-9", "jackdbus" ]
runC "killall" ["-9", "jackd"]
runC "killall" ["-9", "qjackctl.real"]
fwExists <- test_e "/dev/fw1"
echo [lt|Firewire detected: #{show fwExists} |]
if fwExists then
do
run "ffado-test" ["BusReset"]
run "sleep" ["5"];
run "sh" ["-c", "qjackctl -s -p firewire" ]
else
do
run "sleep" ["5"];
run "sh" ["-c", "qjackctl -s -p alsa" ]
exit 0

[2]

var jack_device =3D if("jack_lsp | grep firewire".systemCmd =3D=3D 0){
"firewire_pcm"
}{
"system"
};

"SC_JACK_DEFAULT_INPUTS".setenv(jack_device);
"SC_JACK_DEFAULT_OUTPUTS".setenv(jack_device);

--089e013cbebc72800704e737dac7
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

HiJust wanted to check if there's an official approach to my situ=
ation: I have a macbook pro, sometimes I use the built in sound car=
d (jack with alsa backend) and sometimes I use a MOTU soundcard (jack with =
firewire backend from ffado).
I switch from one to other all the time, multiple times per day. =
I have several issues with that:- For each sound card I need =
to boot jack with different settings (basically just different backend ).
- The names for the connections are different, for alsa they appear a=
s 'system_0', etc. for firewire they are 'firewire_pcm'.=A0=
- Going from one config to the other I need to stop jack and res=
tart it with the new settings.
In OSX to switch from one sound card to another, it's as simp=
le as removing the firewire cable and sound will migrate to the internal so=
und card, plugging it back again migrates again to firewire ( I had firewir=
e as default).
I would like to mimick the OSX behaviour as close as possible. =
Currently I have a script at startime that checks for the existence o=
f /dev/fw1 and boots with the right parameters [1]Also in sup=
ercollider I have to run this code [2] at startup to connect to right input=
s/outputs.
I was just wondering if there is a simpler solution to this, or i=
f there is some plan to make it easier to switch soundcard with jack in the=
future ?Would there be any way to monitor firewire appearing=
and disappearing and running an appropriate script ?
thanks,Miguel Negr=E3o[=
1]The script is written in Haskell:#!/usr/bin/en=
v runhaskell{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}impo=
rt Shelly
import Shelly.Backgroundimport Prelude hiding (FilePath)import qual=
ified Data.Text.Lazy as Timport qualified Data.ByteString.Char8 as Bimport Control.Concurrentimport Data.List (isInfixOf, sort)import =
Text.Shakespeare.Text (lt)
import Filesystem.Path.CurrentOS hiding (fromText, (<.>))import T=
ext.ShellEscapeimport System.EnvironmentrunC x xs =3D catchany_=
sh (run x xs) (\_ -> return "x" )main =3D shelly.verbo=
sely $ do
=A0=A0=A0 runC "killall" ["-9", "jackdbus" ]<=
br>=A0=A0=A0 runC "killall" ["-9", "jackd"]=A0=A0=A0 runC "killall" ["-9", "qjackctl.real&q=
uot;]=A0=A0=A0 fwExists <- test_e "/dev/fw1"
=A0=A0=A0 echo [lt|Firewire detected: #{show fwExists} |]=A0=A0=A0 if f=
wExists then=A0=A0=A0=A0=A0=A0=A0 do=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 run "ffado-test" ["BusReset"]=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 run "sleep" ["5"];=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 run "sh" ["-c", "qjackctl -s -p=
firewire" ]
=A0=A0=A0=A0=A0=A0=A0 else=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 do=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 run "sleep" ["5&q=
uot;];=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 run "sh" =
["-c", "qjackctl -s -p alsa" ]=A0=A0=A0 exit 0<=
/div>[2]
var jack_device =3D if("jack_lsp | grep firewire".systemCmd =3D=
=3D 0){=A0=A0=A0 "firewire_pcm"}{=A0=A0=A0 "syst=
em"};"SC_JACK_DEFAULT_INPUTS".setenv(jack_device=
);"SC_JACK_DEFAULT_OUTPUTS".setenv(jack_device);

--089e013cbebc72800704e737dac7--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] jack firewire + built in audio, Miguel Negrao, (Wed Sep 25, 4:36 pm)
Re: [LAU] jack firewire + built in audio, Paul Davis, (Wed Sep 25, 5:04 pm)
Re: [LAU] jack firewire + built in audio, Jeremy Jongepier, (Wed Sep 25, 9:54 pm)