Home | Develop | Download | Contact
testprograma2.c
1 /*
2  * testprograma2.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  PdsPlayback *A=NULL;
45  PdsVector *X=NULL;
46 
47  PdsRaNatural N=1024;
48 
49  X=pds_vector_new(N);
50 
51  A=pds_playback_new(&freq,&bits);
52  if(A==NULL)
53  {
54  printf("Error creando PdsPlay\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 
69  for (i = 0; i < 1200; ++i)
70  {
71  fd=fopen("data.dat","r");
72  if(fd==NULL) {printf("Error open\n");return EXIT_FAILURE;}
73 
74  pds_vector_fscanf(X,fd);
75  id=pds_playback_write(A,X);
76  if(id==FALSE) {printf("Error Play\n");return EXIT_FAILURE;}
77 
78  pds_vector_fscanf(X,fd);
79  id=pds_playback_write(A,X);
80  if(id==FALSE) {printf("Error Play\n");return EXIT_FAILURE;}
81 
82  fclose(fd);
83  }
84 
86 
87  exit (0);
88 }
PdsPlayback * pds_playback_new(PdsDaNatural *freq, PdsDaNatural *bits)
Crea una estructura para la reproducción de audio digital.
#define FALSE
Definition: pdsplayback.h:60
unsigned int PdsDaNatural
Definition: pdsdaglobal.h:46
int pds_playback_write(PdsPlayback *A, PdsVector *X)
Escribe los datos de X en el buffer de salida. Los datos estarán comprendidos entre [-1...
void pds_playback_free(PdsPlayback *A)
Libera la estructura para la reproducción de audio digital.
int pds_playback_set_samples_buffer(PdsPlayback *A, PdsDaNatural samples)
Establece la cantidad de muestras en el buffer de salida.
La estructura tipo PdsPlayback . Esta estructura genera una metodo para reproducir audio por la salid...
Definition: pdsplayback.h:71

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed