Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
peak_dsp.h
1
// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
2
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
/*
4
* This file incorporates work covered by the following copyright and
5
* permission notice:
6
*
7
* ---
8
*
9
* Copyright (C) 2013 Robin Gareus <robin@gareus.org>
10
*
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 3, or (at your option)
14
* any later version.
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software Foundation,
23
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
*
25
* ---
26
*/
27
28
#ifndef __AUDIO_PEAK_DSP__
29
#define __AUDIO_PEAK_DSP__
30
31
typedef
struct
PeakDsp
32
{
33
float
rms;
// max rms value since last read()
34
float
peak;
// max peak value since last read()
35
int
cnt;
// digital peak hold counter
36
int
fpp;
// frames per period
37
float
fall;
// peak fallback
38
bool
flag;
// flag set by read(), resets _rms
39
40
int
hold;
// peak hold timeoute
41
float
fsamp;
// sample-rate
42
}
PeakDsp
;
43
50
HOT
void
51
peak_dsp_process (
PeakDsp
* self,
float
* p,
int
n);
52
53
float
54
peak_dsp_read_f (
PeakDsp
* self);
55
56
void
57
peak_dsp_read (
PeakDsp
* self,
float
* rms,
float
* peak);
58
59
void
60
peak_dsp_reset (
PeakDsp
* self);
61
65
void
66
peak_dsp_init (
PeakDsp
* self,
float
samplerate);
67
68
MALLOC
69
PeakDsp
*
70
peak_dsp_new (
void
);
71
72
void
73
peak_dsp_free (
PeakDsp
* self);
74
75
#endif
PeakDsp
Definition
peak_dsp.h:32
dsp
peak_dsp.h
Generated by
1.11.0