properly fix pinning
This commit is contained in:
parent
07e1fd0aa5
commit
09f76e438b
3 changed files with 44 additions and 47 deletions
BIN
.README.md.kate-swp
Normal file
BIN
.README.md.kate-swp
Normal file
Binary file not shown.
61
README.md
61
README.md
|
|
@ -2,53 +2,42 @@
|
||||||
|
|
||||||
Temporary PipeWire/PulseAudio 5.1 sink helper for testing Arma Reforger surround output on Linux.
|
Temporary PipeWire/PulseAudio 5.1 sink helper for testing Arma Reforger surround output on Linux.
|
||||||
|
|
||||||
The goal is narrow: create a virtual 5.1 output device, make it the launch-time default, then let Arma Reforger decide whether to create a surround stream. Carla, QPWGraph, EQ, convolution, and long-term routing are intentionally manual follow-up steps.
|
It creates a virtual 5.1 output device, makes it the launch-time default, then exposes Reforger back to that device after normal system audio is restored.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- PipeWire with PulseAudio compatibility
|
- PipeWire with PulseAudio compatibility
|
||||||
- `pactl`
|
- `pactl`
|
||||||
- Arma Reforger running through Steam/Proton or another Linux audio path that appears in PipeWire/Pulse
|
- Arma Reforger running through Steam/Proton
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Run directly from the repo:
|
Run from the repo:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./reforger-surround --help
|
./reforger-surround --help
|
||||||
```
|
```
|
||||||
|
|
||||||
Or place it somewhere on your `PATH`:
|
Or install locally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
install -Dm755 reforger-surround ~/.local/bin/reforger-surround
|
install -Dm755 reforger-surround ~/.local/bin/reforger-surround
|
||||||
```
|
```
|
||||||
|
|
||||||
## Basic Test Workflow
|
## Workflow
|
||||||
|
|
||||||
Create the 5.1 sink and make it the temporary default:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
reforger-surround up
|
reforger-surround up
|
||||||
```
|
```
|
||||||
|
|
||||||
Launch Arma Reforger manually while `Reforger Surround 5.1` is the selected/default output device.
|
Launch Arma Reforger while `Reforger Surround 5.1` is the default output.
|
||||||
|
|
||||||
After Arma has created its audio stream, restore your normal default device:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
reforger-surround restore
|
reforger-surround restore
|
||||||
```
|
|
||||||
|
|
||||||
`restore` first pins the running Arma stream to the 5.1 sink, then switches normal system audio back to the previous default device.
|
|
||||||
|
|
||||||
Check whether Arma negotiated surround:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
reforger-surround check
|
reforger-surround check
|
||||||
```
|
```
|
||||||
|
|
||||||
Clean up the temporary sink:
|
If successful, clean up later with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
reforger-surround down
|
reforger-surround down
|
||||||
|
|
@ -57,53 +46,51 @@ reforger-surround down
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
reforger-surround create # create the 5.1 sink without changing defaults
|
reforger-surround create # create the 5.1 sink only
|
||||||
reforger-surround up # create the sink, save current default, make 5.1 default
|
reforger-surround up # create sink, save default, make 5.1 default
|
||||||
reforger-surround pin # move a running Arma/Reforger stream to the 5.1 sink
|
reforger-surround expose # move running Reforger stream to the 5.1 sink
|
||||||
reforger-surround restore # pin Reforger if running, then restore the saved previous default
|
reforger-surround pin # alias for expose
|
||||||
reforger-surround down # restore previous default and unload the 5.1 sink
|
reforger-surround restore # restore previous default, then expose Reforger
|
||||||
reforger-surround status # show sink/default/game stream state
|
reforger-surround down # restore default and unload the 5.1 sink
|
||||||
reforger-surround check # report whether Arma is 2ch or 6ch
|
reforger-surround status # show current state
|
||||||
|
reforger-surround check # report whether Reforger is 2ch or 6ch
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Defaults are intentionally generic:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
REFORGER_SURROUND_SINK_NAME=reforger_surround_51
|
REFORGER_SURROUND_SINK_NAME=reforger_surround_51
|
||||||
REFORGER_SURROUND_DESCRIPTION="Reforger Surround 5.1"
|
REFORGER_SURROUND_DESCRIPTION="Reforger Surround 5.1"
|
||||||
REFORGER_SURROUND_APP_NAME="Arma Reforger"
|
REFORGER_SURROUND_APP_NAME="Arma Reforger"
|
||||||
```
|
```
|
||||||
|
|
||||||
Override them per command if needed:
|
Example override:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
REFORGER_SURROUND_APP_NAME="ArmaReforgerSteam.exe" reforger-surround check
|
REFORGER_SURROUND_APP_NAME="ArmaReforgerSteam.exe" reforger-surround check
|
||||||
```
|
```
|
||||||
|
|
||||||
## Expected Results
|
## Expected Result
|
||||||
|
|
||||||
Good result:
|
Good:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Sample Specification: ... 6ch 48000Hz
|
Sample Specification: ... 6ch 48000Hz
|
||||||
Channel Map: front-left,front-right,front-center,lfe,rear-left,rear-right
|
Channel Map: front-left,front-right,front-center,lfe,rear-left,rear-right
|
||||||
```
|
```
|
||||||
|
|
||||||
Stereo-only result:
|
Bad:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Sample Specification: ... 2ch 48000Hz
|
Sample Specification: ... 2ch 48000Hz
|
||||||
Channel Map: front-left,front-right
|
Channel Map: front-left,front-right
|
||||||
```
|
```
|
||||||
|
|
||||||
If Arma creates a stereo-only stream, restart the game with the 5.1 sink selected/default before launch. Moving an already-created stereo stream usually does not make the game renegotiate surround.
|
If Reforger negotiates stereo, restart the game with the 5.1 sink selected/default before launch.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- `up` temporarily routes normal system audio to the 5.1 sink until `restore` is run.
|
- Prefer `restore` over manually changing your default output device.
|
||||||
- `restore` does not unload the 5.1 sink; it pins Reforger if running, then gives normal system audio back to the previous default.
|
- If you change default output manually, run `reforger-surround expose` afterward.
|
||||||
- If Reforger follows the default sink when the default changes, run `reforger-surround pin` before switching devices manually.
|
- `restore` keeps the 5.1 sink alive; `down` unloads it.
|
||||||
- `down` unloads the temporary sink created by this tool.
|
- LFE may be silent even when Reforger is outputting 6ch.
|
||||||
- LFE may be silent in Arma Reforger even when the stream is 6ch.
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ usage() {
|
||||||
Usage:
|
Usage:
|
||||||
reforger-surround create
|
reforger-surround create
|
||||||
reforger-surround up
|
reforger-surround up
|
||||||
|
reforger-surround expose
|
||||||
reforger-surround pin
|
reforger-surround pin
|
||||||
reforger-surround restore
|
reforger-surround restore
|
||||||
reforger-surround down
|
reforger-surround down
|
||||||
|
|
@ -23,8 +24,9 @@ Usage:
|
||||||
Commands:
|
Commands:
|
||||||
create Create the temporary 5.1 sink without changing the default sink.
|
create Create the temporary 5.1 sink without changing the default sink.
|
||||||
up Create the 5.1 sink, save the current default, and make it default.
|
up Create the 5.1 sink, save the current default, and make it default.
|
||||||
pin Move a running Reforger stream to the 5.1 sink.
|
expose Create the 5.1 sink and move a running Reforger stream into it.
|
||||||
restore Pin Reforger if running, then restore the saved previous default sink.
|
pin Alias for expose.
|
||||||
|
restore Restore the saved previous default sink, then expose Reforger if running.
|
||||||
down Restore the saved previous default sink and unload the 5.1 sink.
|
down Restore the saved previous default sink and unload the 5.1 sink.
|
||||||
status Show default sink, virtual sink state, and detected Reforger stream.
|
status Show default sink, virtual sink state, and detected Reforger stream.
|
||||||
check Report whether a running Reforger stream negotiated stereo or surround.
|
check Report whether a running Reforger stream negotiated stereo or surround.
|
||||||
|
|
@ -139,8 +141,10 @@ Launch Arma Reforger now. After the game has created its audio stream, run:
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
move_app_to_sink() {
|
expose_app() {
|
||||||
local input_id sample_spec
|
local input_id sample_spec sink_after
|
||||||
|
|
||||||
|
create_sink
|
||||||
input_id="$(find_app_sink_input_id || true)"
|
input_id="$(find_app_sink_input_id || true)"
|
||||||
|
|
||||||
if [[ -z "${input_id}" ]]; then
|
if [[ -z "${input_id}" ]]; then
|
||||||
|
|
@ -148,14 +152,15 @@ move_app_to_sink() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create_sink
|
|
||||||
sample_spec="$(app_stream_sample_spec "${input_id}")"
|
sample_spec="$(app_stream_sample_spec "${input_id}")"
|
||||||
pactl move-sink-input "${input_id}" "${sink_name}"
|
pactl move-sink-input "${input_id}" "${sink_name}"
|
||||||
printf 'Pinned %s sink-input #%s to %s\n' "${app_name}" "${input_id}" "${sink_name}"
|
sink_after="$(app_stream_sink_name "${input_id}" || true)"
|
||||||
|
printf 'Exposed %s sink-input #%s to %s\n' "${app_name}" "${input_id}" "${sink_name}"
|
||||||
|
printf 'Current stream sink: %s\n' "${sink_after:-unknown}"
|
||||||
|
|
||||||
case "${sample_spec}" in
|
case "${sample_spec}" in
|
||||||
*" 6ch "*)
|
*" 6ch "*)
|
||||||
printf 'Stream is 6ch; restoring the system default should leave Reforger on the 5.1 sink.\n'
|
printf 'Stream is 6ch; Reforger should now stay on the 5.1 sink.\n'
|
||||||
;;
|
;;
|
||||||
*" 2ch "*)
|
*" 2ch "*)
|
||||||
printf 'Warning: stream is already stereo-only. Pinning will not make Reforger renegotiate surround.\n' >&2
|
printf 'Warning: stream is already stereo-only. Pinning will not make Reforger renegotiate surround.\n' >&2
|
||||||
|
|
@ -171,7 +176,7 @@ pin_app_if_running() {
|
||||||
input_id="$(find_app_sink_input_id || true)"
|
input_id="$(find_app_sink_input_id || true)"
|
||||||
|
|
||||||
if [[ -n "${input_id}" ]]; then
|
if [[ -n "${input_id}" ]]; then
|
||||||
move_app_to_sink
|
expose_app
|
||||||
else
|
else
|
||||||
printf 'No %s stream found to pin; restoring only the system default.\n' "${app_name}"
|
printf 'No %s stream found to pin; restoring only the system default.\n' "${app_name}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -196,8 +201,8 @@ restore_default() {
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_with_pin() {
|
restore_with_pin() {
|
||||||
|
restore_default || true
|
||||||
pin_app_if_running
|
pin_app_if_running
|
||||||
restore_default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unload_sink() {
|
unload_sink() {
|
||||||
|
|
@ -384,10 +389,15 @@ main() {
|
||||||
require_pulse_connection
|
require_pulse_connection
|
||||||
up
|
up
|
||||||
;;
|
;;
|
||||||
|
expose)
|
||||||
|
ensure_dependencies
|
||||||
|
require_pulse_connection
|
||||||
|
expose_app
|
||||||
|
;;
|
||||||
pin)
|
pin)
|
||||||
ensure_dependencies
|
ensure_dependencies
|
||||||
require_pulse_connection
|
require_pulse_connection
|
||||||
move_app_to_sink
|
expose_app
|
||||||
;;
|
;;
|
||||||
restore)
|
restore)
|
||||||
ensure_dependencies
|
ensure_dependencies
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue