2023-05-07 23:47:37 +02:00
|
|
|
#ifndef _API_H_
|
|
|
|
#define _API_H_
|
2024-07-07 21:25:59 +02:00
|
|
|
#include "base/plugins.h" //TODO: to be removed
|
2023-05-14 20:17:51 +02:00
|
|
|
|
2024-07-14 20:31:50 +02:00
|
|
|
//#define LIBVGMSTREAM_ENABLE 1
|
|
|
|
#if LIBVGMSTREAM_ENABLE
|
2023-05-07 23:47:37 +02:00
|
|
|
|
2024-07-07 21:25:59 +02:00
|
|
|
/* vgmstream's public API
|
2024-07-14 20:31:50 +02:00
|
|
|
*
|
|
|
|
* By default vgmstream behaves like a simple decoder (extract samples until stream end), but you can configure it
|
2024-07-21 18:22:56 +02:00
|
|
|
* to loop N times or even downmix. In other words, it also behaves a bit like a player.
|
2024-07-14 20:31:50 +02:00
|
|
|
*
|
|
|
|
* It exposes multiple options and convenience functions beyond simple decoding mainly for various plugins,
|
|
|
|
* since it was faster moving shared behavior to core rather than reimplementing every time.
|
|
|
|
*
|
|
|
|
* All this may make the API a bit twisted and coupled (sorry, tried my best), probably will improve later. Probably.
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* - vgmstream may dynamically allocate stuff as needed (not too much beyond some setup buffers, but varies per format)
|
|
|
|
* - previously the only way to use vgmstream was accesing its internals. Now there is an API internals may change in the future
|
2024-07-21 18:22:56 +02:00
|
|
|
* - some details described in the API may not happen at the moment (they are defined for future internal changes)
|
2024-07-14 20:31:50 +02:00
|
|
|
* - main reason it uses the slighly long-winded libvgmstream_* names is that internals use the vgmstream_* 'namespace'
|
|
|
|
* - c-strings should be in UTF-8
|
|
|
|
* - the API is still WIP and may be slightly buggy overall due to lack of time, to be improved later
|
|
|
|
* - vgmstream's features are mostly stable, but this API may be tweaked from time to time (check API_VERSION)
|
|
|
|
*
|
|
|
|
* Basic usage (also see api_example.c):
|
2024-07-07 21:25:59 +02:00
|
|
|
* - libvgmstream_init(...) // base context
|
2024-07-14 20:31:50 +02:00
|
|
|
* - libvgmstream_setup(...) // config if needed
|
|
|
|
* - libvgmstream_open(...) // setup format
|
2024-07-07 21:25:59 +02:00
|
|
|
* - libvgmstream_play(...) // main decode
|
|
|
|
* - output samples + repeat libvgmstream_play until stream is done
|
|
|
|
* - libvgmstream_free(...) // cleanup
|
|
|
|
*/
|
2023-05-07 23:47:37 +02:00
|
|
|
|
2024-07-07 21:25:59 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2023-05-07 23:47:37 +02:00
|
|
|
|
2024-07-07 21:25:59 +02:00
|
|
|
/* standard C param call and name mangling (to avoid __stdcall / .defs) */
|
2023-05-07 23:47:37 +02:00
|
|
|
//#define LIBVGMSTREAM_CALL __cdecl //needed?
|
2024-07-07 21:25:59 +02:00
|
|
|
//LIBVGMSTREAM_API (type) LIBVGMSTREAM_CALL libvgmstream_function(...);
|
2023-05-07 23:47:37 +02:00
|
|
|
|
2024-07-07 21:25:59 +02:00
|
|
|
/* define external function behavior (during compilation) */
|
2023-05-07 23:47:37 +02:00
|
|
|
#if defined(LIBVGMSTREAM_EXPORT)
|
|
|
|
#define LIBVGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */
|
|
|
|
#elif defined(LIBVGMSTREAM_IMPORT)
|
|
|
|
#define LIBVGMSTREAM_API __declspec(dllimport) /* when importing/linking vgmstream DLL */
|
|
|
|
#else
|
|
|
|
#define LIBVGMSTREAM_API /* nothing, internal/default */
|
|
|
|
#endif
|
|
|
|
|
2024-07-21 18:22:56 +02:00
|
|
|
#include "api_version.h"
|
2024-07-14 20:31:50 +02:00
|
|
|
#include "api_decode.h"
|
|
|
|
#include "api_helpers.h"
|
2024-07-07 21:25:59 +02:00
|
|
|
#include "api_streamfile.h"
|
|
|
|
#include "api_tags.h"
|
2023-05-07 23:47:37 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|