| 1 |
/* |
| 2 |
* Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2026 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 6 сент. 2019 г. |
| 7 |
* |
| 8 |
* lsp-runtime-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-runtime-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_FMT_ROOMEQWIZARD_H_ |
| 23 |
#define LSP_PLUG_IN_FMT_ROOMEQWIZARD_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/common/types.h> |
| 27 |
#include <lsp-plug.in/common/status.h> |
| 28 |
#include <lsp-plug.in/io/Path.h> |
| 29 |
#include <lsp-plug.in/io/File.h> |
| 30 |
#include <lsp-plug.in/io/IInStream.h> |
| 31 |
|
| 32 |
namespace lsp |
| 33 |
{ |
| 34 |
namespace room_ew |
| 35 |
{ |
| 36 |
enum filter_type_t |
| 37 |
{ |
| 38 |
NONE, |
| 39 |
PK, // peaking (parametric) filter |
| 40 |
MODAL, // Modal filter |
| 41 |
LP, // 12dB/octave Low Pass filter (Q=0.7071) |
| 42 |
HP, // 12dB/octave High Pass filter (Q=0.7071) |
| 43 |
LPQ, // 12dB/octave Low Pass filter with adjustable Q |
| 44 |
HPQ, // 12dB/octave High Pass filter with adjustable Q |
| 45 |
LS, // Low Shelf filter |
| 46 |
LSC, // Low Shelf filter (variation) |
| 47 |
HS, // High Shelf filter |
| 48 |
HSC, // High Shelf filter (variation) |
| 49 |
LS6, // 6dB/octave Low Shelf filter |
| 50 |
HS6, // 6dB/octave High Shelf filter |
| 51 |
LS12, // 12dB/octave Low Shelf filter |
| 52 |
HS12, // 12dB/octave High Shelf filter |
| 53 |
NO, // notch filter |
| 54 |
AP, // allpass filter |
| 55 |
BP, // bandpass filter |
| 56 |
}; |
| 57 |
|
| 58 |
typedef struct filter_t |
| 59 |
{ |
| 60 |
double Q; |
| 61 |
double fc; |
| 62 |
double gain; |
| 63 |
filter_type_t filterType; |
| 64 |
bool enabled; |
| 65 |
|
| 66 |
// Other parameters will be used some times... maybe |
| 67 |
// double A; |
| 68 |
// double a[3]; |
| 69 |
// double aC[3]; |
| 70 |
// double aSum; |
| 71 |
// double alpha; |
| 72 |
// double b[3]; |
| 73 |
// double bC[3]; |
| 74 |
// double bSum; |
| 75 |
// double betasn; |
| 76 |
// int32_t control; |
| 77 |
// double cs; |
| 78 |
// double freqNorm; |
| 79 |
// double omega; |
| 80 |
// float optMaxFreq; |
| 81 |
// float optMinFreq; |
| 82 |
// double p[5]; |
| 83 |
// double sTh[2]; |
| 84 |
// double sampleRate; |
| 85 |
// double sn; |
| 86 |
// double t60Target; |
| 87 |
// int32_t type; |
| 88 |
} filter_t; |
| 89 |
|
| 90 |
typedef struct config_t |
| 91 |
{ |
| 92 |
int32_t nVerMaj; // Major version |
| 93 |
int32_t nVerMin; // Minor version |
| 94 |
const char *sEqType; // Equalizer type |
| 95 |
const char *sNotes; // Notes |
| 96 |
double fPreamp; // Pre-amplification gain in dB |
| 97 |
size_t nFilters; // Number of filters |
| 98 |
filter_t *vFilters; // List of filters |
| 99 |
} config_t; |
| 100 |
|
| 101 |
/** |
| 102 |
* Load configuration file |
| 103 |
* @param path UTF-8 encoded location of the file |
| 104 |
* @param dst pointer to store configuration, |
| 105 |
* configuration should be free()'d after use |
| 106 |
* @return status of operation |
| 107 |
*/ |
| 108 |
status_t load(const char *path, config_t **dst); |
| 109 |
|
| 110 |
/** |
| 111 |
* Load configuration file |
| 112 |
* @param path location of the file |
| 113 |
* @param dst pointer to store configuration, |
| 114 |
* configuration should be free()'d after use |
| 115 |
* @return status of operation |
| 116 |
*/ |
| 117 |
status_t load(const LSPString *path, config_t **dst); |
| 118 |
|
| 119 |
/** |
| 120 |
* Load configuration file |
| 121 |
* @param path location of the file |
| 122 |
* @param dst pointer to store configuration, |
| 123 |
* configuration should be free()'d after use |
| 124 |
* @return status of operation |
| 125 |
*/ |
| 126 |
status_t load(const io::Path *path, config_t **dst); |
| 127 |
|
| 128 |
/** |
| 129 |
* Load configuration from file |
| 130 |
* @param fd file handle |
| 131 |
* @param dst pointer to store configuration, |
| 132 |
* configuration should be free()'d after use |
| 133 |
* @return status of operation |
| 134 |
*/ |
| 135 |
status_t load(FILE *fd, config_t **dst); |
| 136 |
|
| 137 |
/** |
| 138 |
* Load configuration from character input stream |
| 139 |
* @param is input stream pointer |
| 140 |
* @param dst pointer to store configuration, |
| 141 |
* configuration should be free()'d after use |
| 142 |
* @return status of operation |
| 143 |
*/ |
| 144 |
status_t load(io::IInStream *is, config_t **dst); |
| 145 |
|
| 146 |
/** |
| 147 |
* Load configuration from file |
| 148 |
* @param fd input file pointer |
| 149 |
* @param dst pointer to store configuration, |
| 150 |
* configuration should be free()'d after use |
| 151 |
* @return status of operation |
| 152 |
*/ |
| 153 |
status_t load(io::File *fd, config_t **dst); |
| 154 |
|
| 155 |
/** |
| 156 |
* Load configuration from data chunk |
| 157 |
* @param data buffer with data |
| 158 |
* @param size size of buffer |
| 159 |
* @param dst pointer to store configuration, |
| 160 |
* configuration should be free()'d after use |
| 161 |
* @return status of operation |
| 162 |
*/ |
| 163 |
status_t load(const void *data, size_t size, config_t **dst); |
| 164 |
|
| 165 |
} /* namespace room_ew */ |
| 166 |
} /* namespace lsp */ |
| 167 |
|
| 168 |
#endif /* LSP_PLUG_IN_FMT_ROOMEQWIZARD_H_ */ |