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/gtk.h>
16
17#include <kiss_fft.h>
18
19TYPEDEF_STRUCT (Port);
20TYPEDEF_STRUCT (PeakFallSmooth);
21
28#define SPECTRUM_ANALYZER_WIDGET_TYPE (spectrum_analyzer_widget_get_type ())
30 SpectrumAnalyzerWidget,
31 spectrum_analyzer_widget,
32 Z,
33 SPECTRUM_ANALYZER_WIDGET,
34 GtkWidget)
35
36#define SPECTRUM_ANALYZER_MAX_BLOCK_SIZE 32768
37#define SPECTRUM_ANALYZER_MIN_FREQ 20.f
38
39typedef struct _SpectrumAnalyzerWidget
40{
41 GtkWidget parent_instance;
42
44 Port * port;
45
46 float * bufs[2];
47
49 size_t buf_sz[2];
50
51 kiss_fft_cpx * fft_in;
52 kiss_fft_cpx * fft_out;
53
54 kiss_fft_cfg fft_config;
55 int last_block_size;
56
57 PeakFallSmooth ** bins;
58
59} SpectrumAnalyzerWidget;
60
64void
65spectrum_analyzer_widget_setup_engine (SpectrumAnalyzerWidget * self);
66
67SpectrumAnalyzerWidget *
68spectrum_analyzer_widget_new_for_port (Port * port);
69
74#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:139
Custom types.