SOUND4 BIGVOICE.CL Library [1.1.0]
sound4.bigvoice.cl.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include <stdint.h>
7 #ifdef __unix__
8  #include <sys/types.h>
9  #define BIGVOICE_DECL __attribute__ ((visibility ("default")))
10 #elif defined(_WIN32) || defined(WIN32)
11  #ifdef BUILDING_BIGVOICE_DLL
12  #define BIGVOICE_DECL __declspec(dllexport)
13  #else
14  #define BIGVOICE_DECL __declspec(dllimport)
15  #endif
16 #endif
17 
18 #define BIGVOICE_HAS_WEBSERVER 1
19 #define BIGVOICE_HAS_CLOUDBUS 1
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif // __cplusplus
24 
70 // --------------------------------------------------------------
89 // --------------------------------------------------------------
143 // --------------------------------------------------------------
144 
145 // --------------------------------------------------------------
157 #define BIGVOICE_AUDIOFRAME_COUNT 12
163 #define BIGVOICE_CHANNEL_COUNT 1
169 #define BIGVOICE_AUDIO_INPUT_COUNT 1
175 #define BIGVOICE_AUDIO_OUTPUT_COUNT 1
181 #define BIGVOICE_SAMPLE_RATE 48000
182 
189  size_t struct_size;
190  const char *name;
191  const char *prefix;
192  const char *shortname;
193  const char *version;
194 };
195 
204 
211 
225 
235 
244 
254 
264 
273 
278  none = 0,
279  fatal = 1,
280  error = 2,
281  warning = 3,
282  info = 4,
283  verbose = 5,
284  verbose2 = 6,
285  verbose3 = 7,
286  verbose4 = 8,
287  verbose5 = 9,
288 };
289 
296 typedef void (*bigvoice_loggerfn) (enum bigvoice_LogSeverity, const char *);
297 
308 
317 
320 // --------------------------------------------------------------
326 // --------------------------------------------------------------
330 struct bigvoice_CInstance;
331 
335 struct bigvoice_CParameters;
336 
345 
350 
362 BIGVOICE_DECL void bigvoice_SetParameter(struct bigvoice_CParameters *params, const char *name, const char *value);
363 
369 BIGVOICE_DECL const char *bigvoice_GetParameter(struct bigvoice_CParameters *params, const char *name);
370 
377 
386  const char *LoginKey,
387  const char *RadioName,
388  const char *Access_Key_ID,
389  const char *Access_Key_Secret,
390  const char *save_path
391  );
392 
401  const char *LoginKey,
402  const char *RadioName,
403  const char *Access_Key_ID,
404  const char *Access_Key_Secret,
405  const char *save_path,
406  const struct bigvoice_CParameters *parameters
407  );
408 
454  const char *LoginKey,
455  const char *RadioName,
456  const char *Access_Key_ID,
457  const char *Access_Key_Secret,
458  const char *save_path,
459  const struct bigvoice_CParameters *parameters,
460  unsigned int frames_per_chunk
461  );
462 
475 
486 
493 
496 #if BIGVOICE_HAS_CLOUDBUS
497 // --------------------------------------------------------------
506 struct bigvoice_CBus;
507 
514 
521 
532 
533 
535 #endif // BIGVOICE_HAS_CLOUDBUS
536 
537 // --------------------------------------------------------------
560 // --------------------------------------------------------------
561 
562 // OS dependent filesystem path char type
563 #ifdef _WIN32
564  typedef wchar_t fs_char;
565 #else // !_WIN32
566  typedef char fs_char;
567 #endif // !_WIN32
568 
576 typedef char * (*bigvoice_storage_reader) (const fs_char *filename, void* userdata);
577 
584 typedef void (*bigvoice_storage_reader_free) (char *content, void* userdata);
585 
594 typedef int (*bigvoice_storage_writer) (const fs_char *filename, const char *content, void* userdata);
595 
603 typedef int (*bigvoice_storage_exists) (const fs_char *filename, void* userdata);
604 
612 typedef fs_char** (*bigvoice_storage_getall) (void* userdata);
613 
620 typedef void (*bigvoice_storage_getall_free) (fs_char**all, void* userdata);
621 
629 typedef int (*bigvoice_storage_remove) (const fs_char *filename, void* userdata);
630 
639 typedef int (*bigvoice_storage_rename) (const fs_char *from, const fs_char *to, void* userdata);
640 
660  , bigvoice_storage_writer writer
661  , bigvoice_storage_exists exists
663  , bigvoice_storage_remove remove
664  , bigvoice_storage_rename rename
665  , int IsReadOnly
666  , void* userdata
667  );
668 
676 };
677 
686 BIGVOICE_DECL void bigvoice_PresetManager_InformChange(struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind);
687 
690 // --------------------------------------------------------------
698 // --------------------------------------------------------------
699 
716 BIGVOICE_DECL void bigvoice_SetMetadata(struct bigvoice_CInstance *instance, const char* key, const char* value);
717 
728 BIGVOICE_DECL void bigvoice_SetMetadataMulti(struct bigvoice_CInstance *instance, const char** keyvalue);
729 
738 
745 BIGVOICE_DECL void bigvoice_FreeMetadataInfos(struct bigvoice_CInstance *instance, const char** infos);
746 
749 // --------------------------------------------------------------
754 // --------------------------------------------------------------
755 
768 BIGVOICE_DECL void bigvoice_StartUpdateThread(struct bigvoice_CInstance *instance, unsigned int port);
769 
776 
784 BIGVOICE_DECL int bigvoice_WaitUpdateThreadReady(struct bigvoice_CInstance *instance, int milliseconds);
785 
788 // --------------------------------------------------------------
793 // --------------------------------------------------------------
815 BIGVOICE_DECL void bigvoice_ProcessAudio(struct bigvoice_CInstance *instance, const float *input, float *output );
816 
836  , float const * const *input
837  , float * const *output);
838 
852 
866 
875 
878 // --------------------------------------------------------------
885 // --------------------------------------------------------------
886  #ifdef _MSC_VER
887  #define __BYTE_ORDER__ REG_DWORD
888  #define __ORDER_LITTLE_ENDIAN__ REG_DWORD_LITTLE_ENDIAN
889  #define __ORDER_BIG_ENDIAN__ REG_DWORD_BIG_ENDIAN
890  #endif
891 
905 
906  // Native definitions, only links to the physical ones
907  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
912  #else
917  #endif
918 };
919 
927 
935 
943 
944 
952 
963 BIGVOICE_DECL unsigned int bigvoice_AddAudio(struct bigvoice_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum bigvoice_SampleFormat fmt );
964 
972 
980 
990 BIGVOICE_DECL unsigned int bigvoice_GetAudio(struct bigvoice_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum bigvoice_SampleFormat fmt );
991 
995 // --------------------------------------------------------------
999 // --------------------------------------------------------------
1010 BIGVOICE_DECL void bigvoice_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum bigvoice_SampleFormat fmt);
1011 
1022 BIGVOICE_DECL void bigvoice_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum bigvoice_SampleFormat fmt);
1023 
1033 BIGVOICE_DECL void bigvoice_StereoToMono(const float *input, float *output, size_t nFrame);
1034 
1044 BIGVOICE_DECL void bigvoice_MonoToStereo(const float *input, float *output, size_t nFrame);
1045 
1056 BIGVOICE_DECL void bigvoice_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame);
1057 
1068 BIGVOICE_DECL void bigvoice_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame);
1069 
1076 BIGVOICE_DECL void bigvoice_AudioMonoFromLiveStereo(const uint8_t *payload, float *output);
1077 
1084 BIGVOICE_DECL void bigvoice_AudioMonoToLiveStereo(const float *input, uint8_t *payload);
1085 
1088 // --------------------------------------------------------------
1093 // --------------------------------------------------------------
1098 
1108 
1115 
1129 BIGVOICE_DECL const char *bigvoice_ProcessJson(struct bigvoice_CClientInstance *client, const char *json_str, int *need_save);
1130 
1136 BIGVOICE_DECL void bigvoice_FreeJsonAnswer(const char *json_str);
1137 
1150 
1446 #if BIGVOICE_HAS_WEBSERVER
1447 // --------------------------------------------------------------
1455 // --------------------------------------------------------------
1474 BIGVOICE_DECL uint64_t bigvoice_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port);
1475 
1476 // --------------------------------------------------------------
1496 BIGVOICE_DECL uint64_t bigvoice_Webserver_tcp2(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port, const struct bigvoice_CParameters *parameters);
1497 
1515 BIGVOICE_DECL uint64_t bigvoice_Webserver(unsigned int listenport, unsigned int listenport_secure, struct bigvoice_CInstance *instance);
1516 
1526 BIGVOICE_DECL int bigvoice_Webserver_Stop(uint64_t id, int timeout_ms);
1527 
1537 
1548 BIGVOICE_DECL void bigvoice_Webserver_SetAppHealth(struct bigvoice_CInstance *instance, int httpcode, const char *contenttype, const char *content);
1549 
1558 BIGVOICE_DECL void bigvoice_Webserver_GetAppHealth(struct bigvoice_CInstance *instance, int* httpcode, char** contenttype, char** content);
1559 
1566 
1571 #define SOUND4_INVALID_WEBSERVER_ID ((uint64_t)-1)
1572 
1576 #define SOUND4_WEBSERVER_HTTP_OK (1<<0)
1580 #define SOUND4_WEBSERVER_HTTPS_OK (1<<1)
1581 
1583 #endif // BIGVOICE_HAS_WEBSERVER
1584 
1585 #ifdef __cplusplus
1586 } // extern "C"
1587 #endif // __cplusplus
unsigned int bigvoice_GetOutputCount(struct bigvoice_CInstance *instance)
unsigned int bigvoice_GetAudio(struct bigvoice_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum bigvoice_SampleFormat fmt)
unsigned int bigvoice_GetMaxPacketFrame(struct bigvoice_CInstance *instance)
bigvoice_SampleFormat
const char * bigvoice_GetFormatName(const enum bigvoice_SampleFormat fmt)
unsigned int bigvoice_GetBytesFromFormat(const enum bigvoice_SampleFormat fmt)
unsigned int bigvoice_AddPadAudio(struct bigvoice_CInstance *instance)
enum bigvoice_SampleFormat bigvoice_GetFormatFromName(const char *name)
unsigned int bigvoice_AddAudio(struct bigvoice_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum bigvoice_SampleFormat fmt)
@ F32_NATIVE
32-bit floating-point, native
@ INVALID_FORMAT
Invalid.
@ S16_NATIVE
16-bit signed integer, native
@ F32_LE
32-bit floating-point, little-endian
@ S16_BE
16-bit signed integer, big-endian
@ S32_BE
32-bit signed integer, big-endian
@ S24_BE
24-bit signed integer, big-endian
@ S16_LE
16-bit signed integer, little-endian
@ F32_BE
32-bit floating-point, big-endian
@ S32_NATIVE
32-bit signed integer, native
@ S24_LE
24-bit signed integer, little-endian
@ S32_LE
32-bit signed integer, little-endian
@ S24_NATIVE
24-bit signed integer, native
int bigvoice_SaveState(struct bigvoice_CInstance *instance)
void bigvoice_DeleteClient(struct bigvoice_CClientInstance *client)
const char * bigvoice_ProcessJson(struct bigvoice_CClientInstance *client, const char *json_str, int *need_save)
void bigvoice_FreeJsonAnswer(const char *json_str)
struct bigvoice_CClientInstance * bigvoice_NewClient(struct bigvoice_CInstance *instance)
struct bigvoice_CBus * bigvoice_NewBus()
void bigvoice_FreeBus(struct bigvoice_CBus *bus)
void bigvoice_SetInstanceBus(struct bigvoice_CParameters *params, struct bigvoice_CBus *bus)
void bigvoice_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum bigvoice_SampleFormat fmt)
void bigvoice_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum bigvoice_SampleFormat fmt)
void bigvoice_AudioMonoToLiveStereo(const float *input, uint8_t *payload)
void bigvoice_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame)
void bigvoice_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame)
void bigvoice_AudioMonoFromLiveStereo(const uint8_t *payload, float *output)
void bigvoice_MonoToStereo(const float *input, float *output, size_t nFrame)
void bigvoice_StereoToMono(const float *input, float *output, size_t nFrame)
void bigvoice_ProcessAudio(struct bigvoice_CInstance *instance, const float *input, float *output)
unsigned int bigvoice_GetEstimatedDelay(struct bigvoice_CInstance *instance)
float * bigvoice_GetBufferOut(struct bigvoice_CInstance *instance)
void bigvoice_ProcessAudio_Planar(struct bigvoice_CInstance *instance, float const *const *input, float *const *output)
float * bigvoice_GetBufferIn(struct bigvoice_CInstance *instance)
const char * bigvoice_GetVersion()
bigvoice_LogSeverity
unsigned int * bigvoice_GetPossibleChunkSizeInFrames()
void(* bigvoice_loggerfn)(enum bigvoice_LogSeverity, const char *)
unsigned int bigvoice_GetAudioInputCount()
unsigned int bigvoice_GetChannelCount()
void bigvoice_SetLoggerCallback(bigvoice_loggerfn logger)
void bigvoice_SetLogSeverity(enum bigvoice_LogSeverity severity)
const struct SOUND4_ProcessInfo * SOUND4_GetProcessInfo()
unsigned int bigvoice_GetChunkSizeInFrames()
unsigned int bigvoice_GetAudioOutputCount()
unsigned int bigvoice_GetSampleRate()
@ verbose5
@ warning
@ verbose4
@ verbose2
@ verbose3
@ verbose
void bigvoice_FreeParameterValue(const char *value)
int bigvoice_TerminateProcess(struct bigvoice_CInstance *instance)
void bigvoice_FreeParameters(struct bigvoice_CParameters *params)
struct bigvoice_CInstance * bigvoice_InitProcess(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path)
void bigvoice_ExitProcess(struct bigvoice_CInstance *instance)
unsigned int bigvoice_GetProcessChunkFrames(struct bigvoice_CInstance *instance)
const char * bigvoice_GetParameter(struct bigvoice_CParameters *params, const char *name)
struct bigvoice_CParameters * bigvoice_NewParameters()
void bigvoice_SetParameter(struct bigvoice_CParameters *params, const char *name, const char *value)
struct bigvoice_CInstance * bigvoice_InitProcess2(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path, const struct bigvoice_CParameters *parameters)
struct bigvoice_CInstance * bigvoice_InitProcess3(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path, const struct bigvoice_CParameters *parameters, unsigned int frames_per_chunk)
void bigvoice_FreeMetadataInfos(struct bigvoice_CInstance *instance, const char **infos)
void bigvoice_SetMetadata(struct bigvoice_CInstance *instance, const char *key, const char *value)
void bigvoice_SetMetadataMulti(struct bigvoice_CInstance *instance, const char **keyvalue)
const char ** bigvoice_GetMetadataInfos(struct bigvoice_CInstance *instance)
char *(* bigvoice_storage_reader)(const fs_char *filename, void *userdata)
void(* bigvoice_storage_getall_free)(fs_char **all, void *userdata)
int(* bigvoice_storage_exists)(const fs_char *filename, void *userdata)
fs_char **(* bigvoice_storage_getall)(void *userdata)
int(* bigvoice_storage_remove)(const fs_char *filename, void *userdata)
int(* bigvoice_storage_writer)(const fs_char *filename, const char *content, void *userdata)
bigvoice_PresetChange_Kind
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_storage_reader_free)(char *content, void *userdata)
void bigvoice_PresetManager_InformChange(struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind)
wchar_t fs_char
int(* bigvoice_storage_rename)(const fs_char *from, const fs_char *to, void *userdata)
@ change_kind_modified
Path has been modified.
@ change_kind_created
Path has been created.
@ change_kind_deleted
Path has been deleted.
void bigvoice_StopUpdateThread(struct bigvoice_CInstance *instance)
int bigvoice_WaitUpdateThreadReady(struct bigvoice_CInstance *instance, int milliseconds)
void bigvoice_StartUpdateThread(struct bigvoice_CInstance *instance, unsigned int port)
uint64_t bigvoice_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port)
uint64_t bigvoice_Webserver(unsigned int listenport, unsigned int listenport_secure, struct bigvoice_CInstance *instance)
int bigvoice_Webserver_Stop(uint64_t id, int timeout_ms)
uint64_t bigvoice_Webserver_tcp2(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port, const struct bigvoice_CParameters *parameters)
int bigvoice_Webserver_Status(uint64_t id)
void bigvoice_Webserver_SetAppHealth(struct bigvoice_CInstance *instance, int httpcode, const char *contenttype, const char *content)
void bigvoice_Webserver_FreeString(char *str)
void bigvoice_Webserver_GetAppHealth(struct bigvoice_CInstance *instance, int *httpcode, char **contenttype, char **content)
#define BIGVOICE_DECL
const char * version
Library version.
const char * shortname
A short name of the processor, single word.
const char * prefix
The prefix of this processor functions.
size_t struct_size
The size of total this structure, for compatibility checking.
const char * name
The name of the processor.