Audio recording fixes

Fix audio recording to correct 48kHz, don't split files in middle of
the sample.
This commit is contained in:
Pavel Machek
2024-05-04 13:07:25 +02:00
parent f0d8834b4a
commit 00f40b52df

View File

@@ -31,7 +31,7 @@
int main(int argc, char*argv[]) { int main(int argc, char*argv[]) {
int fps = 305; /* fps * 10 */ int fps = 305; /* fps * 10 */
/* 48000 * 2 * 2 bps, we want chunks corresponding to 30 fps */ /* 48000 * 2 * 2 bps, we want chunks corresponding to 30 fps */
const uint32_t bufsize = ((48000 * 2 * 2 * 10) / fps); const uint32_t bufsize = ((48000 * 2 * 2 * 10) / fps) & ~3;
if (argc != 2) { if (argc != 2) {
printf("usage: prog fps*10, run in recording directory\n"); printf("usage: prog fps*10, run in recording directory\n");
@@ -76,7 +76,7 @@ int main(int argc, char*argv[]) {
goto finish; goto finish;
} }
get_name(name, ".", "44800-s16le-stereo.sa"); get_name(name, ".", "48000-s16le-stereo.sa");
fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666); fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
res = write(fd, buf, bufsize); res = write(fd, buf, bufsize);
if (res != bufsize) { if (res != bufsize) {