Browse Source

jackaudio server

master
parent
commit
8dc6d7533b
7 changed files with 106 additions and 0 deletions
  1. +9
    -0
      defaults/main.yaml
  2. +10
    -0
      handlers/main.yaml
  3. +34
    -0
      tasks/main.yaml
  4. +16
    -0
      templates/asound.conf.j2
  5. +11
    -0
      templates/jack.conf.j2
  6. +23
    -0
      templates/jack.service.j2
  7. +3
    -0
      vars/main.yaml

+ 9
- 0
defaults/main.yaml View File

@@ -0,0 +1,9 @@
---
jackaudio_default_server: default
jackaudio_driver: dummy
jackaudio_device: ''
jackaudio_realtime: true
jackaudio_additional_options: ''
jackaudio_driver_settings: |
-r{{jackaudio_sample_rate}}
jackaudio_sample_rate: 48000

+ 10
- 0
handlers/main.yaml View File

@@ -0,0 +1,10 @@
---

- name: systemd daemon-reload
systemd:
daemon_reload: yes

- name: restart jackaudio
systemd:
name: jack.service
state: restarted

+ 34
- 0
tasks/main.yaml View File

@@ -0,0 +1,34 @@
---

- name: jackaudio group
user:
name: jack
system: true

- name: jackaudio user
user:
name: jack
group: jack
groups:
- audio
system: true

- name: jackaudio systemd service unit
template:
src: jack.service.j2
dest: /etc/systemd/system/
notify:
- systemd daemon-reload
- restart jackaudio

- name: jackaudio config
template:
src: jack.conf.j2
dest: /etc/jack.conf
notify: restart jackaudio

- name: make sure jackaudio is enabled and started
systemd:
name: jack.service
state: started
enabled: true

+ 16
- 0
templates/asound.conf.j2 View File

@@ -0,0 +1,16 @@
{{ansible_managed|comment}}

pcm.rawjack {
type jack
playback_ports {
0 system:playback_1
}
}

pcm.jack {
type plug
slave { pcm "rawjack" }
hint {
description "JACK Audio Connection Kit"
}
}

+ 11
- 0
templates/jack.conf.j2 View File

@@ -0,0 +1,11 @@
{{ansible_managed|comment}}

JACK_USER="jack"
JACK_GROUP="jack"

# Options to JACK (e.g. -m, -n, -p, -r, -P, -t, -C, -u, -v)
JACK_OPTIONS="{{jackaudio_options|replace('\n',' ')|trim}}"
# Audio backend (e.g. alsa, dummy, firewire, netone, oss, portaudio)
DRIVER="{{jackaudio_driver}}"
# Specific settings for the audio backend in use
DRIVER_SETTINGS="{{jackaudio_driver_settings|replace('\n',' ')|trim}}"

+ 23
- 0
templates/jack.service.j2 View File

@@ -0,0 +1,23 @@
{{ansible_managed|comment}}

[Unit]
Description=JACK server
Documentation=man:jackd(1)
After=sound.target

[Service]
EnvironmentFile=/etc/jack.conf
ExecStart=jackd $JACK_OPTIONS -d $DRIVER $DRIVER_SETTINGS
LimitRTPRIO=95
LimitRTTIME=infinity
LimitMEMLOCK=infinity
# Caution: use on memory-limited devices only
# OOMScoreAdjust=-1000
#Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
User=jack
Group=jack
Environment="JACK_PROMISCUOUS_SERVER=jack"
UMask=0

[Install]
WantedBy=multi-user.target

+ 3
- 0
vars/main.yaml View File

@@ -0,0 +1,3 @@
jackaudio_options: |
-{{ jackaudio_realtime | ternary('R','r') }}
{{jackaudio_additional_options}}

Loading…
Cancel
Save