SOUND4 BIGVOICE.CL Library [0.9.8]
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 
68 // --------------------------------------------------------------
87 // --------------------------------------------------------------
140 // --------------------------------------------------------------
141 
142 // --------------------------------------------------------------
154 #define BIGVOICE_AUDIOFRAME_COUNT 12
160 #define BIGVOICE_CHANNEL_COUNT 1
166 #define BIGVOICE_AUDIO_INPUT_COUNT 1
172 #define BIGVOICE_AUDIO_OUTPUT_COUNT 1
178 #define BIGVOICE_SAMPLE_RATE 48000
179 
186 
200 
210 
219 
229 
239 
248 
253  none = 0,
254  fatal = 1,
255  error = 2,
256  warning = 3,
257  info = 4,
258  verbose = 5,
259  verbose2 = 6,
260  verbose3 = 7,
261  verbose4 = 8,
262  verbose5 = 9,
263 };
264 
271 typedef void (*bigvoice_loggerfn) (enum bigvoice_LogSeverity, const char *);
272 
283 
292 
295 // --------------------------------------------------------------
301 // --------------------------------------------------------------
305 struct bigvoice_CInstance;
306 
310 struct bigvoice_CParameters;
311 
320 
325 
337 BIGVOICE_DECL void bigvoice_SetParameter(struct bigvoice_CParameters *params, const char *name, const char *value);
338 
344 BIGVOICE_DECL const char *bigvoice_GetParameter(struct bigvoice_CParameters *params, const char *name);
345 
352 
361  const char *LoginKey,
362  const char *RadioName,
363  const char *AWS_Access_ID,
364  const char *AWS_Access_Secret,
365  const char *save_path
366  );
367 
376  const char *LoginKey,
377  const char *RadioName,
378  const char *AWS_Access_ID,
379  const char *AWS_Access_Secret,
380  const char *save_path,
381  const struct bigvoice_CParameters *parameters
382  );
383 
429  const char *LoginKey,
430  const char *RadioName,
431  const char *AWS_Access_ID,
432  const char *AWS_Access_Secret,
433  const char *save_path,
434  const struct bigvoice_CParameters *parameters,
435  unsigned int frames_per_chunk
436  );
437 
450 
461 
468 
471 #if BIGVOICE_HAS_CLOUDBUS
472 // --------------------------------------------------------------
481 struct bigvoice_CBus;
482 
489 
496 
507 
508 
510 #endif // BIGVOICE_HAS_CLOUDBUS
511 
512 // --------------------------------------------------------------
535 // --------------------------------------------------------------
536 
537 // OS dependent filesystem path char type
538 #ifdef _WIN32
539  typedef wchar_t fs_char;
540 #else // !_WIN32
541  typedef char fs_char;
542 #endif // !_WIN32
543 
551 typedef char * (*bigvoice_storage_reader) (const fs_char *filename, void* userdata);
552 
559 typedef void (*bigvoice_storage_reader_free) (char *content, void* userdata);
560 
569 typedef int (*bigvoice_storage_writer) (const fs_char *filename, const char *content, void* userdata);
570 
578 typedef int (*bigvoice_storage_exists) (const fs_char *filename, void* userdata);
579 
587 typedef fs_char** (*bigvoice_storage_getall) (void* userdata);
588 
595 typedef void (*bigvoice_storage_getall_free) (fs_char**all, void* userdata);
596 
604 typedef int (*bigvoice_storage_remove) (const fs_char *filename, void* userdata);
605 
614 typedef int (*bigvoice_storage_rename) (const fs_char *from, const fs_char *to, void* userdata);
615 
635  , bigvoice_storage_writer writer
636  , bigvoice_storage_exists exists
638  , bigvoice_storage_remove remove
639  , bigvoice_storage_rename rename
640  , int IsReadOnly
641  , void* userdata
642  );
643 
651 };
652 
661 BIGVOICE_DECL void bigvoice_PresetManager_InformChange(struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind);
662 
665 // --------------------------------------------------------------
673 // --------------------------------------------------------------
674 
688 BIGVOICE_DECL void bigvoice_SetMetadata(struct bigvoice_CInstance *instance, const char* key, const char* value);
689 
698 
705 BIGVOICE_DECL void bigvoice_FreeMetadataInfos(struct bigvoice_CInstance *instance, const char** infos);
706 
709 // --------------------------------------------------------------
714 // --------------------------------------------------------------
715 
728 BIGVOICE_DECL void bigvoice_StartUpdateThread(struct bigvoice_CInstance *instance, unsigned int port);
729 
736 
744 BIGVOICE_DECL int bigvoice_WaitUpdateThreadReady(struct bigvoice_CInstance *instance, int milliseconds);
745 
748 // --------------------------------------------------------------
753 // --------------------------------------------------------------
775 BIGVOICE_DECL void bigvoice_ProcessAudio(struct bigvoice_CInstance *instance, const float *input, float *output );
776 
796  , float const * const *input
797  , float * const *output);
798 
812 
826 
835 
838 // --------------------------------------------------------------
845 // --------------------------------------------------------------
846  #ifdef _MSC_VER
847  #define __BYTE_ORDER__ REG_DWORD
848  #define __ORDER_LITTLE_ENDIAN__ REG_DWORD_LITTLE_ENDIAN
849  #define __ORDER_BIG_ENDIAN__ REG_DWORD_BIG_ENDIAN
850  #endif
851 
865 
866  // Native definitions, only links to the physical ones
867  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
872  #else
877  #endif
878 };
879 
887 
895 
903 
904 
912 
923 BIGVOICE_DECL unsigned int bigvoice_AddAudio(struct bigvoice_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum bigvoice_SampleFormat fmt );
924 
932 
940 
950 BIGVOICE_DECL unsigned int bigvoice_GetAudio(struct bigvoice_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum bigvoice_SampleFormat fmt );
951 
955 // --------------------------------------------------------------
959 // --------------------------------------------------------------
970 BIGVOICE_DECL void bigvoice_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum bigvoice_SampleFormat fmt);
971 
982 BIGVOICE_DECL void bigvoice_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum bigvoice_SampleFormat fmt);
983 
993 BIGVOICE_DECL void bigvoice_StereoToMono(const float *input, float *output, size_t nFrame);
994 
1004 BIGVOICE_DECL void bigvoice_MonoToStereo(const float *input, float *output, size_t nFrame);
1005 
1016 BIGVOICE_DECL void bigvoice_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame);
1017 
1028 BIGVOICE_DECL void bigvoice_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame);
1029 
1036 BIGVOICE_DECL void bigvoice_AudioMonoFromLiveStereo(const uint8_t *payload, float *output);
1037 
1044 BIGVOICE_DECL void bigvoice_AudioMonoToLiveStereo(const float *input, uint8_t *payload);
1045 
1048 // --------------------------------------------------------------
1053 // --------------------------------------------------------------
1058 
1068 
1075 
1089 BIGVOICE_DECL const char *bigvoice_ProcessJson(struct bigvoice_CClientInstance *client, const char *json_str, int *need_save);
1090 
1096 BIGVOICE_DECL void bigvoice_FreeJsonAnswer(const char *json_str);
1097 
1110 
1406 #if BIGVOICE_HAS_WEBSERVER
1407 // --------------------------------------------------------------
1415 // --------------------------------------------------------------
1434 BIGVOICE_DECL uint64_t bigvoice_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port);
1435 
1436 // --------------------------------------------------------------
1456 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);
1457 
1475 BIGVOICE_DECL uint64_t bigvoice_Webserver(unsigned int listenport, unsigned int listenport_secure, struct bigvoice_CInstance *instance);
1476 
1486 BIGVOICE_DECL int bigvoice_Webserver_Stop(uint64_t id, int timeout_ms);
1487 
1497 
1502 #define SOUND4_INVALID_WEBSERVER_ID ((uint64_t)-1)
1503 
1507 #define SOUND4_WEBSERVER_HTTP_OK (1<<0)
1511 #define SOUND4_WEBSERVER_HTTPS_OK (1<<1)
1512 
1514 #endif // BIGVOICE_HAS_WEBSERVER
1515 
1516 #ifdef __cplusplus
1517 } // extern "C"
1518 #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)
unsigned int bigvoice_GetChunkSizeInFrames()
unsigned int bigvoice_GetAudioOutputCount()
unsigned int bigvoice_GetSampleRate()
@ verbose5
@ warning
@ verbose4
@ verbose2
@ verbose3
@ verbose
void bigvoice_FreeParameterValue(const char *value)
struct bigvoice_CInstance * bigvoice_InitProcess2(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path, const struct bigvoice_CParameters *parameters)
struct bigvoice_CInstance * bigvoice_InitProcess(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path)
int bigvoice_TerminateProcess(struct bigvoice_CInstance *instance)
void bigvoice_FreeParameters(struct bigvoice_CParameters *params)
void bigvoice_ExitProcess(struct bigvoice_CInstance *instance)
struct bigvoice_CInstance * bigvoice_InitProcess3(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path, const struct bigvoice_CParameters *parameters, unsigned int frames_per_chunk)
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)
void bigvoice_FreeMetadataInfos(struct bigvoice_CInstance *instance, const char **infos)
void bigvoice_SetMetadata(struct bigvoice_CInstance *instance, const char *key, const char *value)
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)
#define BIGVOICE_DECL