23 #include <libloaderapi.h>
25 #error "Unsupported OS"
33 #include <stringapiset.h>
36 #define fs_strdup wcsdup
39 #define fs_strdup strdup
44 static char *bigvoice_custom_reader(
const fs_char *filename,
void* userdata);
45 static void bigvoice_custom_reader_free(
char *content,
void* userdata);
46 static int bigvoice_custom_writer(
const fs_char *filename,
const char *content,
void* userdata);
47 static int bigvoice_custom_exists(
const fs_char *filename,
void* userdata);
48 static fs_char** bigvoice_custom_getall(
void* userdata);
49 static void bigvoice_custom_getall_free(
fs_char** all,
void* userdata);
50 static int bigvoice_custom_remove(
const fs_char *filename,
void* userdata);
51 static int bigvoice_custom_rename(
const fs_char *from,
const fs_char *to,
void* userdata);
92 operator bool()
const {
return (m_ptr!=NULL); }
93 bool IsOk()
const {
return m_ptr!=NULL; }
94 operator T* ()
const {
return reinterpret_cast<T*
>(m_ptr); }
110 operator bool()
const {
111 return (m_lib!=NULL);
114 return (m_lib!=NULL);
119 #ifndef __SANITIZE_ADDRESS__
125 bool Load(
const std::filesystem::path& dynlib)
128 m_lib=dlopen(dynlib.c_str(), RTLD_NOW|RTLD_LOCAL);
131 template <
typename T>
132 DynFuncHolder<T>
GetSymbol(
const std::string& name) {
133 auto ptr=dlsym(m_lib, name.c_str());
135 throw std::runtime_error(
"Missing function in library");
137 return DynFuncHolder<T>(ptr);
139 template <
typename T>
141 auto ptr=dlsym(m_lib, name.c_str());
142 return DynFuncHolder<T>(ptr);
147 auto rp=realpath(
info.dli_fname, NULL);
148 std::filesystem::path p(rp);
153 bool Load(
const std::filesystem::path& dynlib, uint32_t loadflags = LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR|LOAD_LIBRARY_SEARCH_APPLICATION_DIR|LOAD_LIBRARY_SEARCH_USER_DIRS|LOAD_LIBRARY_SEARCH_SYSTEM32)
156 m_lib=LoadLibraryExW(dynlib.c_str(), NULL, loadflags);
163 #if defined(SOUND4_CALL_FREELIBRARYANDEXITTHREAD)
164 FreeLibraryAndExitThread(m_lib, 0);
165 #elif defined(SOUND4_CALL_FREELIBRARY)
171 template <
typename T>
173 auto ptr=GetProcAddress(m_lib, name.c_str());
175 throw std::runtime_error(
"Missing function in library");
179 template <
typename T>
181 auto ptr=GetProcAddress(m_lib, name.c_str());
185 static wchar_t path[MAX_PATH]={};
187 if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
188 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
191 if (GetModuleFileNameW(hm, path, MAX_PATH) > 0) {
192 return std::filesystem::path(path);
262 #if BIGVOICE_HAS_WEBSERVER
288 #if BIGVOICE_HAS_CLOUDBUS
298 #if BIGVOICE_HAS_WEBSERVER
312 bool Load(
const std::filesystem::path& path = {}) {
313 std::string filename;
315 filename=
"libsound4.bigvoice.cl.so";
317 filename=
"sound4.bigvoice.cl.dll";
321 if (!path.empty() && !m_lib.
Load(path / filename)) {
323 }
else if (!m_lib.
IsOk()) {
327 if (!m_lib.
IsOk() && thisdir.filename()==
"bin") {
328 auto libdir = thisdir.parent_path() /
"lib";
329 m_lib.
Load(libdir / filename);
334 m_lib.
Load(thisdir / filename);
338 m_lib.
Load(std::filesystem::current_path() / filename);
390 #if BIGVOICE_HAS_WEBSERVER
402 }
catch (std::runtime_error& ) {
420 #if BIGVOICE_HAS_CLOUDBUS
430 #if BIGVOICE_HAS_WEBSERVER
437 }
catch (std::runtime_error& ) {
458 static constexpr
const char *process_name =
"SOUND4 BIGVOICE.CL";
459 static constexpr
const char *process_shortname =
"bigvoice";
496 static inline std::string WStringToUTF8(
const std::wstring& wstr) {
497 if (wstr.empty())
return {};
498 int size = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (
int)wstr.size(), NULL, 0, NULL, NULL);
499 std::string str(size, 0);
500 WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (
int)wstr.size(), &str[0], size, NULL, NULL);
508 static inline std::wstring UTF8ToWString(
const std::string& str) {
509 if (str.empty())
return std::wstring();
510 int size = MultiByteToWideChar(CP_UTF8, 0, &str[0], (
int)str.size(), NULL, 0);
511 std::wstring wstr(size, 0);
512 MultiByteToWideChar(CP_UTF8, 0, &str[0], (
int)str.size(), &wstr[0], size);
549 static inline void StereoToMono(CDynLib& dynlib,
const float *input,
float *output,
size_t nSpl) {
550 dynlib.StereoToMono(input, output, nSpl);
552 static inline void MonoToStereo(CDynLib& dynlib,
const float *input,
float *output,
size_t nSpl) {
553 dynlib.MonoToStereo(input, output, nSpl);
555 static inline void StereoToMono_Planar(CDynLib& dynlib,
const float *inputL,
const float *inputR,
float *output,
size_t nSpl) {
556 dynlib.StereoToMono_Planar(inputL, inputR, output, nSpl);
558 static inline void MonoToStereo_Planar(CDynLib& dynlib,
const float *input,
float *outputL,
float *outputR,
size_t nSpl) {
559 dynlib.MonoToStereo_Planar(input, outputL, outputR, nSpl);
561 static inline void AudioMonoFromLiveStereo(CDynLib& dynlib,
const uint8_t *payload,
float *output) {
562 dynlib.AudioMonoFromLiveStereo(payload, output);
564 static inline void AudioMonoToLiveStereo(CDynLib& dynlib,
const float *input, uint8_t *payload) {
565 dynlib.AudioMonoToLiveStereo(input, payload);
575 static inline std::string GetVersion(CDynLib& dynlib)
577 return std::string(dynlib.GetVersion());
590 static inline unsigned int GetChunkSizeInFrames(CDynLib& dynlib)
592 return dynlib.GetChunkSizeInFrames();
603 static inline std::vector<unsigned int> GetPossibleChunkSizeInFrames(CDynLib& dynlib)
605 std::vector<unsigned int> list;
606 if (dynlib.GetPossibleChunkSizeInFrames) {
607 for (
unsigned int* src=dynlib.GetPossibleChunkSizeInFrames();*src;src++) {
608 list.push_back(*src);
623 static inline unsigned int GetChannelCount(CDynLib& dynlib)
625 return dynlib.GetChannelCount();
636 static inline unsigned int GetAudioInputCount(CDynLib& dynlib)
638 return dynlib.GetAudioInputCount();
649 static inline unsigned int GetAudioOutputCount(CDynLib& dynlib)
651 return dynlib.GetAudioOutputCount();
661 static inline unsigned int GetSampleRate(CDynLib& dynlib)
663 return dynlib.GetSampleRate();
671 static inline void SanityCheck(CDynLib& dynlib,
bool a_bCheckFrames =
true)
675 throw std::runtime_error(
"Bad library sampling rate");
677 if (a_bCheckFrames && dynlib.GetChunkSizeInFrames()!=
ChunkFrames) {
678 throw std::runtime_error(
"Bad library frame size");
681 throw std::runtime_error(
"Bad library channel count");
684 throw std::runtime_error(
"Bad library input count");
687 throw std::runtime_error(
"Bad library output count");
697 static inline std::string GetFormatName(CDynLib& dynlib,
const SampleFormat fmt)
699 return std::string(dynlib.GetFormatName(fmt));
708 static inline SampleFormat GetFormatFromName(CDynLib& dynlib,
const std::string& name)
710 return dynlib.GetFormatFromName(name.c_str());
719 static inline unsigned int GetBytesFromFormat(CDynLib& dynlib,
const SampleFormat fmt)
721 return dynlib.GetBytesFromFormat(fmt);
739 _log_cb(severity, std::string(c_msg));
745 static inline void SetLogSeverity(CDynLib& dynlib,
LogSeverity severity)
747 dynlib.SetLogSeverity(severity);
752 static inline void SetLoggerCallback(CDynLib& dynlib,
log_cb_t cb)
755 dynlib.SetLoggerCallback(&_log_cb_c);
758 #if BIGVOICE_HAS_CLOUDBUS
770 if (m_bus && m_dynlib.
FreeBus) {
792 virtual bool Exists(
const std::filesystem::path &name) = 0;
793 virtual bool Remove(
const std::filesystem::path &name) = 0;
794 virtual bool Rename(
const std::filesystem::path &from,
const std::filesystem::path &to) = 0;
795 virtual std::vector<std::filesystem::path>
GetAll() = 0;
796 virtual std::string
Read(
const std::filesystem::path &filename) = 0;
797 virtual bool Write(
const std::filesystem::path &filename,
const std::string &content) =0;
813 if (!params)
throw std::bad_alloc();
829 bool IsOk()
const {
return instance!=
nullptr; }
837 void SetParam(
const std::string& name,
const std::string& value)
840 m_dynlib.
SetParameter(params, name.c_str(), value.c_str());
850 auto c_value=m_dynlib.
GetParameter(params, name.c_str());
851 std::string ret(c_value);
855 #if BIGVOICE_HAS_CLOUDBUS
878 if (!preset_manager)
return;
882 bigvoice_custom_reader,
883 bigvoice_custom_reader_free,
884 bigvoice_custom_writer,
885 bigvoice_custom_exists,
886 bigvoice_custom_getall,
887 bigvoice_custom_getall_free,
888 bigvoice_custom_remove,
889 bigvoice_custom_rename,
909 bool Create(
const std::string& LoginKey,
const std::string& RadioName,
const std::string& Access_Key_ID,
const std::string& Access_Key_Secret,
const std::filesystem::path& save_path,
int json_port = 0,
unsigned int frames_per_chunk=12)
912 std::string l_save_path;
913 if (!save_path.empty()) {
914 l_save_path = save_path.u8string();
917 instance = m_dynlib.
InitProcess3(LoginKey.c_str(), RadioName.c_str(), Access_Key_ID.c_str(), Access_Key_Secret.c_str(), l_save_path.c_str(), params, frames_per_chunk);
918 }
else if (frames_per_chunk!=12) {
921 instance = m_dynlib.
InitProcess2(LoginKey.c_str(), RadioName.c_str(), Access_Key_ID.c_str(), Access_Key_Secret.c_str(), l_save_path.c_str(), params);
923 if (!instance)
return false;
924 if (!init_metadata.empty()) {
925 for (
auto&& [key,value]: init_metadata) {
926 m_dynlib.
SetMetadata(instance, key.c_str(), value.c_str());
928 init_metadata.clear();
930 update_thread = std::thread([
this, json_port](){
988 m_dynlib.
SetMetadata(instance, key.c_str(), value);
990 init_metadata.push_back( {key, value} );
1009 typedef const char* pchar;
1010 pchar* keyvalue=
new pchar[2*list.size()+1];
1012 for (
auto&& [key,value]: list) {
1013 keyvalue[2*n+0]=key.c_str();
1014 keyvalue[2*n+1]=value;
1017 keyvalue[2*n+0]=
nullptr;
1023 for (
auto&& [key,value]: list) {
1028 for (
auto&& [key,value]: list) {
1030 init_metadata.push_back( {key, value} );
1043 std::vector< std::tuple<std::string,std::string> > values;
1047 for (
const char** c_value=c_values; *c_value; ) {
1048 std::string key(*c_value);
1051 std::string descr(*c_value);
1053 values.push_back( {key,descr} );
1067 #if BIGVOICE_HAS_WEBSERVER
1077 webserver = m_dynlib.
Webserver(http_port,https_port,instance);
1119 char* c_contenttype=
nullptr;
1120 char* c_content=
nullptr;
1122 contenttype=c_contenttype;
1137 if (!instance)
return 0;
1148 if (!instance)
return;
1149 #if BIGVOICE_HAS_WEBSERVER
1152 if (update_thread.joinable()) {
1154 update_thread.join();
1185 return reinterpret_cast< std::array<float,InputSampleSize>&
>(*buf);
1202 return reinterpret_cast< std::array<float,OutputSampleSize>&
>(*buf);
1245 template<
typename T>
1249 std::vector<T> output;
1250 unsigned int out_offset=0;
1251 unsigned int in_offset=0;
1252 unsigned int todo = input.size();
1254 unsigned int left =
AddAudio(&input[in_offset], todo);
1256 output.resize(out_offset + out_avail);
1257 GetAudio(&output[out_offset], out_avail);
1258 out_offset+=out_avail;
1259 in_offset += todo-left;
1277 if (!client)
throw std::bad_alloc();
1296 std::string
ProcessJson(
const std::string &request,
bool *NeedSave =
nullptr)
1300 const char *canswer = m_dynlib.
ProcessJson(client, request.c_str(), &need_save);
1301 if (!canswer)
return {};
1302 std::string answer(canswer);
1305 *NeedSave=(need_save!=0);
1323 return std::make_shared<CClient>(instance, m_dynlib);
1327 template<
typename T>
1328 unsigned int AddAudio(
const T* payload,
unsigned int nFrame)
1333 template<
typename T>
1334 unsigned int GetAudio(T* payload,
unsigned int max_nFrame)
1344 std::thread update_thread;
1345 std::vector< std::pair<std::string,std::string> > init_metadata;
1346 #if BIGVOICE_HAS_WEBSERVER
1358 static char *bigvoice_custom_reader(
const fs_char *filename,
void* userdata) {
1360 std::string content=preset_loader->
Read(filename);
1361 return strdup(content.c_str());
1363 static void bigvoice_custom_reader_free(
char *content,
void* userdata) {
1364 if (!content)
return;
1367 static int bigvoice_custom_writer(
const fs_char *filename,
const char *content,
void* userdata) {
1369 auto res=preset_loader->
Write(filename,content);
1372 static int bigvoice_custom_exists(
const fs_char *filename,
void* userdata) {
1374 auto res=preset_loader->
Exists(filename);
1377 static fs_char** bigvoice_custom_getall(
void* userdata) {
1379 auto res=preset_loader->
GetAll();
1381 for (
size_t n=0;n<res.size();n++) {
1384 all[res.size()]=
nullptr;
1387 static void bigvoice_custom_getall_free(
fs_char** all,
void* userdata) {
1389 for (
fs_char** one=all;*one;one++) {
1394 static int bigvoice_custom_remove(
const fs_char *filename,
void* userdata) {
1396 auto res=preset_loader->
Remove(filename);
1399 static int bigvoice_custom_rename(
const fs_char *from,
const fs_char *to,
void* userdata) {
1401 auto res=preset_loader->
Rename(from,to);
bigvoice_CBus * Get() const
Dynamic library interface.
helper::DynFuncHolder< decltype(bigvoice_FreeParameterValue) > FreeParameterValue
helper::DynFuncHolder< decltype(bigvoice_AudioMonoFromLiveStereo) > AudioMonoFromLiveStereo
helper::DynFuncHolder< decltype(bigvoice_Webserver_FreeString) > Webserver_FreeString
helper::DynFuncHolder< decltype(bigvoice_GetAudio) > GetAudio
helper::DynFuncHolder< decltype(bigvoice_GetSampleRate) > GetSampleRate
helper::DynFuncHolder< decltype(bigvoice_ProcessJson) > ProcessJson
helper::DynFuncHolder< decltype(bigvoice_NewClient) > NewClient
helper::DynFuncHolder< decltype(bigvoice_GetBufferOut) > GetBufferOut
helper::DynFuncHolder< decltype(bigvoice_WaitUpdateThreadReady) > WaitUpdateThreadReady
helper::DynFuncHolder< decltype(bigvoice_AudioMonoToLiveStereo) > AudioMonoToLiveStereo
helper::DynFuncHolder< decltype(bigvoice_Webserver_Stop) > Webserver_Stop
helper::DynFuncHolder< decltype(bigvoice_InitProcess3) > InitProcess3
helper::DynFuncHolder< decltype(bigvoice_GetMaxPacketFrame) > GetMaxPacketFrame
helper::DynFuncHolder< decltype(bigvoice_FreeBus) > FreeBus
helper::DynFuncHolder< decltype(bigvoice_InitProcess) > InitProcess
helper::DynFuncHolder< decltype(bigvoice_GetFormatFromName) > GetFormatFromName
helper::DynFuncHolder< decltype(bigvoice_GetVersion) > GetVersion
helper::DynFuncHolder< decltype(bigvoice_SetParameter) > SetParameter
helper::DynFuncHolder< decltype(bigvoice_NewParameters) > NewParameters
helper::DynFuncHolder< decltype(bigvoice_SetLoggerCallback) > SetLoggerCallback
helper::DynFuncHolder< decltype(bigvoice_SetInstanceBus) > SetInstanceBus
helper::DynFuncHolder< decltype(bigvoice_ProcessAudio_Planar) > ProcessAudio_Planar
helper::DynFuncHolder< decltype(bigvoice_AudioConvertTo) > AudioConvertTo
helper::DynFuncHolder< decltype(bigvoice_Webserver) > Webserver
helper::DynFuncHolder< decltype(bigvoice_ExitProcess) > ExitProcess
helper::DynFuncHolder< decltype(bigvoice_SetLogSeverity) > SetLogSeverity
bool Load(const std::filesystem::path &path={})
Loads the library.
helper::DynFuncHolder< decltype(bigvoice_GetProcessChunkFrames) > GetProcessChunkFrames
helper::DynFuncHolder< decltype(bigvoice_Webserver_tcp) > Webserver_tcp
helper::DynFuncHolder< decltype(bigvoice_Webserver_tcp2) > Webserver_tcp2
helper::DynFuncHolder< decltype(bigvoice_FreeJsonAnswer) > FreeJsonAnswer
helper::DynFuncHolder< decltype(bigvoice_StartUpdateThread) > StartUpdateThread
helper::DynFuncHolder< decltype(bigvoice_InitProcess2) > InitProcess2
helper::DynFuncHolder< decltype(bigvoice_GetAudioOutputCount) > GetAudioOutputCount
helper::DynFuncHolder< decltype(bigvoice_GetOutputCount) > GetOutputCount
helper::DynFuncHolder< decltype(bigvoice_Webserver_Status) > Webserver_Status
helper::DynFuncHolder< decltype(bigvoice_GetBufferIn) > GetBufferIn
helper::DynFuncHolder< decltype(bigvoice_PresetManager_InformChange) > PresetManager_InformChange
helper::DynFuncHolder< decltype(bigvoice_StereoToMono) > StereoToMono
helper::DynFuncHolder< decltype(bigvoice_StopUpdateThread) > StopUpdateThread
helper::DynFuncHolder< decltype(bigvoice_SetPresetManager) > SetPresetManager
helper::DynFuncHolder< decltype(bigvoice_GetBytesFromFormat) > GetBytesFromFormat
helper::DynFuncHolder< decltype(bigvoice_SaveState) > SaveState
helper::DynFuncHolder< decltype(bigvoice_FreeMetadataInfos) > FreeMetadataInfos
bool IsOk() const
Check if the library was loaded correctly.
helper::DynFuncHolder< decltype(bigvoice_SetMetadata) > SetMetadata
helper::DynFuncHolder< decltype(bigvoice_GetMetadataInfos) > GetMetadataInfos
helper::DynFuncHolder< decltype(bigvoice_AddAudio) > AddAudio
helper::DynFuncHolder< decltype(bigvoice_DeleteClient) > DeleteClient
helper::DynFuncHolder< decltype(bigvoice_ProcessAudio) > ProcessAudio
helper::DynFuncHolder< decltype(bigvoice_AudioConvertFrom) > AudioConvertFrom
helper::DynFuncHolder< decltype(bigvoice_NewBus) > NewBus
helper::DynFuncHolder< decltype(bigvoice_Webserver_GetAppHealth) > Webserver_GetAppHealth
helper::DynFuncHolder< decltype(bigvoice_StereoToMono_Planar) > StereoToMono_Planar
helper::DynFuncHolder< decltype(bigvoice_MonoToStereo) > MonoToStereo
helper::DynFuncHolder< decltype(bigvoice_GetFormatName) > GetFormatName
helper::DynFuncHolder< decltype(bigvoice_MonoToStereo_Planar) > MonoToStereo_Planar
helper::DynFuncHolder< decltype(bigvoice_GetAudioInputCount) > GetAudioInputCount
helper::DynFuncHolder< decltype(bigvoice_AddPadAudio) > AddPadAudio
helper::DynFuncHolder< decltype(bigvoice_SetMetadataMulti) > SetMetadataMulti
helper::DynFuncHolder< decltype(bigvoice_Webserver_SetAppHealth) > Webserver_SetAppHealth
helper::DynFuncHolder< decltype(bigvoice_GetParameter) > GetParameter
helper::DynFuncHolder< decltype(bigvoice_GetChunkSizeInFrames) > GetChunkSizeInFrames
helper::DynFuncHolder< decltype(bigvoice_TerminateProcess) > TerminateProcess
helper::DynFuncHolder< decltype(bigvoice_FreeParameters) > FreeParameters
helper::DynFuncHolder< decltype(bigvoice_GetPossibleChunkSizeInFrames) > GetPossibleChunkSizeInFrames
helper::DynFuncHolder< decltype(bigvoice_GetEstimatedDelay) > GetEstimatedDelay
helper::DynFuncHolder< decltype(bigvoice_GetChannelCount) > GetChannelCount
std::string ProcessJson(const std::string &request, bool *NeedSave=nullptr)
Process a JSON request and returns the answer.
CClient(const CInstance &)=delete
CClient(bigvoice_CInstance *instance, CDynLib &dynlib)
CClient & operator=(const CInstance &)=delete
void SetMetadataMulti(const std::unordered_map< std::string, const char * > &list)
std::shared_ptr< CClient > NewClient()
unsigned int AddAudio(const T *payload, unsigned int nFrame)
void SetWebServerAppHealth(int httpcode, const std::string &contenttype, const std::string &content)
std::array< float, InputSampleSize > & GetBufferIn()
void SetBus(const CBus &bus)
void SetMetadata(const std::string &key, const char *value)
CInstance(CDynLib &dynlib)
CInstance(const CInstance &)=delete
std::vector< T > ProcessAnyAudio(const std::vector< T > input)
void GetWebServerAppHealth(int &httpcode, std::string &contenttype, std::string &content)
void SetParam(const std::string &name, const std::string &value)
std::vector< std::tuple< std::string, std::string > > GetMetadataInfos()
std::string GetParam(const std::string &name)
unsigned int GetChunkFrames()
std::array< float, OutputSampleSize > & GetBufferOut()
unsigned int GetAudio(T *payload, unsigned int max_nFrame)
bool StartWebServer(int http_port, int https_port=0)
void ProcessAudio_Planar(float const *const *input, float *const *output)
CInstance & operator=(const CInstance &)=delete
void SetPresetManager(CPresetLoader *preset_manager)
virtual void OnUpdateThreadStart()
virtual void OnUpdateThreadStop()
bool Create(const std::string &LoginKey, const std::string &RadioName, const std::string &Access_Key_ID, const std::string &Access_Key_Secret, const std::filesystem::path &save_path, int json_port=0, unsigned int frames_per_chunk=12)
unsigned int GetEstimatedDelay()
void PresetManager_InformChange(const std::filesystem::path &relative_path, PresetChange_Kind change_kind)
virtual std::string Read(const std::filesystem::path &filename)=0
virtual bool Write(const std::filesystem::path &filename, const std::string &content)=0
virtual std::vector< std::filesystem::path > GetAll()=0
virtual bool Exists(const std::filesystem::path &name)=0
virtual bool Remove(const std::filesystem::path &name)=0
virtual ~CPresetLoader()=default
virtual bool IsReadOnly()=0
virtual bool Rename(const std::filesystem::path &from, const std::filesystem::path &to)=0
Helper to load dynamic library.
DynFuncHolder< T > GetSymbol_safe(const std::string &name)
CDynLoader & operator=(CDynLoader const &)=delete
static std::filesystem::path GetThisLibraryPath(void)
DynFuncHolder< T > GetSymbol(const std::string &name)
CDynLoader(const CDynLoader &)=delete
bool Load(const std::filesystem::path &dynlib, uint32_t loadflags=LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR|LOAD_LIBRARY_SEARCH_APPLICATION_DIR|LOAD_LIBRARY_SEARCH_USER_DIRS|LOAD_LIBRARY_SEARCH_SYSTEM32)
CDynLoader(CDynLoader &&)=default
Helper to wrap a function pointer.
DynFuncHolder(DynFunc_t a_ptr)
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)
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
@ S16_NATIVE
16-bit signed integer, native
@ S32_NATIVE
32-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)
#define BIGVOICE_SAMPLE_RATE
#define BIGVOICE_CHANNEL_COUNT
const char * bigvoice_GetVersion()
unsigned int * bigvoice_GetPossibleChunkSizeInFrames()
unsigned int bigvoice_GetAudioInputCount()
unsigned int bigvoice_GetChannelCount()
void bigvoice_SetLoggerCallback(bigvoice_loggerfn logger)
void bigvoice_SetLogSeverity(enum bigvoice_LogSeverity severity)
#define BIGVOICE_AUDIO_OUTPUT_COUNT
unsigned int bigvoice_GetChunkSizeInFrames()
unsigned int bigvoice_GetAudioOutputCount()
#define BIGVOICE_AUDIO_INPUT_COUNT
#define BIGVOICE_AUDIOFRAME_COUNT
unsigned int bigvoice_GetSampleRate()
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)
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_PresetManager_InformChange(struct bigvoice_CInstance *instance, const fs_char *relative_path, enum bigvoice_PresetChange_Kind change_kind)
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)
#define SOUND4_WEBSERVER_HTTPS_OK
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)
#define SOUND4_WEBSERVER_HTTP_OK
void bigvoice_Webserver_FreeString(char *str)
#define SOUND4_INVALID_WEBSERVER_ID
void bigvoice_Webserver_GetAppHealth(struct bigvoice_CInstance *instance, int *httpcode, char **contenttype, char **content)
const size_t InputSampleSize
const size_t InputChannels
std::function< void(LogSeverity, const std::string &)> log_cb_t
bigvoice_SampleFormat SampleFormat
const size_t OutputSampleSize
const size_t OutputChannels
std::function< void(LogSeverity, const std::string &)> log_cb_t
#define fs_strdup
helper for OS dependant file name copy