sust: rename buffer
This commit is contained in:
parent
3a4a02a138
commit
52f09d7728
2 changed files with 9 additions and 1 deletions
9
sust.c
9
sust.c
|
@ -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
1
sust.h
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue