diff options
| author | XANTRONIX Development | 2023-07-22 16:09:39 -0400 | 
|---|---|---|
| committer | XANTRONIX Development | 2023-07-22 16:09:39 -0400 | 
| commit | ac7cc9194cdf85b676aea03a8998fa95d629115e (patch) | |
| tree | 0780e3ccec09cdf35b3f8326a1e1b6216fc9eb69 /include/xas | |
| parent | 00d5cfc107dfadf6a3476e5e8679e1067e800cee (diff) | |
| download | xas-ac7cc9194cdf85b676aea03a8998fa95d629115e.tar.gz xas-ac7cc9194cdf85b676aea03a8998fa95d629115e.tar.bz2 xas-ac7cc9194cdf85b676aea03a8998fa95d629115e.zip | |
Begin SOLA refactorsola
Diffstat (limited to 'include/xas')
| -rw-r--r-- | include/xas/audio.h | 2 | ||||
| -rw-r--r-- | include/xas/bank.h | 34 | 
2 files changed, 33 insertions, 3 deletions
| diff --git a/include/xas/audio.h b/include/xas/audio.h index 76d38ce..4989333 100644 --- a/include/xas/audio.h +++ b/include/xas/audio.h @@ -73,6 +73,8 @@ void xas_audio_apply_gain(xas_audio_format format,                              size_t index,                              size_t count); +void *xas_audio_buffer_alloc(xas_audio_format format, size_t buffer_size); +  xas_audio_stream *xas_audio_stream_new_sink(xas_audio_drain drain,                                                  xas_audio_cleanup cleanup,                                                  xas_audio_format format, diff --git a/include/xas/bank.h b/include/xas/bank.h index 3ff5994..92074f6 100644 --- a/include/xas/bank.h +++ b/include/xas/bank.h @@ -9,8 +9,22 @@  #define XAS_BANK_PLAYER_DEFAULT_GAIN 1.0f -#define XAS_BANK_PLAYER_NONE 0 -#define XAS_BANK_PLAYER_LOOP (1 << 0) +#define XAS_BANK_PLAYER_DURATION_MAX 10.0f + +#define XAS_BANK_PLAYER_NONE         0 +#define XAS_BANK_PLAYER_LOOP        (1 << 0) +#define XAS_BANK_PLAYER_SCALE_TIME  (1 << 1) +#define XAS_BANK_PLAYER_SCALE_PITCH (1 << 2) + +#define XAS_BANK_PLAYER_SOLA_SEQUENCE 100 +#define XAS_BANK_PLAYER_SOLA_OVERLAP   20 +#define XAS_BANK_PLAYER_SOLA_WINDOW    15 + +#define XAS_BANK_PLAYER_SOLA_FLAT_DURATION \ +    (XAS_BANK_PLAYER_SOLA_SEQUENCE - 2 * (XAS_BANK_PLAYER_SOLA_OVERLAP)) + +#define XAS_BANK_PLAYER_SOLA_SEQUENCE_SKIP(scale) \ +    ((XAS_BANK_PLAYER_SOLA_SEQUENCE - XAS_BANK_PLAYER_SOLA_OVERLAP) * scale)  enum xas_bank_player_status {     XAS_BANK_PLAYER_STOPPED, @@ -35,10 +49,20 @@ typedef struct _xas_bank_player {      enum xas_bank_player_status status;      int flags; -    float gain; +    float gain, +          duration, +          pitch;      size_t entry,             index; + +    void *buffer; +    size_t buffer_size; + +    size_t sola_sequence, +           sola_overlap, +           sola_window, +           sola_flat;  } xas_bank_player;  xas_bank *xas_bank_new(xas_audio_format format, @@ -66,6 +90,10 @@ void xas_bank_player_destroy(xas_bank_player *player);  void xas_bank_player_set_gain(xas_bank_player *player, float gain); +void xas_bank_player_set_duration(xas_bank_player *player, float factor); + +void xas_bank_player_set_pitch(xas_bank_player *player, float factor); +  int xas_bank_player_set_entry(xas_bank_player *player, size_t entry);  int xas_bank_player_start(xas_bank_player *player); | 
 
    