Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
spectrum_analyzer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __GUI_WIDGETS_SPECTRUM_ANALYZER_H__
11#define __GUI_WIDGETS_SPECTRUM_ANALYZER_H__
12
13#include "utils/types.h"
14
15#include "gtk_wrapper.h"
16#include <kiss_fft.h>
17
18TYPEDEF_STRUCT (Port);
19TYPEDEF_STRUCT (PeakFallSmooth);
20
27#define SPECTRUM_ANALYZER_WIDGET_TYPE (spectrum_analyzer_widget_get_type ())
29 SpectrumAnalyzerWidget,
30 spectrum_analyzer_widget,
31 Z,
32 SPECTRUM_ANALYZER_WIDGET,
33 GtkWidget)
34
35#define SPECTRUM_ANALYZER_MAX_BLOCK_SIZE 32768
36#define SPECTRUM_ANALYZER_MIN_FREQ 20.f
37
38typedef struct _SpectrumAnalyzerWidget
39{
40 GtkWidget parent_instance;
41
43 Port * port;
44
45 float * bufs[2];
46
48 size_t buf_sz[2];
49
50 kiss_fft_cpx * fft_in;
51 kiss_fft_cpx * fft_out;
52
53 kiss_fft_cfg fft_config;
54 int last_block_size;
55
56 PeakFallSmooth ** bins;
57
58} SpectrumAnalyzerWidget;
59
63void
64spectrum_analyzer_widget_setup_engine (SpectrumAnalyzerWidget * self);
65
66SpectrumAnalyzerWidget *
67spectrum_analyzer_widget_new_for_port (Port * port);
68
73#endif
G_DECLARE_FINAL_TYPE(SpectrumAnalyzerWidget, spectrum_analyzer_widget, Z, SPECTRUM_ANALYZER_WIDGET, GtkWidget) typedef struct _SpectrumAnalyzerWidget
void spectrum_analyzer_widget_setup_engine(SpectrumAnalyzerWidget *self)
Creates a spectrum analyzer for the AudioEngine.
Must ONLY be created via port_new()
Definition port.h:136
Custom types.