Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 97 lines (82 sloc) 2.904 kb
fd65cee @hzeller o add basic zita filter.
authored
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2006-2011 Fons Adriaensen <fons@linuxaudio.org>
4 //
75867a2 @hzeller o legalese: add COPYING, provide "Appropriate Legal Notices" and
authored
5 // Modifications to work with Folve
6 // Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
7 //
fd65cee @hzeller o add basic zita filter.
authored
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program 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 General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 //
22 // -----------------------------------------------------------------------------
23
24
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <string.h>
23b24f0 @hzeller o Write zita config problems to syslog.
authored
28 #include <syslog.h>
29
fd65cee @hzeller o add basic zita filter.
authored
30 #include "zita-config.h"
31
32
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
33 int convnew (ZitaConfig *cfg, const char *line, int lnum)
fd65cee @hzeller o add basic zita filter.
authored
34 {
35 unsigned int part;
36 float dens;
37 int r;
38
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
39 r = sscanf (line, "%u %u %u %u %f", &cfg->ninp, &cfg->nout,
40 &part, &cfg->size, &dens);
fd65cee @hzeller o add basic zita filter.
authored
41 if (r < 4) return ERR_PARAM;
42 if (r < 5) dens = 0;
43
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
44 if ((cfg->ninp == 0) || (cfg->ninp > Convproc::MAXINP))
fd65cee @hzeller o add basic zita filter.
authored
45 {
23b24f0 @hzeller o Write zita config problems to syslog.
authored
46 syslog(LOG_ERR, "%s:%d: Number of inputs (%d) is out of range.\n",
562b493 @hzeller o Print out config file name while spotting a problem
authored
47 cfg->config_file, lnum, cfg->ninp);
fd65cee @hzeller o add basic zita filter.
authored
48 return ERR_OTHER;
49 }
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
50 if ((cfg->nout == 0) || (cfg->nout > Convproc::MAXOUT))
fd65cee @hzeller o add basic zita filter.
authored
51 {
23b24f0 @hzeller o Write zita config problems to syslog.
authored
52 syslog(LOG_ERR, "%s:%d: Number of outputs (%d) is out of range.\n",
562b493 @hzeller o Print out config file name while spotting a problem
authored
53 cfg->config_file, lnum, cfg->nout);
fd65cee @hzeller o add basic zita filter.
authored
54 return ERR_OTHER;
55 }
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
56 if (cfg->size > MAXSIZE)
fd65cee @hzeller o add basic zita filter.
authored
57 {
23b24f0 @hzeller o Write zita config problems to syslog.
authored
58 syslog(LOG_ERR, "%s:%d: Convolver size (%d) is out of range.\n",
562b493 @hzeller o Print out config file name while spotting a problem
authored
59 cfg->config_file, lnum, cfg->size);
fd65cee @hzeller o add basic zita filter.
authored
60 return ERR_OTHER;
61 }
62 if ((dens < 0.0f) || (dens > 1.0f))
63 {
23b24f0 @hzeller o Write zita config problems to syslog.
authored
64 syslog(LOG_ERR, "%s:%d: Density parameter is out of range.\n",
562b493 @hzeller o Print out config file name while spotting a problem
authored
65 cfg->config_file, lnum);
fd65cee @hzeller o add basic zita filter.
authored
66 return ERR_OTHER;
67 }
68
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
69 cfg->fragm = Convproc::MAXQUANT;
70 while ((cfg->fragm > Convproc::MINPART) && (cfg->fragm >= 2 * cfg->size)) {
71 cfg->fragm /= 2;
72 }
73 cfg->convproc->set_options (cfg->options);
74 cfg->convproc->set_density (dens);
75 if (cfg->convproc->configure (cfg->ninp, cfg->nout, cfg->size,
76 cfg->fragm, cfg->fragm, cfg->fragm))
77 {
23b24f0 @hzeller o Write zita config problems to syslog.
authored
78 syslog(LOG_ERR, "Can't initialise convolution engine\n");
fd65cee @hzeller o add basic zita filter.
authored
79 return ERR_OTHER;
80 }
81
82 return 0;
83 }
84
85
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
86 int inpname (ZitaConfig *, const char *)
fd65cee @hzeller o add basic zita filter.
authored
87 {
88 return 0;
89 }
90
91
0edb358 @hzeller o attempt to remove global references in the zita config.
authored
92 int outname (ZitaConfig *, const char *)
fd65cee @hzeller o add basic zita filter.
authored
93 {
94 return 0;
95 }
96
Something went wrong with that request. Please try again.