1 /*
2  * Copyright (C) 2004 2007, Magnus Hjorth
3  *
4  * This file is part of mhWaveEdit.
5  *
6  * mhWaveEdit is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * mhWaveEdit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mhWaveEdit; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 
22 #ifndef LADSPACORE_H_INCLUDED
23 #define LADSPACORE_H_INCLUDED
24 
25 #if defined(HAVE_SYS_LADSPA_H)
26 #include <ladspa.h>
27 #else
28 #include "../ext/ladspa.h"
29 #endif
30 #include "chunk.h"
31 
32 typedef struct {
33      gchar *name;
34      unsigned long number;
35      LADSPA_PortRangeHint prh;
36 
37      /* This data should be set before running ladspa_run_effect */
38 
39      /* For audio ports only, which channel to map to.
40       * Audio input - Which channel of input sound to send here or -1 for
41       *               sending a constant value (specified in value).
42       * Audio output - Which channel of output sound to put this in or
43       *                -1 to ignore. */
44      int map;
45 
46      /* For output control ports - set after running.
47       * For input control ports - value to set.
48       * For output audio ports - ignored
49       * For input audio ports - if map == -1, constant to emit */
50      float value;
51 
52      /* Data used by ladspa_run_effect */
53 
54      float *buffer;
55 
56 } LadspaPort;
57 
58 typedef struct {
59      gchar *id,*name,*filename;
60      guint effect_number;
61      gchar *maker,*copyright;
62      /* 0 = control input, 1 = control output,
63       * 2 = audio input, 3 = audio output */
64      int numports[4];
65      LadspaPort *ports[4];
66 
67      gboolean keep;
68 } LadspaEffect;
69 
70 void ladspa_rescan(void);
71 LadspaEffect *ladspa_find_effect(gchar *id);
72 void ladspa_foreach_effect(void (*func)(LadspaEffect *eff));
73 /* Note: The parameters to this effect are arranged so this function can be
74  * used as a callback for mainwindow_effect_manual */
75 Chunk *ladspa_run_effect(Chunk *chunk, StatusBar *bar, LadspaEffect *f,
76 			 int dither_mode);
77 
78 #endif
79