annotate libaf/af_dummy.c @ 14300:8f1ab3da482c

missing ;
author faust3
date Sun, 02 Jan 2005 16:01:36 +0000
parents e8832e66babd
children ca769ef8645e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
1 /* The name speaks for itself this filter is a dummy and will not blow
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
2 up regardless of what you do with it. */
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
3 #include <stdio.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
4 #include <stdlib.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
5 #include <string.h>
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
6
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
7 #include "af.h"
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
8
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
9 // Initialization and runtime control
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
10 static int control(struct af_instance_s* af, int cmd, void* arg)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
11 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
12 switch(cmd){
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
13 case AF_CONTROL_REINIT:
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
14 memcpy(af->data,(af_data_t*)arg,sizeof(af_data_t));
8167
e8832e66babd New features:
anders
parents: 7615
diff changeset
15 af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized, rate=%iHz, nch = %i, format = 0x%08X and bps = %i\n",af->data->rate,af->data->nch,af->data->format,af->data->bps);
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
16 return AF_OK;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
17 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
18 return AF_UNKNOWN;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
19 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
20
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
21 // Deallocate memory
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
22 static void uninit(struct af_instance_s* af)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
23 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
24 if(af->data)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
25 free(af->data);
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
26 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
27
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
28 // Filter data through filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
29 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
30 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
31 // Do something necessary to get rid of annoying warning during compile
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
32 if(!af)
8167
e8832e66babd New features:
anders
parents: 7615
diff changeset
33 af_msg(AF_MSG_ERROR,"EEEK: Argument af == NULL in af_dummy.c play().");
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
34 return data;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
35 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
36
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
37 // Allocate memory and set function pointers
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
38 static int open(af_instance_t* af){
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
39 af->control=control;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
40 af->uninit=uninit;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
41 af->play=play;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
42 af->mul.d=1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
43 af->mul.n=1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
44 af->data=malloc(sizeof(af_data_t));
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
45 if(af->data == NULL)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
46 return AF_ERROR;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
47 return AF_OK;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
48 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
49
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
50 // Description of this filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
51 af_info_t af_info_dummy = {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
52 "dummy",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
53 "dummy",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
54 "Anders",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
55 "",
7615
c67328dd459a Adding Support for non-reentrant audio filters
anders
parents: 7568
diff changeset
56 AF_FLAGS_REENTRANT,
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
57 open
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
58 };