Trying to overcome gapless problems with mpg123 + output to WAV

This commit is contained in:
2026-04-23 11:03:02 +02:00
parent ee7e62890f
commit 348b1d6411
5 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -351,7 +351,7 @@ static void init_ao()
}
}
void *ao_create_async(int bits, int rate, int channels, int byte_format)
void *ao_create_async(int bits, int rate, int channels, int byte_format, const char *wav_file_output)
{
init_ao();
@@ -364,7 +364,14 @@ void *ao_create_async(int bits, int rate, int channels, int byte_format)
fmt.channels = channels;
fmt.matrix = NULL;
ao_device *dev = ao_open_live(ao_default_driver_id(), &fmt, NULL);
ao_device *dev;
if (wav_file_output != NULL) {
int driver_id = ao_driver_id("wav");
dev = ao_open_file(driver_id, wav_file_output, 1, &fmt, NULL);
} else {
dev = ao_open_live(ao_default_driver_id(), &fmt, NULL);
}
if (dev == NULL) {
fprintf(stderr, "Cannot open ao-device, error code = %d\n", errno);
return NULL;