~ubuntu-branches/ubuntu/hoary/tap-plugins/hoary

« back to all changes in this revision

Viewing changes to tap_deesser.c

  • Committer: Bazaar Package Importer
  • Author(s): Anand Kumria
  • Date: 2004-07-19 02:32:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040719023250-hx31ef1lxjj6uns8
Tags: 0.6.0-1
* Many new upstream releases
* Documentation removed, it shall return.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    along with this program; if not, write to the Free Software
16
16
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
17
 
18
 
    $Id: tap_deesser.c,v 1.3 2004/02/04 12:15:53 tszilagyi Exp $
 
18
    $Id: tap_deesser.c,v 1.7 2004/05/01 16:15:06 tszilagyi Exp $
19
19
*/
20
20
 
21
21
 
54
54
#define RINGBUF_SIZE    2000
55
55
 
56
56
 
57
 
#define ABS(x)  (x)>0.0f?(x):-1.0f*(x)
58
 
 
59
57
 
60
58
/* 4 digits precision from 1.000 to 9.999 */
61
59
LADSPA_Data log10_table[9000];
93
91
        int exp = 0;
94
92
        LADSPA_Data mant = ABS(lin);
95
93
 
 
94
        /* sanity checks */
96
95
        if (mant == 0.0f)
97
96
                return(-1.0f/0.0f); /* -inf */
 
97
        if (mant == 1.0f/0.0f) /* +inf */
 
98
                return(mant);
98
99
 
99
100
        while (mant < 1.0f) {
100
101
                mant *= 10;
111
112
 
112
113
 
113
114
 
114
 
 
115
 
/* push a sample into a ringbuffer and return the sample falling out */
116
 
LADSPA_Data
117
 
push_buffer(LADSPA_Data insample, LADSPA_Data * buffer, 
118
 
            unsigned long buflen, unsigned long * pos) {
119
 
        
120
 
        LADSPA_Data outsample;
121
 
 
122
 
        outsample = buffer[*pos];
123
 
        buffer[(*pos)++] = insample;
124
 
 
125
 
        if (*pos >= buflen)
126
 
                *pos = 0;
127
 
        
128
 
        return outsample;
129
 
}
130
 
 
131
 
 
132
 
 
133
115
/* Construct a new plugin instance. */
134
116
LADSPA_Handle 
135
117
instantiate_DeEsser(const LADSPA_Descriptor * Descriptor,
200
182
                break;
201
183
        case ATTENUAT:
202
184
                ptr->attenuat = DataLocation;
203
 
                *(ptr->attenuat) = 0.0f; /* IS THIS LEGAL? */
 
185
                *(ptr->attenuat) = 0.0f;
204
186
                break;
205
187
        case INPUT:
206
188
                ptr->input = DataLocation;
221
203
 
222
204
        LADSPA_Data * input = ptr->input;
223
205
        LADSPA_Data * output = ptr->output;
224
 
        LADSPA_Data threshold = *(ptr->threshold);
225
 
        LADSPA_Data freq = *(ptr->freq);
226
 
        LADSPA_Data sidechain = *(ptr->sidechain);
227
 
        LADSPA_Data monitor = *(ptr->monitor);
 
206
        LADSPA_Data threshold = LIMIT(*(ptr->threshold),-50.0f,10.0f);
 
207
        LADSPA_Data freq = LIMIT(*(ptr->freq),2000.0f,16000.0f);
 
208
        LADSPA_Data sidechain = LIMIT(*(ptr->sidechain),0.0f,1.0f);
 
209
        LADSPA_Data monitor = LIMIT(*(ptr->monitor),0.0f,1.0f);
228
210
        unsigned long sample_index;
229
211
 
230
212
        LADSPA_Data in = 0;
295
277
 
296
278
        LADSPA_Data * input = ptr->input;
297
279
        LADSPA_Data * output = ptr->output;
298
 
        LADSPA_Data threshold = *(ptr->threshold);
299
 
        LADSPA_Data freq = *(ptr->freq);
300
 
        LADSPA_Data sidechain = *(ptr->sidechain);
301
 
        LADSPA_Data monitor = *(ptr->monitor);
 
280
        LADSPA_Data threshold = LIMIT(*(ptr->threshold),-50.0f,10.0f);
 
281
        LADSPA_Data freq = LIMIT(*(ptr->freq),2000.0f,16000.0f);
 
282
        LADSPA_Data sidechain = LIMIT(*(ptr->sidechain),0.0f,1.0f);
 
283
        LADSPA_Data monitor = LIMIT(*(ptr->monitor),0.0f,1.0f);
302
284
        unsigned long sample_index;
303
285
 
304
286
        LADSPA_Data in = 0;
415
397
        mono_descriptor->PortNames = (const char **)port_names;
416
398
        port_names[THRESHOLD] = strdup("Threshold Level [dB]");
417
399
        port_names[FREQ] = strdup("Frequency [Hz]");
418
 
        port_names[SIDECHAIN] = strdup("Sidechain Filter  [0: Highpass  1: Bandpass]");
419
 
        port_names[MONITOR] = strdup("Monitor  [0: Audio  1: Sidechain]");
 
400
        port_names[SIDECHAIN] = strdup("Sidechain Filter");
 
401
        port_names[MONITOR] = strdup("Monitor");
420
402
        port_names[ATTENUAT] = strdup("Attenuation [dB]");
421
403
        port_names[INPUT] = strdup("Input");
422
404
        port_names[OUTPUT] = strdup("Output");