Add flac support
Not working properly due to decoding flac in to 32 bit buffer instead of 16 bit. Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "trivial_example.h"
|
||||
#include "flac.h"
|
||||
|
||||
#define BUFFER_SIZE 16 * 1024
|
||||
#define AUDIO_FOLDER "sdmc:/MUSIC/"
|
||||
@@ -136,12 +137,26 @@ int main(int argc, char **argv)
|
||||
err_print("Opening file failed.");
|
||||
else
|
||||
{
|
||||
int ret;
|
||||
// TODO: make this dynamic
|
||||
if((ret = convOpus(file, "sdmc:/MUSIC/out.wav")) != 0)
|
||||
playWav(file);
|
||||
char* ext = strrchr(file, '.');
|
||||
|
||||
printf("ret=%d\n", ret);
|
||||
if(ext == NULL)
|
||||
printf("\nUnable to obtain file type.");
|
||||
else
|
||||
{
|
||||
/* To skip the dot */
|
||||
ext++;
|
||||
|
||||
// TODO: Don't rely on file extension.
|
||||
if(strncasecmp(ext, "opus", 4) == 0)
|
||||
convOpus(file, "sdmc:/MUSIC/out.wav");
|
||||
else if(strncasecmp(ext, "flac", 4) == 0)
|
||||
playFlac(file);
|
||||
else if(strncasecmp(ext, "wav", 3) == 0 ||
|
||||
strncasecmp(ext, "aiff", 4) == 0)
|
||||
playWav(file);
|
||||
else
|
||||
printf("\nFile type \"%s\" not recognised.", ext);
|
||||
}
|
||||
}
|
||||
|
||||
free(file);
|
||||
|
||||
Reference in New Issue
Block a user