first loop

This commit is contained in:
tth 2019-10-23 20:05:23 +02:00
parent ad54bac3f7
commit 759a6450a6
2 changed files with 13 additions and 9 deletions

View File

@ -17,7 +17,7 @@
extern int verbosity; extern int verbosity;
#define T_BUFF_WAVES 16384*2 #define T_BUFF_WAVES (16384*2)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -25,7 +25,7 @@ int blast_this_file(char *fname, ao_device *dev, int loop)
{ {
SNDFILE *sndf; SNDFILE *sndf;
SF_INFO sfinfo; SF_INFO sfinfo;
int foo, lus; int foo, lus, pass;
short *buffer; short *buffer;
#if DEBUG_LEVEL #if DEBUG_LEVEL
@ -53,14 +53,20 @@ fprintf(stderr, "frames : %ld\n", sfinfo.frames);
fprintf(stderr, "seekable : %d\n", sfinfo.seekable); fprintf(stderr, "seekable : %d\n", sfinfo.seekable);
#endif #endif
for (pass=0; pass<loop; pass++) {
sf_seek(sndf, 0, SEEK_SET);
while ((lus = sf_read_short(sndf, buffer, T_BUFF_WAVES))) { while ((lus = sf_read_short(sndf, buffer, T_BUFF_WAVES))) {
#if DEBUG_LEVEL #if DEBUG_LEVEL > 1
fprintf(stderr, "%s : %d bytes read\n", fname, lus); fprintf(stderr, "%s : %d bytes read\n", fname, lus);
#endif #endif
ao_play(dev, buffer, lus*2); ao_play(dev, buffer, lus*2);
} }
}
/* do some cleanup */ /* do some cleanup */
sf_close(sndf); sf_close(sndf);
free(buffer); free(buffer);

View File

@ -44,9 +44,7 @@ fprintf(stderr, "AO init -> %p\n", device);
foo = play_some_stuff(device, 0); foo = play_some_stuff(device, 0);
fprintf(stderr, "play stuff -> %d\n", foo); fprintf(stderr, "play stuff -> %d\n", foo);
sleep(1); foo = blast_this_file("AK14V-ORDRES.wav", device, 3);
foo = blast_this_file("/home/tth/BU/vrac/1337.wav", device, 0);
fprintf(stderr, "blast file -> %d\n", foo); fprintf(stderr, "blast file -> %d\n", foo);
foo = close_ao_output(device); foo = close_ao_output(device);