diff --git a/Makefile.common b/Makefile.common index 59dd0dc7fd..8715b2d5ae 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1437,10 +1437,8 @@ endif ifeq ($(HAVE_BUILTINFLAC),1) HAVE_FLAC = 1 -ifneq ($(C89_BUILD), 1) DEFINES += -DHAVE_DR_FLAC -I$(DEPS_DIR) CFLAGS += -DHAVE_DR_FLAC -endif CFLAGS += -DHAVE_FLAC -I$(DEPS_DIR)/libFLAC/include DEFINES += -DHAVE_STDINT_H -DHAVE_LROUND -DFLAC__HAS_OGG=0 \ -DFLAC_PACKAGE_VERSION="\"retroarch\"" diff --git a/file_path_special.h b/file_path_special.h index b0eeee3bdc..a1b138c7d2 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -86,6 +86,7 @@ enum file_path_enum FILE_PATH_ZIP_EXTENSION, FILE_PATH_7Z_EXTENSION, FILE_PATH_OGG_EXTENSION, + FILE_PATH_FLAC_EXTENSION, FILE_PATH_WAV_EXTENSION, FILE_PATH_MOD_EXTENSION, FILE_PATH_S3M_EXTENSION, diff --git a/file_path_str.c b/file_path_str.c index 219c719720..d741109c56 100644 --- a/file_path_str.c +++ b/file_path_str.c @@ -101,6 +101,9 @@ const char *file_path_str(enum file_path_enum enum_idx) case FILE_PATH_PNG_EXTENSION: str = ".png"; break; + case FILE_PATH_FLAC_EXTENSION: + str = ".flac"; + break; case FILE_PATH_OGG_EXTENSION: str = ".ogg"; break; diff --git a/tasks/task_audio_mixer.c b/tasks/task_audio_mixer.c index 4acc62f3f6..0331d8dbcf 100644 --- a/tasks/task_audio_mixer.c +++ b/tasks/task_audio_mixer.c @@ -102,6 +102,28 @@ static void task_audio_mixer_handle_upload_ogg(void *task_data, free(user_data); } +static void task_audio_mixer_handle_upload_flac(void *task_data, + void *user_data, const char *err) +{ + audio_mixer_stream_params_t params; + nbio_buf_t *img = (nbio_buf_t*)task_data; + + if (!img) + return; + + params.volume = 1.0f; + params.type = AUDIO_MIXER_TYPE_FLAC; + params.state = AUDIO_STREAM_STATE_PLAYING; + params.buf = img->buf; + params.bufsize = img->bufsize; + params.cb = NULL; + + audio_driver_mixer_add_stream(¶ms); + + free(img); + free(user_data); +} + static void task_audio_mixer_handle_upload_mod(void *task_data, void *user_data, const char *err) { @@ -216,6 +238,12 @@ bool task_push_audio_mixer_load(const char *fullpath, retro_task_callback_t cb, nbio->type = NBIO_TYPE_OGG; t->callback = task_audio_mixer_handle_upload_ogg; } + else if (strstr(fullpath, file_path_str(FILE_PATH_FLAC_EXTENSION))) + { + image->type = AUDIO_MIXER_TYPE_FLAC; + nbio->type = NBIO_TYPE_FLAC; + t->callback = task_audio_mixer_handle_upload_flac; + } else if ( strstr(fullpath, file_path_str(FILE_PATH_MOD_EXTENSION)) || strstr(fullpath, file_path_str(FILE_PATH_S3M_EXTENSION)) || strstr(fullpath, file_path_str(FILE_PATH_XM_EXTENSION))) diff --git a/tasks/task_file_transfer.c b/tasks/task_file_transfer.c index 9d8ed3976a..849c712267 100644 --- a/tasks/task_file_transfer.c +++ b/tasks/task_file_transfer.c @@ -103,6 +103,7 @@ void task_file_load_handler(retro_task_t *task) if (!task_image_load_handler(task)) task_set_finished(task, true); break; + case NBIO_TYPE_FLAC: case NBIO_TYPE_OGG: case NBIO_TYPE_MOD: case NBIO_TYPE_WAV: diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 4e8e4e5a9f..426e3fbf31 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -73,6 +73,7 @@ enum nbio_type NBIO_TYPE_TGA, NBIO_TYPE_BMP, NBIO_TYPE_OGG, + NBIO_TYPE_FLAC, NBIO_TYPE_MOD, NBIO_TYPE_WAV };