summarylogtreecommitdiffstats
path: root/audiorelay.install
blob: 502260225a15bff90e08b45cead1c2b6d0b07eb5 (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
msg_blue() {
    printf "${blue}==>${bold} $1${all_off}\n"
}
note() {
    printf "${blue}==>${yellow} Note:${bold} $1${all_off}\n"
}

all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

config_path="/etc/pipewire/pipewire.conf.d"
config_name="10-audiorelay.conf"

post_install() {
# https://community.audiorelay.net/t/audio-not-recorded-on-pop-os/1537/2
if test -d "$config_path"; then
    note "Detected Pipewire installation, writing config..."
    msg_blue " Please restart your Pipewire daemon or Re-login."
    msg_blue " (if you don't want this, delete the follow file)"

cat > "$config_path/$config_name" << EOF
context.objects = [
    { factory = adapter
       args = {
           factory.name     = support.null-audio-sink
           node.name        = "audiorelay-virtual-mic-sink"
           node.description = "AudioRelay Mic&Sink"
           media.class      = "Audio/Duplex"
           audio.position   = "FL,FR"
       }
    }
]
context.modules = [
    {   name = libpipewire-module-loopback
        args = {
            audio.position = [ FL FR ]
            capture.props = {
                media.class = Audio/Sink
                node.name = audiorelay_Speaker
                node.description = "AudioRelay Speaker"
                #node.latency = 1024/48000
                #audio.rate = 44100
                #audio.channels = 2
                #audio.position = [ FL FR ]
                #target.object = ""
            }
            playback.props = {
                #media.class = Audio/Source
                node.name = audiorelay_source
                node.description = "Virtual Source"
                #node.latency = 1024/48000
                #audio.rate = 44100
                #audio.channels = 2
                #audio.position = [ FL FR ]
                #target.object = ""
            }
        }
    }
]
EOF

    msg_blue "   -> file://"$config_path/$config_name""
fi
}

post_upgrade() {
    post_install
}

post_remove() {
    rm "$config_path/$config_name"
    msg_blue "Removed "$config_path/$config_name""
}