1 | //filter_speex_prep.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009 |
---|
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 | #ifdef _SPEEX_TYPES_H |
---|
28 | // TODO: check parameters we allready know: |
---|
29 | int roardsp_speex_prep_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { |
---|
30 | struct roardsp_speex_prep * self = roar_mm_malloc(sizeof(struct roardsp_speex_prep)); |
---|
31 | |
---|
32 | if ( self == NULL ) |
---|
33 | return -1; |
---|
34 | |
---|
35 | memset(self, 0, sizeof(struct roardsp_speex_prep)); |
---|
36 | |
---|
37 | return 0; |
---|
38 | } |
---|
39 | |
---|
40 | int roardsp_speex_prep_uninit (struct roardsp_filter * filter) { |
---|
41 | struct roardsp_speex_prep * self = filter->inst; |
---|
42 | |
---|
43 | if ( self->preprocess != NULL ) |
---|
44 | speex_preprocess_state_destroy(self->preprocess); |
---|
45 | |
---|
46 | roar_mm_free(self); |
---|
47 | |
---|
48 | return 0; |
---|
49 | } |
---|
50 | |
---|
51 | int roardsp_speex_prep_ctl (struct roardsp_filter * filter, int cmd, void * data) { |
---|
52 | struct roardsp_speex_prep * self = filter->inst; |
---|
53 | size_t * val; |
---|
54 | |
---|
55 | switch (cmd) { |
---|
56 | case ROARDSP_FCTL_PACKET_SIZE: |
---|
57 | val = data; |
---|
58 | self->frame_size = *val; |
---|
59 | |
---|
60 | self->preprocess = speex_preprocess_state_init(self->frame_size, filter->rate); |
---|
61 | if ( self->preprocess == NULL ) |
---|
62 | return -1; |
---|
63 | |
---|
64 | return 0; |
---|
65 | break; |
---|
66 | } |
---|
67 | |
---|
68 | return -1; |
---|
69 | } |
---|
70 | |
---|
71 | int roardsp_speex_prep_reset (struct roardsp_filter * filter, int what) { |
---|
72 | if ( what == ROARDSP_RESET_NONE ) |
---|
73 | return 0; |
---|
74 | |
---|
75 | return -1; |
---|
76 | } |
---|
77 | #endif |
---|
78 | |
---|
79 | //ll |
---|