first loop

This commit is contained in:
Tonton Th 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;
#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;
SF_INFO sfinfo;
int foo, lus;
int foo, lus, pass;
short *buffer;
#if DEBUG_LEVEL
@ -53,12 +53,18 @@ fprintf(stderr, "frames : %ld\n", sfinfo.frames);
fprintf(stderr, "seekable : %d\n", sfinfo.seekable);
#endif
while ((lus = sf_read_short(sndf, buffer, T_BUFF_WAVES))) {
for (pass=0; pass<loop; pass++) {
#if DEBUG_LEVEL
fprintf(stderr, "%s : %d bytes read\n", fname, lus);
sf_seek(sndf, 0, SEEK_SET);
while ((lus = sf_read_short(sndf, buffer, T_BUFF_WAVES))) {
#if DEBUG_LEVEL > 1
fprintf(stderr, "%s : %d bytes read\n", fname, lus);
#endif
ao_play(dev, buffer, lus*2);
ao_play(dev, buffer, lus*2);
}
}
/* do some cleanup */

View File

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