SOUND4 BIGVOICE.CL Library [1.1.1]
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 // --------------------------------------------------------------
144 // --------------------------------------------------------------
145 
146 // --------------------------------------------------------------
158 #define BIGVOICE_AUDIOFRAME_COUNT 12
164 #define BIGVOICE_CHANNEL_COUNT 1
170 #define BIGVOICE_AUDIO_INPUT_COUNT 1
176 #define BIGVOICE_AUDIO_OUTPUT_COUNT 1
182 #define BIGVOICE_SAMPLE_RATE 48000
183 
190  size_t struct_size;
191  const char *name;
192  const char *prefix;
193  const char *shortname;
194  const char *version;
195 };
196 
205 
212 
226 
236 
245 
255 
265 
274 
279  none = 0,
280  fatal = 1,
281  error = 2,
282  warning = 3,
283  info = 4,
284  verbose = 5,
285  verbose2 = 6,
286  verbose3 = 7,
287  verbose4 = 8,
288  verbose5 = 9,
289 };
290 
297 typedef void (*bigvoice_loggerfn) (enum bigvoice_LogSeverity, const char *);
298 
309 
318 
321 // --------------------------------------------------------------
327 // --------------------------------------------------------------
331 struct bigvoice_CInstance;
332 
336 struct bigvoice_CParameters;
337 
346 
351 
363 BIGVOICE_DECL void bigvoice_SetParameter(struct bigvoice_CParameters *params, const char *name, const char *value);
364 
370 BIGVOICE_DECL const char *bigvoice_GetParameter(struct bigvoice_CParameters *params, const char *name);
371 
378 
387  const char *LoginKey,
388  const char *RadioName,
389  const char *Access_Key_ID,
390  const char *Access_Key_Secret,
391  const char *save_path
392  );
393 
402  const char *LoginKey,
403  const char *RadioName,
404  const char *Access_Key_ID,
405  const char *Access_Key_Secret,
406  const char *save_path,
407  const struct bigvoice_CParameters *parameters
408  );
409 
455  const char *LoginKey,
456  const char *RadioName,
457  const char *Access_Key_ID,
458  const char *Access_Key_Secret,
459  const char *save_path,
460  const struct bigvoice_CParameters *parameters,
461  unsigned int frames_per_chunk
462  );
463 
476 
487 
494 
497 #if BIGVOICE_HAS_CLOUDBUS
498 // --------------------------------------------------------------
507 struct bigvoice_CBus;
508 
515 
522 
533 
534 
536 #endif // BIGVOICE_HAS_CLOUDBUS
537 
538 // --------------------------------------------------------------
561 // --------------------------------------------------------------
562 
563 // OS dependent filesystem path char type
564 #ifdef _WIN32
565  typedef wchar_t fs_char;
566 #else // !_WIN32
567  typedef char fs_char;
568 #endif // !_WIN32
569 
577 typedef char * (*bigvoice_storage_reader) (const fs_char *filename, void* userdata);
578 
585 typedef void (*bigvoice_storage_reader_free) (char *content, void* userdata);
586 
595 typedef int (*bigvoice_storage_writer) (const fs_char *filename, const char *content, void* userdata);
596 
604 typedef int (*bigvoice_storage_exists) (const fs_char *filename, void* userdata);
605 
613 typedef fs_char** (*bigvoice_storage_getall) (void* userdata);
614 
621 typedef void (*bigvoice_storage_getall_free) (fs_char**all, void* userdata);
622 
630 typedef int (*bigvoice_storage_remove) (const fs_char *filename, void* userdata);
631 
640 typedef int (*bigvoice_storage_rename) (const fs_char *from, const fs_char *to, void* userdata);
641 
661  , bigvoice_storage_writer writer
662  , bigvoice_storage_exists exists
664  , bigvoice_storage_remove remove
665  , bigvoice_storage_rename rename
666  , int IsReadOnly
667  , void* userdata
668  );
669 
677 };
678 
687 BIGVOICE_DECL void bigvoice_PresetManager_InformChange(struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind);
688 
691 // --------------------------------------------------------------
699 // --------------------------------------------------------------
700 
717 BIGVOICE_DECL void bigvoice_SetMetadata(struct bigvoice_CInstance *instance, const char* key, const char* value);
718 
729 BIGVOICE_DECL void bigvoice_SetMetadataMulti(struct bigvoice_CInstance *instance, const char** keyvalue);
730 
739 
746 BIGVOICE_DECL void bigvoice_FreeMetadataInfos(struct bigvoice_CInstance *instance, const char** infos);
747 
750 // --------------------------------------------------------------
755 // --------------------------------------------------------------
756 
769 BIGVOICE_DECL void bigvoice_StartUpdateThread(struct bigvoice_CInstance *instance, unsigned int port);
770 
777 
785 BIGVOICE_DECL int bigvoice_WaitUpdateThreadReady(struct bigvoice_CInstance *instance, int milliseconds);
786 
789 // --------------------------------------------------------------
794 // --------------------------------------------------------------
816 BIGVOICE_DECL void bigvoice_ProcessAudio(struct bigvoice_CInstance *instance, const float *input, float *output );
817 
837  , float const * const *input
838  , float * const *output);
839 
853 
867 
876 
879 // --------------------------------------------------------------
886 // --------------------------------------------------------------
887  #ifdef _MSC_VER
888  #define __BYTE_ORDER__ REG_DWORD
889  #define __ORDER_LITTLE_ENDIAN__ REG_DWORD_LITTLE_ENDIAN
890  #define __ORDER_BIG_ENDIAN__ REG_DWORD_BIG_ENDIAN
891  #endif
892 
906 
907  // Native definitions, only links to the physical ones
908  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
913  #else
918  #endif
919 };
920 
928 
936 
944 
945 
953 
964 BIGVOICE_DECL unsigned int bigvoice_AddAudio(struct bigvoice_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum bigvoice_SampleFormat fmt );
965 
973 
981 
991 BIGVOICE_DECL unsigned int bigvoice_GetAudio(struct bigvoice_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum bigvoice_SampleFormat fmt );
992 
996 // --------------------------------------------------------------
1000 // --------------------------------------------------------------
1011 BIGVOICE_DECL void bigvoice_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum bigvoice_SampleFormat fmt);
1012 
1023 BIGVOICE_DECL void bigvoice_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum bigvoice_SampleFormat fmt);
1024 
1034 BIGVOICE_DECL void bigvoice_StereoToMono(const float *input, float *output, size_t nFrame);
1035 
1045 BIGVOICE_DECL void bigvoice_MonoToStereo(const float *input, float *output, size_t nFrame);
1046 
1057 BIGVOICE_DECL void bigvoice_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame);
1058 
1069 BIGVOICE_DECL void bigvoice_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame);
1070 
1077 BIGVOICE_DECL void bigvoice_AudioMonoFromLiveStereo(const uint8_t *payload, float *output);
1078 
1085 BIGVOICE_DECL void bigvoice_AudioMonoToLiveStereo(const float *input, uint8_t *payload);
1086 
1089 // --------------------------------------------------------------
1094 // --------------------------------------------------------------
1099 
1109 
1116 
1130 BIGVOICE_DECL const char *bigvoice_ProcessJson(struct bigvoice_CClientInstance *client, const char *json_str, int *need_save);
1131 
1137 BIGVOICE_DECL void bigvoice_FreeJsonAnswer(const char *json_str);
1138 
1151 
1447 #if BIGVOICE_HAS_WEBSERVER
1448 // --------------------------------------------------------------
1456 // --------------------------------------------------------------
1475 BIGVOICE_DECL uint64_t bigvoice_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port);
1476 
1477 // --------------------------------------------------------------
1497 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);
1498 
1516 BIGVOICE_DECL uint64_t bigvoice_Webserver(unsigned int listenport, unsigned int listenport_secure, struct bigvoice_CInstance *instance);
1517 
1527 BIGVOICE_DECL int bigvoice_Webserver_Stop(uint64_t id, int timeout_ms);
1528 
1538 
1549 BIGVOICE_DECL void bigvoice_Webserver_SetAppHealth(struct bigvoice_CInstance *instance, int httpcode, const char *contenttype, const char *content);
1550 
1559 BIGVOICE_DECL void bigvoice_Webserver_GetAppHealth(struct bigvoice_CInstance *instance, int* httpcode, char** contenttype, char** content);
1560 
1567 
1572 #define SOUND4_INVALID_WEBSERVER_ID ((uint64_t)-1)
1573 
1577 #define SOUND4_WEBSERVER_HTTP_OK (1<<0)
1581 #define SOUND4_WEBSERVER_HTTPS_OK (1<<1)
1582 
1584 #endif // BIGVOICE_HAS_WEBSERVER
1585 
1586 #ifdef __cplusplus
1587 } // extern "C"
1588 #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.