forked from adafruit/circuitpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBiquad.h
More file actions
29 lines (22 loc) · 838 Bytes
/
Biquad.h
File metadata and controls
29 lines (22 loc) · 838 Bytes
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
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2023 Jeff Epler for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#pragma once
#include "shared-bindings/synthio/Biquad.h"
#include "shared-module/synthio/block.h"
#define BIQUAD_SHIFT (15)
typedef struct synthio_biquad {
mp_obj_base_t base;
synthio_filter_mode mode;
synthio_block_slot_t f0, Q, A;
mp_float_t cached_W0, cached_Q, cached_A;
int32_t a1, a2, b0, b1, b2;
} synthio_biquad_t;
typedef struct {
int32_t x[2], y[2];
} biquad_filter_state;
void common_hal_synthio_biquad_tick(mp_obj_t self_in);
void synthio_biquad_filter_reset(biquad_filter_state *st);
void synthio_biquad_filter_samples(mp_obj_t self_in, biquad_filter_state *st, int32_t *buffer, size_t n_samples);