jack_get_sample_rate returns incorrect/unwanted sample rate
- PipeWire version (
pipewire --version
): 0.3.56 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): Arch Linux - Desktop Environment: KDE
- Kernel version (
uname -r
): 5.19
Description of Problem:
When using jack_get_sample_rate, it returns 48000 despite many attempts at setting the samplerate to 44100, including using pw-metadata -n settings 0 clock.force-rate 44100
Some additional notes: I found this while trying to get WineASIO working with a Windows program that will not boot (on Windows) if the sound device is not set to 44100hz sampling rate. WineASIO reports the sample rate value from jack_get_sample_rate, which makes that program not boot.
How Reproducible:
Tiny awful test program:
#include <jack/jack.h>
#include <jack/thread.h>
#include <stdio.h>
int main()
{
jack_status_t jack_status;
jack_options_t jack_options = JackNoStartServer;
jack_client_t *jack_client;
double sample_rate;
jack_client = jack_client_open("asdf", jack_options, &jack_status);
sample_rate = jack_get_sample_rate(jack_client);
printf("%f\n",sample_rate);
printf("%s\n", jack_get_ports(jack_client,NULL,NULL,JackPortIsPhysical | JackPortIsOutput)[0]);
getchar();
jack_client_close(jack_client);
return 0;
}
Steps to Reproduce:
- Compile program with
cc -ljack [file]
- Run a.out, it reports sample rate of 48000
- Run
pw-metadata -n settings 0 clock.force-rate 44100
- Run a.out again, sample rate is still 48000.
Actual Results:
❯ ./a.out
48000.000000
M Series Pro:capture_AUX0
❯ pw-metadata -n settings 0 clock.force-rate 44100
Found "settings" metadata 30
set property: id:0 key:clock.force-rate value:44100 type:(null)
❯ ./a.out
48000.000000
M Series Pro:capture_AUX0
Expected Results:
jack_get_sample_rate reports the default sample rate of the graph as described in the documentation.
Additional Info (as attachments):
-
pw-dump > pw-dump.log
:pw-dump.log