Skip to content

Commit

Permalink
Export function for dll in bark.h
Browse files Browse the repository at this point in the history
  • Loading branch information
vinovo committed Oct 18, 2024
1 parent d2b51e7 commit d1162d3
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions bark.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
#include "ggml-backend.h"
#include "ggml.h"

#ifdef _WIN32
#ifdef EXPORTING_BARK
#define BARK_API __declspec(dllexport)
#else
#define BARK_API __declspec(dllimport)
#endif
#else
#define BARK_API
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -135,7 +145,7 @@ extern "C" {
*
* @return bark_context_params The default parameters for a bark context.
*/
struct bark_context_params bark_context_default_params(void);
BARK_API struct bark_context_params bark_context_default_params(void);

/**
* Loads a Bark model from the specified file path with the given parameters.
Expand All @@ -145,7 +155,7 @@ extern "C" {
* @param seed The seed to use for random number generation.
* @return A pointer to the loaded bark model context.
*/
struct bark_context *bark_load_model(
BARK_API struct bark_context *bark_load_model(
const char *model_path,
struct bark_context_params params,
uint32_t seed);
Expand All @@ -158,7 +168,7 @@ extern "C" {
* @param n_threads The number of threads to use for generating the audio.
* @return An integer indicating the success of the audio generation process.
*/
bool bark_generate_audio(
BARK_API bool bark_generate_audio(
struct bark_context *bctx,
const char *text,
int n_threads);
Expand All @@ -169,7 +179,7 @@ extern "C" {
* @param bctx The Bark context to use for generating the audio.
* @return A pointer to the audio data generated by the Bark context.
*/
float *bark_get_audio_data(
BARK_API float *bark_get_audio_data(
struct bark_context *bctx);

/**
Expand All @@ -178,7 +188,7 @@ extern "C" {
* @param bctx The Bark context to use for generating the audio.
* @return The size of the audio data generated by the Bark context.
*/
int bark_get_audio_data_size(
BARK_API int bark_get_audio_data_size(
struct bark_context *bctx);

/**
Expand All @@ -187,7 +197,7 @@ extern "C" {
* @param bctx The Bark context to use for generating the audio.
* @return A struct containing the statistics of the last audio generation round.
*/
int64_t bark_get_load_time(
BARK_API int64_t bark_get_load_time(
struct bark_context *bctx);

/**
Expand All @@ -196,7 +206,7 @@ extern "C" {
* @param bctx The Bark context to use for generating the audio.
* @return A struct containing the statistics of the last audio generation round.
*/
int64_t bark_get_eval_time(
BARK_API int64_t bark_get_eval_time(
struct bark_context *bctx);

/**
Expand All @@ -205,7 +215,7 @@ extern "C" {
* @param bctx The Bark context to use for generating the audio.
* @return A struct containing the statistics of the last audio generation round.
*/
void bark_reset_statistics(
BARK_API void bark_reset_statistics(
struct bark_context *bctx);

/**
Expand All @@ -216,7 +226,7 @@ extern "C" {
* @param ftype The type of the model's floating-point values.
* @return True if the model was successfully quantized and saved, false otherwise.
*/
bool bark_model_quantize(
BARK_API bool bark_model_quantize(
const char *fname_inp,
const char *fname_out,
enum ggml_ftype ftype);
Expand All @@ -226,7 +236,7 @@ extern "C" {
*
* @param bctx The bark context to free.
*/
void bark_free(
BARK_API void bark_free(
struct bark_context *bctx);

#ifdef __cplusplus
Expand Down

0 comments on commit d1162d3

Please sign in to comment.