From dd657c98a038f4929c3dbb761d7a9f28cc8bb373 Mon Sep 17 00:00:00 2001 From: Yukari Hafner Date: Sun, 12 Jan 2025 11:05:43 +0100 Subject: [PATCH] Minor --- src/segments/fft.c | 84 +++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/segments/fft.c b/src/segments/fft.c index 1696d91..bf40a25 100644 --- a/src/segments/fft.c +++ b/src/segments/fft.c @@ -50,48 +50,6 @@ int fft_segment_start(struct mixed_segment *segment){ return 1; } -int fft_segment_set_in(uint32_t field, uint32_t location, void *buffer, struct mixed_segment *segment){ - struct fft_segment_data *data = (struct fft_segment_data *)segment->data; - - switch(field){ - case MIXED_BUFFER: - if(location == 0){ - if(segment->mix == fft_segment_inv && ((struct mixed_buffer *)buffer)->size < data->framesize){ - mixed_err(MIXED_BUFFER_TO_SMALL); - return 0; - } - data->in = (struct mixed_buffer *)buffer; - return 1; - } - mixed_err(MIXED_INVALID_LOCATION); - return 0; - default: - mixed_err(MIXED_INVALID_FIELD); - return 0; - } -} - -int fft_segment_set_out(uint32_t field, uint32_t location, void *buffer, struct mixed_segment *segment){ - struct fft_segment_data *data = (struct fft_segment_data *)segment->data; - - switch(field){ - case MIXED_BUFFER: - if(location == 0){ - if(segment->mix == fft_segment_fwd && ((struct mixed_buffer *)buffer)->size < data->framesize){ - mixed_err(MIXED_BUFFER_TO_SMALL); - return 0; - } - data->out = (struct mixed_buffer *)buffer; - return 1; - } - mixed_err(MIXED_INVALID_LOCATION); - return 0; - default: - mixed_err(MIXED_INVALID_FIELD); - return 0; - } -} - int fft_segment_fwd(struct mixed_segment *segment){ struct fft_segment_data *data = (struct fft_segment_data *)segment->data; uint32_t framesize = data->framesize; @@ -228,6 +186,48 @@ int fft_segment_inv(struct mixed_segment *segment){ return 1; } +int fft_segment_set_in(uint32_t field, uint32_t location, void *buffer, struct mixed_segment *segment){ + struct fft_segment_data *data = (struct fft_segment_data *)segment->data; + + switch(field){ + case MIXED_BUFFER: + if(location == 0){ + if(segment->mix == fft_segment_inv && ((struct mixed_buffer *)buffer)->size < data->framesize){ + mixed_err(MIXED_BUFFER_TO_SMALL); + return 0; + } + data->in = (struct mixed_buffer *)buffer; + return 1; + } + mixed_err(MIXED_INVALID_LOCATION); + return 0; + default: + mixed_err(MIXED_INVALID_FIELD); + return 0; + } +} + +int fft_segment_set_out(uint32_t field, uint32_t location, void *buffer, struct mixed_segment *segment){ + struct fft_segment_data *data = (struct fft_segment_data *)segment->data; + + switch(field){ + case MIXED_BUFFER: + if(location == 0){ + if(segment->mix == fft_segment_fwd && ((struct mixed_buffer *)buffer)->size < data->framesize){ + mixed_err(MIXED_BUFFER_TO_SMALL); + return 0; + } + data->out = (struct mixed_buffer *)buffer; + return 1; + } + mixed_err(MIXED_INVALID_LOCATION); + return 0; + default: + mixed_err(MIXED_INVALID_FIELD); + return 0; + } +} + int fft_segment_info(struct mixed_segment_info *info, struct mixed_segment *segment){ info->name = (segment->mix == fft_segment_fwd)? "fwd_fft" : "inv_fft"; info->description = "Perform a Fast Fourier Transform";