5 * Copyright (C) 2002-2005 Monty
7 * Postfish is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * Postfish is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Postfish; see the file COPYING. If not, write to the
19 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 void time_linkage_init(time_linkage
*new,int ch
){
34 new->data
=malloc(ch
*sizeof(*new->data
));
37 new->data
[i
]=malloc(input_size
*sizeof(*new->data
));
40 int time_linkage_channels(time_linkage
*in
){
44 int time_linkage_samples(time_linkage
*in
){
48 /* in: pointer to single initialized time_linkage structure
49 out: pointer to array of (in->channels) time_linkage structures */
51 int time_linkage_init_alias_split(time_linkage
*in
,time_linkage
*out
){
60 out
[i
].data
=malloc(sizeof(*out
->data
));
61 out
[i
].data
[0]=in
->data
[i
];
66 /* in: pointer to array of ch initialized time_linkage structs
67 out: pointer to single uninitialized time_linkage struct
68 ch: number of input linkages, number of channels in output linkage */
70 void time_linkage_init_alias_combine(time_linkage
*in
,time_linkage
*out
,int ch
){
77 out
->data
=malloc(ch
*sizeof(*out
->data
));
80 out
->data
[i
]=in
[i
].data
[0];
83 void time_linkage_swap(time_linkage
*a
, time_linkage
*b
){
87 u_int32_t atmp
=a
->active
;
92 a
->channels
=b
->channels
;
95 a
->samples
=b
->samples
;
102 void time_linkage_clear(time_linkage
*in
){
104 for(i
=0;i
<in
->channels
;i
++)
105 memset(in
->data
[i
],0,sizeof(**in
->data
)*input_size
);
110 int time_linkage_copy(time_linkage
*dest
,time_linkage
*src
){
112 if(dest
->channels
!= src
->channels
)return -1;
114 for(i
=0;i
<dest
->channels
;i
++)
115 memcpy(dest
->data
[i
],src
->data
[i
],input_size
*sizeof(**src
->data
));
116 dest
->samples
=src
->samples
;
117 dest
->active
=src
->active
;