diff --git a/ao-play-async/ao_playasync.c b/ao-play-async/ao_playasync.c index f44966a..b55e36c 100644 --- a/ao-play-async/ao_playasync.c +++ b/ao-play-async/ao_playasync.c @@ -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; diff --git a/ao-play-async/ao_playasync.h b/ao-play-async/ao_playasync.h index 9b7c051..022fbdd 100644 --- a/ao-play-async/ao_playasync.h +++ b/ao-play-async/ao_playasync.h @@ -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); diff --git a/lib/windows-x86_64/ao-play-async.dll b/lib/windows-x86_64/ao-play-async.dll index 1fccd67..d363e77 100644 Binary files a/lib/windows-x86_64/ao-play-async.dll and b/lib/windows-x86_64/ao-play-async.dll differ diff --git a/lib/windows-x86_64/libao-1.2.2.dll b/lib/windows-x86_64/libao-1.2.2.dll index 841c693..b9b179b 100644 Binary files a/lib/windows-x86_64/libao-1.2.2.dll and b/lib/windows-x86_64/libao-1.2.2.dll differ diff --git a/lib/windows-x86_64/libao-static-1.2.2.lib b/lib/windows-x86_64/libao-static-1.2.2.lib index 113f655..2919992 100644 Binary files a/lib/windows-x86_64/libao-static-1.2.2.lib and b/lib/windows-x86_64/libao-static-1.2.2.lib differ