aboutsummaryrefslogtreecommitdiffstats
path: root/.config/SuperCollider/startup.scd
blob: 14f934d387552283178be4e6f36ca6125374302d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
if(PathName("/dev/fw1").isFile, {
//  if(("which ffado-test").systemCmd == 0, {
//    ~ffadoDevice = ("ffado-test ListDevices |tail -1").unixCmdGetStdOut;
//    ~ffadoDevice.asArray.postln;
//  });
  ~audioInterfaceOptions = Dictionary.with(*[
    \name->'RME Fireface 800',
    \numInputs->28,
    \numOutputs->28,
    \inputs->Dictionary.with(*[
      \adat1->Array.series(8, 12, 1),
      \adat2->Array.series(8, 20, 1),
      \analog->Array.series(10, 0, 1),
      \spdif->Array.series(2, 8, 1)
    ]),
    \outputs->Dictionary.with(*[
      \adat1->Array.series(8, 12, 1),
      \adat2->Array.series(8, 20, 1),
      \analog->Array.series(8, 0, 1),
      \headphones1->Array.series(2, 10, 1),
      \spdif->Array.series(2, 8, 1)
    ])
  ]);
  "SC_JACK_DEFAULT_INPUTS".setenv("firewire_pcm");
  "SC_JACK_DEFAULT_OUTPUTS".setenv("firewire_pcm");
},{
  if(("which aplay > /dev/null").systemCmd == 0, {
    ~alsaDevices = ("aplay -l").unixCmdGetStdOut;
    // case defining name, number of input and output channels and a Dictionary
    // holding Symbols for accessing groups of inputs and outputs by name
    ~audioInterfaceOptions = case
      {
        ~alsaDevices.contains("Babyface")
      }{
        ['RME Babyface', 12, 10]
      }
      {
        ~alsaDevices.contains("XUSB")
      }{
        ['Behringer XUSB', 32, 32]
      }
      {
        ~alsaDevices.contains("Scarlett 18i20")
      }{
        ['Focusrite Scarlett 18i20', 20, 18]
      }
      {
        ~alsaDevices.contains("Fireface UFX ")
      }{
        Dictionary.with(*[
          \name->'RME Fireface UFX',
          \numInputs->22,
          \numOutputs->22,
          \inputs->Dictionary.with(*[
            \adat1->Array.series(8, 14, 1),
            \adat2->Array.series(8, 0, 1),
            \analog->Array.series(12, 0, 1),
            \spdif->Array.series(2, 12, 1)
          ]),
          \outputs->Dictionary.with(*[
            \adat1->Array.series(8, 14, 1),
            \adat2->Array.series(8, 0, 1),
            \analog->Array.series(8, 0, 1),
            \headphones1->Array.series(2, 8, 1),
            \headphones2->Array.series(2, 10, 1),
            \spdif->Array.series(2, 12, 1)
          ])
        ])
      };
  });
});
Server.local.options.numInputBusChannels = ~audioInterfaceOptions.at(\numInputs);
Server.local.options.numOutputBusChannels = ~audioInterfaceOptions.at(\numOutputs);
postln("Loaded settings for: "++~audioInterfaceOptions.at(\name));
postln("Initializing and connecting MIDI devices.");
MIDIClient.init;
MIDIIn.connectAll;

//TODO: load all quarks from ~/git/audio automatically, don't use symlinks