Browse Source

sound is coming

phyto 6 months ago
parent
commit
76bd00d052
2 changed files with 13 additions and 9 deletions
  1. 12
    8
      audio/player.c
  2. 1
    1
      audio/t.c

+ 12
- 8
audio/player.c View File

@@ -74,25 +74,29 @@ fprintf(stderr, "frames     : %ld\n", sfinfo.frames);
74 74
 fprintf(stderr, "seekable   : %d\n", sfinfo.seekable);
75 75
 #endif
76 76
 
77
+foo = init_waveout(sfinfo.samplerate);
78
+if (foo) {
79
+	fprintf(stderr, "init waveout -> %d\n", foo);
80
+	}
81
+
77 82
 while ((lus = sf_read_short(sndf, buffer, T_BUFF_WAVES)))
78 83
         {
79 84
 #if DEBUG_LEVEL      
80 85
 	fprintf(stderr, "%s : %d bytes read\n", fname, lus);
81 86
 #endif
82
-
83
-
87
+        /* send all the bits to the audio output  */
88
+        foo = ao_play(device, (char *)buffer, lus*2);
89
+	if (foo) {
90
+		fprintf(stderr, "ao_play -> %d\n", foo);
91
+		}
84 92
 	}
85 93
 	
86 94
 /* do some cleanup */
95
+close_waveout();
87 96
 sf_close(sndf);
88 97
 
89
-return -1;
98
+return 0;
90 99
 }
91 100
 
92
-
93 101
 /* --------------------------------------------------------------------- */
94
-
95
-
96
-
97
-
98 102
 /* --------------------------------------------------------------------- */

+ 1
- 1
audio/t.c View File

@@ -3,7 +3,7 @@
3 3
  */
4 4
  
5 5
 #include  <stdio.h>
6
-
6
+#include  <stdlib.h>
7 7
 
8 8
 #include  "player.h"
9 9
 

Loading…
Cancel
Save