I am looking to develop an audio player that repetitively plays audio files. I
am using the sox library. I have tried the following code snippet but it only
plays the audio file once and doesn't play it next time.
int main(int argc, char *argv[])
{ if (argc != 4) { printf ("Incorrect Arguments\n"); exit (-1); } int i,
sox_status, status; /* Sox File Descriptor */ sox_format_t *sox_fd1,
*sox_fd2; size_t sox_size = 1, sox_tsize = 0; sox_sample_t sox_buf[1000];
sox_uint64_t seek = 0; /* Initialization of all format handlers */
sox_format_init (); /* Open Wav file for reading */ sox_fd1 =
sox_open_read (argv[1], NULL, NULL, "wav"); sox_fd2 = sox_open_write
("default", &sox_fd1->signal, NULL, "alsa", NULL, NULL); for (i = 0; i < 5;
i++) { while (sox_size) { sox_size = sox_read (sox_fd1, sox_buf, 100000);
sox_write (sox_fd2, sox_buf, sox_size); } sox_size = 1; sox_status = sox_seek
(sox_fd1, 0L, SOX_SEEK_SET); } /* Close Wav file */ sox_close (sox_fd1);
sox_close (sox_fd2); /* De-initialization of file format handlers */
sox_format_quit (); return 0;
}
It seems that sox_seek is not functioning properly, but the function sox_seek
returns successfully. What can be the problem?
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel