jack firewire + built in audio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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ão


[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 = catchany_sh (run x xs) (\_ -> return "x" )

main = 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 = if("jack_lsp | grep firewire".systemCmd == 0){
    "firewire_pcm"
}{
    "system"
};

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

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux