sust: rename buffer

This commit is contained in:
Michael Sippel 2024-12-13 12:59:33 +01:00
parent 3a4a02a138
commit 52f09d7728
Signed by: senvas
GPG key ID: 060F22F65102F95C
2 changed files with 9 additions and 1 deletions

9
sust.c
View file

@ -11,7 +11,7 @@ void sust_init( struct sust * sust ) {
sust->start_idx = 0;
sust->idx = 0;
sust->buf_len = 12800;
sust->buf_len = 51200;
sust->record_buf = malloc( sizeof(float) * sust->buf_len );
sust->play_buf = malloc( sizeof(float) * sust->buf_len );
}
@ -30,6 +30,13 @@ float softcos( float x ) {
return sin( x * (3.141 / 2.0) );
}
void sust_resize( struct sust * sust, size_t new_len ) {
sust->buf_len = new_len;
sust->play_buf = realloc( sust->play_buf, sizeof(float) * new_len );
sust->record_buf = realloc( sust->record_buf, sizeof(float) * new_len );
sust->idx %= new_len;
}
void sust_swap(
struct sust * sust
) {

1
sust.h
View file

@ -21,6 +21,7 @@ struct sust {
void sust_init( struct sust * sust );
void sust_resize( struct sust * sust, size_t new_len );
void sust_swap( struct sust * sust );
void sust_process(