annotate libaf/af_dummy.c @ 15140:0b29b871f5b4

credits for Jeff Clagg
author diego
date Wed, 13 Apr 2005 01:56:53 +0000
parents ca769ef8645e
children fd6f824ef894
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));
14816
ca769ef8645e better infoline
alex
parents: 8167
diff changeset
15 af_msg(AF_MSG_VERBOSE,"[dummy] Was reinitialized: %iHz/%ich/%s\n",
ca769ef8645e better infoline
alex
parents: 8167
diff changeset
16 af->data->rate,af->data->nch,af_fmt2str_short(af->data->format));
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
17 return AF_OK;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
18 }
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
19 return AF_UNKNOWN;
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
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
22 // Deallocate memory
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
23 static void uninit(struct af_instance_s* af)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
24 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
25 if(af->data)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
26 free(af->data);
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
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
29 // Filter data through filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
30 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
31 {
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
32 // Do something necessary to get rid of annoying warning during compile
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
33 if(!af)
8167
e8832e66babd New features:
anders
parents: 7615
diff changeset
34 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
35 return data;
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
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
38 // Allocate memory and set function pointers
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
39 static int open(af_instance_t* af){
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
40 af->control=control;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
41 af->uninit=uninit;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
42 af->play=play;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
43 af->mul.d=1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
44 af->mul.n=1;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
45 af->data=malloc(sizeof(af_data_t));
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
46 if(af->data == NULL)
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
47 return AF_ERROR;
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
48 return AF_OK;
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
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
51 // Description of this filter
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
52 af_info_t af_info_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 "dummy",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
55 "Anders",
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
56 "",
7615
c67328dd459a Adding Support for non-reentrant audio filters
anders
parents: 7568
diff changeset
57 AF_FLAGS_REENTRANT,
7568
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
58 open
d08513b9fed6 Adding new audio output filter layer libaf
anders
parents:
diff changeset
59 };