<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi<br><br></div>Just wanted to check if there's an official approach to my situation: <br><br>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). <br>
<br></div>I switch from one to other all the time, multiple times per day. I have several issues with that:<br><br></div>- For each sound card I need to boot jack with different settings (basically just different backend ).<br>
</div>- The names for the connections are different, for alsa they appear as 'system_0', etc. for firewire they are 'firewire_pcm'.  <br></div>- Going from one config to the other I need to stop jack and restart it with the new settings.<br>
<br></div>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).<br>
<br>I would like to mimick the OSX behaviour as close as possible. <br><br></div>Currently I have a script at startime that checks for the existence of /dev/fw1 and boots with the right parameters [1]<br><br></div>Also in supercollider I have to run this code [2] at startup to connect to right inputs/outputs. <br>
<br></div>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 ?<br><br></div>Would there be any way to monitor firewire appearing and disappearing and running an appropriate script ?<br>
<div><div><br></div><div>thanks,<br>Miguel Negrão<br></div><div><br><br>[1]<br><br></div><div>The script is written in Haskell:<br><br>#!/usr/bin/env runhaskell<br>{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}<br><br>import Shelly<br>
import Shelly.Background<br>import Prelude hiding (FilePath)<br>import qualified Data.Text.Lazy as T<br>import qualified Data.ByteString.Char8 as B<br>import Control.Concurrent<br>import Data.List (isInfixOf, sort)<br>import Text.Shakespeare.Text (lt)<br>
import Filesystem.Path.CurrentOS hiding (fromText, (<.>))<br>import Text.ShellEscape<br>import System.Environment<br><br>runC x xs = catchany_sh (run x xs) (\_ -> return "x" )<br><br>main = shelly.verbosely $ do<br>
    runC "killall" ["-9", "jackdbus" ]<br>    runC "killall" ["-9", "jackd"]<br>    runC "killall" ["-9", "qjackctl.real"]<br>    fwExists <- test_e "/dev/fw1"<br>
    echo [lt|Firewire detected: #{show fwExists} |]<br>    if fwExists then<br>        do<br>            run "ffado-test" ["BusReset"]<br>            run "sleep" ["5"];<br>            run "sh" ["-c", "qjackctl -s -p firewire" ]<br>
        else<br>            do<br>                run "sleep" ["5"];<br>                run "sh" ["-c", "qjackctl -s -p alsa" ]<br>    exit 0<br></div><div><br>[2]<br><br>
var jack_device = if("jack_lsp | grep firewire".systemCmd == 0){<br>    "firewire_pcm"<br>}{<br>    "system"<br>};<br><br>"SC_JACK_DEFAULT_INPUTS".setenv(jack_device);<br>"SC_JACK_DEFAULT_OUTPUTS".setenv(jack_device);<br>
<br></div></div></div>