1 | //filter.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - August 2008 |
---|
5 | * |
---|
6 | * This file is part of libroardsp a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * libroardsp is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | #include "libroardsp.h" |
---|
26 | |
---|
27 | int roardsp_filter_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { |
---|
28 | if ( filter == NULL ) |
---|
29 | return -1; |
---|
30 | |
---|
31 | memset(filter, 0, sizeof(struct roardsp_filter)); |
---|
32 | |
---|
33 | filter->channels = stream->info.channels; |
---|
34 | filter->bits = stream->info.bits; |
---|
35 | |
---|
36 | return -1; |
---|
37 | } |
---|
38 | |
---|
39 | int roardsp_filter_uninit(struct roardsp_filter * filter) { |
---|
40 | int ret = 0; |
---|
41 | |
---|
42 | if ( filter == NULL ) |
---|
43 | return -1; |
---|
44 | |
---|
45 | if ( filter->uninit ) |
---|
46 | ret = filter->uninit(filter); |
---|
47 | |
---|
48 | memset(filter, 0, sizeof(struct roardsp_filter)); |
---|
49 | |
---|
50 | return ret; |
---|
51 | } |
---|
52 | |
---|
53 | int roardsp_filter_calc (struct roardsp_filter * filter, void * data, size_t len) { |
---|
54 | int ret = 0; |
---|
55 | |
---|
56 | if ( filter == NULL ) |
---|
57 | return -1; |
---|
58 | |
---|
59 | if ( filter->calc ) |
---|
60 | ret = filter->calc(filter, data, len); |
---|
61 | |
---|
62 | return ret; |
---|
63 | } |
---|
64 | |
---|
65 | //ll |
---|