diff options
-rw-r--r-- | include/xas/drone.h | 5 | ||||
-rw-r--r-- | src/drone.c | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/xas/drone.h b/include/xas/drone.h index 70eacfb..f134cdc 100644 --- a/include/xas/drone.h +++ b/include/xas/drone.h @@ -57,6 +57,11 @@ void xas_drone_destroy(xas_drone *drone); xas_spatial_object *xas_drone_get_spatial_object(xas_drone *drone); +ssize_t xas_drone_record_sample(xas_drone *drone, + xas_audio_stream *source, + size_t sample_index, + size_t sample_len); + int xas_drone_speech_import(xas_drone *drone, const char *voice, float speed, diff --git a/src/drone.c b/src/drone.c index 1534e76..e7f5bfe 100644 --- a/src/drone.c +++ b/src/drone.c @@ -51,6 +51,28 @@ xas_spatial_object *xas_drone_get_spatial_object(xas_drone *drone) { return drone->obj; } +ssize_t xas_drone_record_sample(xas_drone *drone, + xas_audio_stream *source, + size_t sample_index, + size_t sample_len) { + if (sample_index >= drone->bank->entry_count + || sample_len > drone->bank->entry_size) { + errno = EINVAL; + + goto error_invalid; + } + + return xas_bank_record(drone->bank, + source, + sample_index, + sample_len); + + return 0; + +error_invalid: + return -1; +} + int xas_drone_speech_import(xas_drone *drone, const char *voice, float speed, |