# Add a specific named PipeWire pcm

defaults.pipewire.server "pipewire-0"
defaults.pipewire.node "-1"
defaults.pipewire.exclusive false
defaults.pipewire.role ""
defaults.pipewire.rate 0
defaults.pipewire.format ""
defaults.pipewire.channels 0
defaults.pipewire.period_bytes 0
defaults.pipewire.buffer_bytes 0

pcm.pipewire {
	@args [ SERVER NODE EXCLUSIVE ROLE RATE FORMAT CHANNELS PERIOD_BYTES BUFFER_BYTES ]
	@args.SERVER {
		type string
		default {
			@func refer
			name defaults.pipewire.server
		}
	}
	@args.NODE {
		type string
		default {
			@func refer
			name defaults.pipewire.node
		}
	}
	@args.EXCLUSIVE {
		type integer
		default {
			@func refer
			name defaults.pipewire.exclusive
		}
	}
	@args.ROLE {
		type string
		default {
			@func refer
			name defaults.pipewire.role
		}
	}
	@args.RATE {
		type integer
		default {
			@func refer
			name defaults.pipewire.rate
		}
	}
	@args.FORMAT {
		type string
		default {
			@func refer
			name defaults.pipewire.format
		}
	}
	@args.CHANNELS {
		type integer
		default {
			@func refer
			name defaults.pipewire.channels
		}
	}
	@args.PERIOD_BYTES {
		type integer
		default {
			@func refer
			name defaults.pipewire.period_bytes
		}
	}
	@args.BUFFER_BYTES {
		type integer
		default {
			@func refer
			name defaults.pipewire.buffer_bytes
		}
	}

	type pipewire
	server $SERVER
	playback_node $NODE
	capture_node $NODE
	exclusive $EXCLUSIVE
	role $ROLE
	rate $RATE
	format $FORMAT
	channels $CHANNELS
	period_bytes $PERIOD_BYTES
	buffer_bytes $BUFFER_BYTES
	hint {
		show on
		description "PipeWire Sound Server"
	}
}

ctl.pipewire {
        @args.SERVER {
                type string
                default {
                        @func refer
                        name defaults.pipewire.server
                }
        }
        type pipewire
        server $SERVER
}
