diff options
Diffstat (limited to 'doc/examples/SoundRecorder/src/soundbuffers.c')
-rw-r--r-- | doc/examples/SoundRecorder/src/soundbuffers.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/doc/examples/SoundRecorder/src/soundbuffers.c b/doc/examples/SoundRecorder/src/soundbuffers.c deleted file mode 100644 index de021945..00000000 --- a/doc/examples/SoundRecorder/src/soundbuffers.c +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* by Luis Figueiredo (stdio@netc.pt) | ||
2 | * | ||
3 | * file: sound_buffers.c | ||
4 | * | ||
5 | * description: Sounddata procedures | ||
6 | * | ||
7 | * date: 13:23,29-23-2002 | ||
8 | */ | ||
9 | |||
10 | #include "soundbuffers.h" | ||
11 | |||
12 | |||
13 | /* | ||
14 | * init list | ||
15 | */ | ||
16 | struct sound_buf *sbuf_init() { | ||
17 | struct sound_buf *head; | ||
18 | head=malloc(sizeof(struct sound_buf)); | ||
19 | head->next=NULL; | ||
20 | head->data_i=0; | ||
21 | head->data=NULL; | ||
22 | head->id=NULL; | ||
23 | return head; | ||
24 | }; | ||
25 | |||
26 | struct sound_buf *sbuf_select(struct sound_buf *list,char *id) { | ||
27 | struct sound_buf *temp=list; | ||
28 | while(temp->next!=NULL) { | ||
29 | if(temp->next->id!=NULL) { | ||
30 | if(!strcmp(temp->next->id,id)) { | ||
31 | return temp->next; | ||
32 | }; | ||
33 | }; | ||
34 | temp=temp->next; | ||
35 | }; | ||
36 | return NULL; | ||
37 | }; | ||
38 | |||
39 | |||
40 | /* | ||
41 | * next prototipe go to select_buffer | ||
42 | */ | ||
43 | struct sound_buf *sbuf_add(struct sound_buf *list,char *id) { | ||
44 | struct sound_buf *temp=list; | ||
45 | while(temp->next!=NULL) { | ||
46 | if(temp->next->id!=NULL) { | ||
47 | if(!strcmp(temp->next->id,id)) { | ||
48 | return NULL; | ||
49 | }; | ||
50 | temp=temp->next; // Next buffer | ||
51 | }; | ||
52 | }; | ||
53 | // id is new lets create this buffer | ||
54 | temp->next=malloc(sizeof(struct sound_buf)); | ||
55 | // lets copy the new id | ||
56 | temp->next->id=malloc(strlen(id)+1); | ||
57 | strncpy(temp->next->id,id,strlen(id)); | ||
58 | temp->next->id[strlen(id)]=0; | ||
59 | // zero the rest; | ||
60 | temp->next->data=NULL; | ||
61 | temp->next->data_i=0; | ||
62 | temp->next->play_i=0; | ||
63 | temp->next->mode=0; | ||
64 | temp->next->volume=128; | ||
65 | temp->next->next=NULL; | ||
66 | return temp->next; | ||
67 | }; | ||
68 | |||
69 | int sbuf_delete(struct sound_buf *list,char *id) { | ||
70 | struct sound_buf *temp=list; | ||
71 | struct sound_buf *t; | ||
72 | while(temp->next!=NULL) { | ||
73 | if(temp->next->id!=NULL) { | ||
74 | if(!strcmp(temp->next->id,id)) { | ||
75 | t=temp->next; | ||
76 | temp->next=temp->next->next; | ||
77 | free(t->data); | ||
78 | free(t->id); | ||
79 | free(t); | ||
80 | return 1; | ||
81 | }; | ||
82 | }; | ||
83 | temp=temp->next; | ||
84 | }; | ||
85 | return 0; | ||
86 | }; | ||