SOUND4 BIGVOICE.CL Library [1.1.6]
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
Custom preset managagement

This allows to provide a customized preset management. More...

Typedefs

typedef wchar_t fs_char
 
typedef char *(* bigvoice_storage_reader) (const fs_char *filename, void *userdata)
 
typedef void(* bigvoice_storage_reader_free) (char *content, void *userdata)
 
typedef int(* bigvoice_storage_writer) (const fs_char *filename, const char *content, void *userdata)
 
typedef int(* bigvoice_storage_exists) (const fs_char *filename, void *userdata)
 
typedef fs_char **(* bigvoice_storage_getall) (void *userdata)
 
typedef void(* bigvoice_storage_getall_free) (fs_char **all, void *userdata)
 
typedef int(* bigvoice_storage_remove) (const fs_char *filename, void *userdata)
 
typedef int(* bigvoice_storage_rename) (const fs_char *from, const fs_char *to, void *userdata)
 

Enumerations

enum  bigvoice_PresetChange_Kind { change_kind_created = 1 , change_kind_modified , change_kind_deleted }
 

Functions

void bigvoice_SetPresetManager (struct bigvoice_CParameters *params, bigvoice_storage_reader reader, bigvoice_storage_reader_free, bigvoice_storage_writer writer, bigvoice_storage_exists exists, bigvoice_storage_getall getall, bigvoice_storage_getall_free getall_free, bigvoice_storage_remove remove, bigvoice_storage_rename rename, int IsReadOnly, void *userdata)
 
void bigvoice_PresetManager_InformChange (struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind)
 

Detailed Description

This allows to provide a customized storage for presets and settings.

By default, the library store data on disk or in memory (see save_path parameter in bigvoice_InitProcess2), but you may use these functions to store data.

It can be used for remote storage, database storage, ...

Known files:

Attention
state.json name can be overriden per instance with STATE_FILENAME in parameters, see Parameters.

File names are in OS native characters ( wchar_t for Windows, char in UTF-8 for others)

Typedef Documentation

◆ bigvoice_storage_exists

typedef int(* bigvoice_storage_exists) (const fs_char *filename, void *userdata)

Function to call to test if a stored file exists.

Parameters
filenamethe name of the file to test.
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
-1 if not exists, 0 if it exists

Definition at line 474 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_getall

typedef fs_char **(* bigvoice_storage_getall) (void *userdata)

Function to call to get all stored files' name. Result has to be freed with bigvoice_storage_getall_free callback

Parameters
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
A NULL terminated array of file names

Definition at line 483 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_getall_free

typedef void(* bigvoice_storage_getall_free) (fs_char **all, void *userdata)

Function to call to free the result of getall.

Parameters
allthe returned value from bigvoice_storage_getall
userdatathe userdata passed to bigvoice_SetPresetManager

Definition at line 491 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_reader

typedef char *(* bigvoice_storage_reader) (const fs_char *filename, void *userdata)

Function to call to read a stored file, returning its content.

Parameters
filenamethe name of the file to read.
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
the UTF-8 content of the file

Definition at line 447 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_reader_free

typedef void(* bigvoice_storage_reader_free) (char *content, void *userdata)

Function to call to free the result of bigvoice_storage_reader.

Parameters
contentthe returned value from bigvoice_storage_reader
userdatathe userdata passed to bigvoice_SetPresetManager

Definition at line 455 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_remove

typedef int(* bigvoice_storage_remove) (const fs_char *filename, void *userdata)

Function to call to remove a stored file.

Parameters
filenamethe name of the file to remove.
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
-1 if failed, 0 if OK

Definition at line 500 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_rename

typedef int(* bigvoice_storage_rename) (const fs_char *from, const fs_char *to, void *userdata)

Function to call to rename a stored file.

Parameters
fromThe source file name (must exist)
toThe destination file name (must not exist)
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
-1 if failed, 0 if OK

Definition at line 510 of file sound4.bigvoice.cl.h.

◆ bigvoice_storage_writer

typedef int(* bigvoice_storage_writer) (const fs_char *filename, const char *content, void *userdata)

Function to call to write a stored file.

Parameters
filenamethe name of the file to write.
contentthe UTF-8 content to write to the file
userdatathe userdata passed to bigvoice_SetPresetManager
Returns
-1 if failed, 0 if OK

Definition at line 465 of file sound4.bigvoice.cl.h.

◆ fs_char

typedef wchar_t fs_char

Definition at line 435 of file sound4.bigvoice.cl.h.

Enumeration Type Documentation

◆ bigvoice_PresetChange_Kind

Kind of change on a storage path

Enumerator
change_kind_created 

Path has been created.

change_kind_modified 

Path has been modified.

change_kind_deleted 

Path has been deleted.

Definition at line 543 of file sound4.bigvoice.cl.h.

Function Documentation

◆ bigvoice_PresetManager_InformChange()

void bigvoice_PresetManager_InformChange ( struct bigvoice_CInstance instance,
const fs_char relative_path,
enum bigvoice_PresetChange_Kind  change_kind 
)

Inform that a change happened in the storage. This must be used only in conjonction with bigvoice_SetPresetManager

Parameters
instancethe processing instance
relative_pathThe path which changed, relative to the root storage
change_kindWhat happened to this path

◆ bigvoice_SetPresetManager()

void bigvoice_SetPresetManager ( struct bigvoice_CParameters params,
bigvoice_storage_reader  reader,
bigvoice_storage_reader_free  ,
bigvoice_storage_writer  writer,
bigvoice_storage_exists  exists,
bigvoice_storage_getall  getall,
bigvoice_storage_getall_free  getall_free,
bigvoice_storage_remove  remove,
bigvoice_storage_rename  rename,
int  IsReadOnly,
void *  userdata 
)

Setup a custom preset manager. This overrides the save_path in bigvoice_InitProcess2

To dynamically update when storage change, see bigvoice_PresetManager_InformChange

Parameters
paramsThe params to set up
readerThe function to read a file
writerThe function to write a file
existsThe function to test for a file presence
getallThe function to get all files in storage
getall_freeThe function to free the result from getall
removeThe function to remove a file from storage
renameThe function to rename a file
IsReadOnlySet to 1 if storage is read-only
userdataThe userdata parameter for callbacks