Home | Develop | Download | Contact
testprograma1.c
1 /*
2  * testprograma1.c
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
29 #include <config.h>
30 #include <stdlib.h>
31 #include <pds/pdsra.h>
32 #include <pds/pdsda.h>
33 
34 int main (int argc, char *argv[])
35 {
36  int i;
37  int id;
38 
39  FILE *fd=NULL;
40 
41  PdsDaNatural freq=8000;
42  PdsDaNatural bits=10;
43 
44  PdsRecord *A=NULL;
45  PdsVector *X=NULL;
46 
47  PdsRaNatural N=1024;
48 
49  X=pds_vector_new(N);
50 
51  A=pds_record_new(&freq,&bits);
52  if(A==NULL)
53  {
54  printf("Error creando PdsRecord\n");
55  return EXIT_FAILURE;
56  }
57 
58  printf("freq:%d\n",freq);
59  printf("bits:%d\n",bits);
60 
62  if(id==FALSE)
63  {
64  printf("Error colocando buffer\n");
65  return EXIT_FAILURE;
66  }
67 
68  fd=fopen("data.dat","w");
69  for (i = 0; i < 2; ++i)
70  {
71  id=pds_record_read(A,X);
72  if(id==FALSE) return EXIT_FAILURE;
73 
74  pds_vector_fprintf(X,fd);
75  }
76  fclose(fd);
77 
78  pds_record_free(A);
79 
80  exit (0);
81 }
82 
int pds_record_read(PdsRecord *A, PdsVector *X)
Lee los datos en el buffer de lectura. Los datos estarán comprendidos entre [-1.0,1.0>.
La estructura tipo PdsRecord . Esta estructura genera una metodo para grabar audio por la entrada de ...
Definition: pdsrecord.h:71
int pds_record_set_samples_buffer(PdsRecord *A, PdsDaNatural samples)
Establece la cantidad de muestras en el buffer de lectura.
#define FALSE
Definition: pdsplayback.h:60
void pds_record_free(PdsRecord *A)
Libera la estructura para la grabación de audio digital.
PdsRecord * pds_record_new(PdsDaNatural *freq, PdsDaNatural *bits)
Crea una estructura para la grabación de audio digital.
unsigned int PdsDaNatural
Definition: pdsdaglobal.h:46

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed