Recognizes if input is ogg or not.
[xiph.git] / postfish / freeverb.h
blob7eb106c32045d77c3f0e673e4b45e9629f42eb1f
1 /*
3 * postfish
4 *
5 * Copyright (C) 2002-2005 Monty
7 * Postfish is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
12 * Postfish is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Postfish; see the file COPYING. If not, write to the
19 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 typedef struct reverb_settings {
25 sig_atomic_t roomsize; /* 0 - 1000 */
26 sig_atomic_t liveness; /* 0 - 1000 */
27 sig_atomic_t hfdamp; /* 0 - 1000 */
28 sig_atomic_t delay; /* 0 - 1000 */
30 sig_atomic_t wet; /* dB * 10 */
31 sig_atomic_t width; /* 0 - 1000 */
32 sig_atomic_t dry_mix; /* 0, 1 */
34 sig_atomic_t active; /* 0, 1 */
35 sig_atomic_t visible; /* 0, 1 */
36 } reverb_settings;
38 typedef struct allpass{
39 float *buffer;
40 float *bufptr;
41 int size;
42 } allpass_state;
44 typedef struct comb{
45 float filterstore;
46 float *buffer;
47 float *injptr;
48 float *extptr;
49 float *extpending;
50 int size;
51 } comb_state;
53 #define numcombs 8
54 #define numallpasses 4
55 #define scalehfdamp 0.4f
56 #define scaleliveness 0.4f
57 #define offsetliveness 0.58f
58 #define scaleroom 1111
59 #define stereospread 23
60 #define fixedgain 0.015f
62 #define comb0 1116
63 #define comb1 1188
64 #define comb2 1277
65 #define comb3 1356
66 #define comb4 1422
67 #define comb5 1491
68 #define comb6 1557
69 #define comb7 1617
71 #define all0 556
72 #define all1 441
73 #define all2 341
74 #define all3 225
76 /* These values assume 44.1KHz sample rate
77 they will probably be OK for 48KHz sample rate
78 but would need scaling for 96KHz (or other) sample rates.
79 The values were obtained by listening tests. */
81 static const int combL[numcombs]={
82 comb0, comb1, comb2, comb3,
83 comb4, comb5, comb6, comb7
86 static const int combR[numcombs]={
87 comb0+stereospread, comb1+stereospread, comb2+stereospread, comb3+stereospread,
88 comb4+stereospread, comb5+stereospread, comb6+stereospread, comb7+stereospread
91 static const int allL[numallpasses]={
92 all0, all1, all2, all3,
95 static const int allR[numallpasses]={
96 all0+stereospread, all1+stereospread, all2+stereospread, all3+stereospread,
99 /* enough storage for L or R */
100 typedef struct reverb_state {
101 comb_state comb[numcombs];
102 allpass_state allpass[numallpasses];
104 float bufcomb0[comb0+stereospread];
105 float bufcomb1[comb1+stereospread];
106 float bufcomb2[comb2+stereospread];
107 float bufcomb3[comb3+stereospread];
108 float bufcomb4[comb4+stereospread];
109 float bufcomb5[comb5+stereospread];
110 float bufcomb6[comb6+stereospread];
111 float bufcomb7[comb7+stereospread];
113 float bufallpass0[all0+stereospread];
114 float bufallpass1[all1+stereospread];
115 float bufallpass2[all2+stereospread];
116 float bufallpass3[all3+stereospread];
118 int energy;
119 } reverb_state;
121 typedef struct converted_reverb_settings {
122 float feedback;
123 float hfdamp;
124 int inject;
125 float wet;
126 float wet1;
127 float wet2;
128 int width;
129 int active;
130 int delay;
131 } converted_reverb_settings;
133 typedef struct reverb_instance_one{
134 int initstate;
135 float *cache;
136 reverb_state *rL;
137 reverb_state *rR;
138 converted_reverb_settings sC;
139 } reverb_instance_one;
141 typedef struct reverb_instance{
142 int initstate;
143 int ch;
144 float *transwindow;
145 int blocksize; /* can go away after lib conversion */
146 reverb_instance_one *reverbs;
147 } reverb_instance;
149 extern time_linkage *p_reverb_read_master(time_linkage *in);
150 extern time_linkage *p_reverb_read_channel(time_linkage *in,
151 time_linkage **revA,
152 time_linkage **revB);
153 extern void p_reverb_reset(void);
154 extern int p_reverb_load(void);
156 extern reverb_settings *reverb_channelset;
157 extern reverb_settings reverb_masterset;