3 * sushivision copyright (C) 2006-2007 Monty <monty@xiph.org>
5 * sushivision 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, or (at your option)
10 * sushivision 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.
15 * You should have received a copy of the GNU General Public License
16 * along with sushivision; see the file COPYING. If not, write to the
17 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 sv_func_t
*sv_func_new(int number
,
30 void(*callback
)(double *,double *),
35 fprintf(stderr
,"Function number must be >= 0\n");
40 if(number
<_sv_functions
){
41 if(_sv_function_list
[number
]!=NULL
){
42 fprintf(stderr
,"Function number %d already exists\n",number
);
47 if(_sv_functions
== 0){
48 _sv_function_list
= calloc (number
+1,sizeof(*_sv_function_list
));
50 _sv_function_list
= realloc (_sv_function_list
,(number
+1) * sizeof(*_sv_function_list
));
51 memset(_sv_function_list
+ _sv_functions
, 0, sizeof(*_sv_function_list
)*(number
+1 - _sv_functions
));
53 _sv_functions
=number
+1;
56 f
= _sv_function_list
[number
] = calloc(1, sizeof(**_sv_function_list
));
59 f
->callback
= callback
;
60 f
->outputs
= out_vals
;
61 f
->type
= SV_FUNC_BASIC
;