Skip to content

HTTPS clone URL

Subversion checkout URL

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