forked from adafruit/circuitpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilter.h
More file actions
50 lines (38 loc) · 1.28 KB
/
Copy pathFilter.h
File metadata and controls
50 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT
#pragma once
#include "py/obj.h"
#include "shared-bindings/synthio/Biquad.h"
#include "shared-module/audiocore/__init__.h"
#include "shared-module/synthio/__init__.h"
#include "shared-module/synthio/block.h"
#include "shared-module/synthio/Biquad.h"
extern const mp_obj_type_t audiofilters_filter_type;
typedef struct {
audiosample_base_t base;
mp_obj_t filter;
synthio_block_slot_t mix;
mp_obj_t *filter_objs;
size_t filter_objs_len;
biquad_filter_state *filter_states;
int8_t *buffer[2];
uint8_t last_buf_idx;
uint32_t buffer_len; // max buffer in bytes
uint8_t *sample_remaining_buffer;
uint32_t sample_buffer_length;
int32_t *filter_buffer;
bool loop;
bool more_data;
mp_obj_t sample;
} audiofilters_filter_obj_t;
void audiofilters_filter_reset_buffer(audiofilters_filter_obj_t *self,
bool single_channel_output,
uint8_t channel);
audioio_get_buffer_result_t audiofilters_filter_get_buffer(audiofilters_filter_obj_t *self,
bool single_channel_output,
uint8_t channel,
uint8_t **buffer,
uint32_t *buffer_length); // length in bytes