|
From: | Volker Rümelin |
Subject: | Re: [PATCH 10/11] alsaaudio: change default playback settings |
Date: | Mon, 26 Dec 2022 16:37:27 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 |
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 5f50dfa0bf..0cc982e61f 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -913,17 +913,14 @@ static void *alsa_audio_init(Audiodev *dev) alsa_init_per_direction(aopts->in); alsa_init_per_direction(aopts->out); - /* - * need to define them, as otherwise alsa produces no sound- * doesn't set has_* so alsa_open can identify it wasn't set by the user- */+ /* don't set has_* so alsa_open can identify it wasn't set by the user */if (!dev->u.alsa.out->has_period_length) { - /* 1024 frames assuming 44100Hz */ - dev->u.alsa.out->period_length = 1024 * 1000000 / 44100; + /* 256 frames assuming 44100Hz */ + dev->u.alsa.out->period_length = 5805; } if (!dev->u.alsa.out->has_buffer_length) { /* 4096 frames assuming 44100Hz */ - dev->u.alsa.out->buffer_length = 4096ll * 1000000 / 44100; + dev->u.alsa.out->buffer_length = 92880;Not a big fan of magic numbers, as it makes code less readable.I can't see how this can be improved. The buffer length is unchanged. I just evaluated the constant expression to have a time in microseconds like the rest of the audio backends. And libasound tells me to use 5804us for the period length which I rounded up to 5805us. I would prefer a period length of 5000us../qemu-system-x86_64 -device ich9-intel-hda -device hda-duplex,audiodev=audio0 -audiodev alsa,id=audio0,out.period-length=5000,out.dev=PCH,,0alsa: Requested period time 5000 was rejected, using 5804
The correct command line is:./qemu-system-x86_64 -device ich9-intel-hda -device hda-duplex,audiodev=audio0 -audiodev alsa,id=audio0,out.period-length=5000,out.dev=hw:PCH,,0
alsa: Requested period time 5000 was rejected, using 5804
} /*
[Prev in Thread] | Current Thread | [Next in Thread] |