70 lines
1.2 KiB
C
70 lines
1.2 KiB
C
![]() |
/*********************************************
|
||
|
* Description - Cyan audio player
|
||
|
* Author - Vilyaem
|
||
|
* *******************************************/
|
||
|
|
||
|
/*----------PREPROCESSOR----------*/
|
||
|
|
||
|
#define _XOPEN_SOURCE 500
|
||
|
#include <stdio.h>
|
||
|
|
||
|
#define MINIAUDIO_IMPLEMENTATION
|
||
|
#include "miniaudio.h"
|
||
|
#define FILES 32
|
||
|
|
||
|
/*----------DATASTRUCTURES----------*/
|
||
|
|
||
|
/*----------GLOBALS----------*/
|
||
|
|
||
|
/*----------FUNCTIONS----------*/
|
||
|
|
||
|
/*********************************************
|
||
|
* Description - main
|
||
|
* Author - Vilyaem
|
||
|
* *******************************************/
|
||
|
int main(int argc, char** argv){
|
||
|
int i;
|
||
|
ma_engine e;
|
||
|
ma_sound sound;
|
||
|
ma_result res;
|
||
|
char c;
|
||
|
|
||
|
puts("cyan by Vilyaem\n\nPlaying...");
|
||
|
|
||
|
ma_engine_init(NULL,&e);
|
||
|
|
||
|
for(i = 1; i != argc; ++i)
|
||
|
puts(argv[i]);
|
||
|
|
||
|
|
||
|
if(argc < 1){
|
||
|
puts("Not enough arguments");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
for(i = 1; i != argc; ++i){
|
||
|
ma_sound_uninit(&sound);
|
||
|
printf("> %s\n",argv[i]);
|
||
|
|
||
|
res = ma_sound_init_from_file(&e,argv[i],0,NULL,NULL,&sound);
|
||
|
if(res != MA_SUCCESS){
|
||
|
printf("Failed to play file: %s\n",argv[i]);
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
ma_sound_start(&sound);
|
||
|
|
||
|
|
||
|
while(1){
|
||
|
usleep(1);
|
||
|
c = getchar();
|
||
|
if(c == '\n'){
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ma_engine_uninit(&e);
|
||
|
return 0;
|
||
|
}
|