Trying to overcome gapless problems with mpg123 + output to WAV
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef struct {
|
||||
} BufferInfo_t;
|
||||
|
||||
AOPLAYASYNC_EXPORT int ao_async_version(void);
|
||||
AOPLAYASYNC_EXPORT void *ao_create_async(int bits, int rate, int channels, int byte_format);
|
||||
AOPLAYASYNC_EXPORT void *ao_create_async(int bits, int rate, int channels, int byte_format, const char *wav_file_output);
|
||||
AOPLAYASYNC_EXPORT void ao_stop_async(void *handle);
|
||||
AOPLAYASYNC_EXPORT void ao_play_async(void *handle, int music_id, double at_second, double music_duration, int buf_size, void *mem, BufferInfo_t info);
|
||||
AOPLAYASYNC_EXPORT void ao_clear_async(void *handle);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user