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; |
---|
31 | |
---|
32 | if ( filter->channels != 1 ) |
---|
33 | return -1; |
---|
34 | |
---|
35 | if ( filter->bits != 16 ) |
---|
36 | return -1; |
---|
37 | |
---|
38 | self = roar_mm_malloc(sizeof(struct roardsp_speex_prep)); |
---|
39 | |
---|
40 | if ( self == NULL ) |
---|
41 | return -1; |
---|
42 | |
---|
43 | memset(self, 0, sizeof(struct roardsp_speex_prep)); |
---|
44 | |
---|
45 | return 0; |
---|
46 | } |
---|
47 | |
---|
48 | int roardsp_speex_prep_uninit (struct roardsp_filter * filter) { |
---|
49 | struct roardsp_speex_prep * self = filter->inst; |
---|
50 | |
---|
51 | if ( self->preprocess != NULL ) |
---|
52 | speex_preprocess_state_destroy(self->preprocess); |
---|
53 | |
---|
54 | roar_mm_free(self); |
---|
55 | |
---|
56 | return 0; |
---|
57 | } |
---|
58 | |
---|
59 | int roardsp_speex_prep_calc161(struct roardsp_filter * filter, void * data, size_t samples) { |
---|
60 | return -1; |
---|
61 | } |
---|
62 | |
---|
63 | int roardsp_speex_prep_ctl (struct roardsp_filter * filter, int cmd, void * data) { |
---|
64 | struct roardsp_speex_prep * self = filter->inst; |
---|
65 | size_t * val; |
---|
66 | |
---|
67 | switch (cmd) { |
---|
68 | case ROARDSP_FCTL_PACKET_SIZE: |
---|
69 | val = data; |
---|
70 | self->frame_size = *val; |
---|
71 | |
---|
72 | self->preprocess = speex_preprocess_state_init(self->frame_size, filter->rate); |
---|
73 | if ( self->preprocess == NULL ) |
---|
74 | return -1; |
---|
75 | |
---|
76 | return 0; |
---|
77 | break; |
---|
78 | } |
---|
79 | |
---|
80 | return -1; |
---|
81 | } |
---|
82 | |
---|
83 | int roardsp_speex_prep_reset (struct roardsp_filter * filter, int what) { |
---|
84 | if ( what == ROARDSP_RESET_NONE ) |
---|
85 | return 0; |
---|
86 | |
---|
87 | return -1; |
---|
88 | } |
---|
89 | #endif |
---|
90 | |
---|
91 | //ll |
---|