diff --git a/csoundbox.c b/csoundbox.c index 5a16cb4..6cda646 100644 --- a/csoundbox.c +++ b/csoundbox.c @@ -2,17 +2,19 @@ #include #include #include +#include "csoundbox.h" #define BITS 8 -void exitfunction(void) { - - printf("Exiting csoundbox.\n"); -} int main(int argc, char *argv[]) { - mpg123_handle *mh; + + return 0; +} + +void playSound(char *path) { + mpg123_handle *mh; unsigned char *buffer; size_t buffer_size; size_t done; @@ -24,10 +26,6 @@ int main(int argc, char *argv[]) ao_sample_format format; int channels, encoding; long rate; - - atexit(exitfunction); - if(argc < 2) - exit(0); /* initializations */ ao_initialize(); @@ -38,7 +36,7 @@ int main(int argc, char *argv[]) buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char)); /* open the file and get the decoding format */ - mpg123_open(mh, argv[1]); + mpg123_open(mh, path); mpg123_getformat(mh, &rate, &channels, &encoding); /* set the output format and open the output device */ @@ -60,6 +58,4 @@ int main(int argc, char *argv[]) mpg123_delete(mh); mpg123_exit(); ao_shutdown(); - - return 0; } diff --git a/csoundbox.h b/csoundbox.h new file mode 100644 index 0000000..f83094f --- /dev/null +++ b/csoundbox.h @@ -0,0 +1,2 @@ + +void playSound(char *path);