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 *plughost_custom_reader(
const fs_char *filename,
void* userdata);
45 static void plughost_custom_reader_free(
char *content,
void* userdata);
46 static int plughost_custom_writer(
const fs_char *filename,
const char *content,
void* userdata);
47 static int plughost_custom_exists(
const fs_char *filename,
void* userdata);
48 static fs_char** plughost_custom_getall(
void* userdata);
49 static void plughost_custom_getall_free(
fs_char** all,
void* userdata);
50 static int plughost_custom_remove(
const fs_char *filename,
void* userdata);
51 static int plughost_custom_rename(
const fs_char *from,
const fs_char *to,
void* userdata);
92 bool IsOk()
const {
return m_ptr!=NULL; }
93 operator T* ()
const {
return reinterpret_cast<T*
>(m_ptr); }
109 operator bool()
const {
110 return (m_lib!=NULL);
113 return (m_lib!=NULL);
118 #ifndef __SANITIZE_ADDRESS__
124 bool Load(
const std::filesystem::path& dynlib)
127 m_lib=dlopen(dynlib.c_str(), RTLD_NOW|RTLD_LOCAL);
130 template <
typename T>
131 DynFuncHolder<T>
GetSymbol(
const std::string& name) {
132 auto ptr=dlsym(m_lib, name.c_str());
134 throw std::runtime_error(
"Missing function in library");
136 return DynFuncHolder<T>(ptr);
141 auto rp=realpath(
info.dli_fname, NULL);
142 std::filesystem::path p(rp);
147 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)
150 m_lib=LoadLibraryExW(dynlib.c_str(), NULL, loadflags);
157 #if defined(SOUND4_CALL_FREELIBRARYANDEXITTHREAD)
158 FreeLibraryAndExitThread(m_lib, 0);
159 #elif defined(SOUND4_CALL_FREELIBRARY)
165 template <
typename T>
167 auto ptr=GetProcAddress(m_lib, name.c_str());
169 throw std::runtime_error(
"Missing function in library");
174 static wchar_t path[MAX_PATH]={};
176 if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
177 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
180 if (GetModuleFileNameW(hm, path, MAX_PATH) > 0) {
181 return std::filesystem::path(path);
251 #if PLUGHOST_HAS_WEBSERVER
277 #if PLUGHOST_HAS_CLOUDBUS
291 bool Load(
const std::filesystem::path& path = std::filesystem::current_path()) {
292 std::string filename;
294 filename=
"libsound4.plughost.cl.so";
296 filename=
"sound4.plughost.cl.dll";
300 m_lib.
Load(p.native());
305 m_lib.
Load(p.native());
356 #if PLUGHOST_HAS_WEBSERVER
368 }
catch (std::runtime_error& ) {
386 #if PLUGHOST_HAS_CLOUDBUS
388 NewBus = m_lib.
GetSymbol< decltype(plughost_NewBus ) >(
"plughost_NewBus" );
389 FreeBus = m_lib.
GetSymbol< decltype(plughost_FreeBus ) >(
"plughost_FreeBus" );
390 SetInstanceBus = m_lib.
GetSymbol< decltype(plughost_SetInstanceBus ) >(
"plughost_SetInstanceBus" );
392 }
catch (std::runtime_error& ) {
413 static constexpr
const char *process_name =
"SOUND4 Plugin Host";
414 static constexpr
const char *process_shortname =
"plughost";
451 static inline std::string WStringToUTF8(
const std::wstring& wstr) {
452 if (wstr.empty())
return {};
453 int size = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (
int)wstr.size(), NULL, 0, NULL, NULL);
454 std::string str(size, 0);
455 WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (
int)wstr.size(), &str[0], size, NULL, NULL);
463 static inline std::wstring UTF8ToWString(
const std::string& str) {
464 if (str.empty())
return std::wstring();
465 int size = MultiByteToWideChar(CP_UTF8, 0, &str[0], (
int)str.size(), NULL, 0);
466 std::wstring wstr(size, 0);
467 MultiByteToWideChar(CP_UTF8, 0, &str[0], (
int)str.size(), &wstr[0], size);
504 static inline void StereoToMono(CDynLib& dynlib,
const float *input,
float *output,
size_t nSpl) {
505 dynlib.StereoToMono(input, output, nSpl);
507 static inline void MonoToStereo(CDynLib& dynlib,
const float *input,
float *output,
size_t nSpl) {
508 dynlib.MonoToStereo(input, output, nSpl);
510 static inline void StereoToMono_Planar(CDynLib& dynlib,
const float *inputL,
const float *inputR,
float *output,
size_t nSpl) {
511 dynlib.StereoToMono_Planar(inputL, inputR, output, nSpl);
513 static inline void MonoToStereo_Planar(CDynLib& dynlib,
const float *input,
float *outputL,
float *outputR,
size_t nSpl) {
514 dynlib.MonoToStereo_Planar(input, outputL, outputR, nSpl);
516 static inline void AudioMonoFromLiveStereo(CDynLib& dynlib,
const uint8_t *payload,
float *output) {
517 dynlib.AudioMonoFromLiveStereo(payload, output);
519 static inline void AudioMonoToLiveStereo(CDynLib& dynlib,
const float *input, uint8_t *payload) {
520 dynlib.AudioMonoToLiveStereo(input, payload);
530 static inline std::string GetVersion(CDynLib& dynlib)
532 return std::string(dynlib.GetVersion());
545 static inline unsigned int GetChunkSizeInFrames(CDynLib& dynlib)
547 return dynlib.GetChunkSizeInFrames();
558 static inline std::vector<unsigned int> GetPossibleChunkSizeInFrames(CDynLib& dynlib)
560 std::vector<unsigned int> list;
561 if (dynlib.GetPossibleChunkSizeInFrames) {
562 for (
unsigned int* src=dynlib.GetPossibleChunkSizeInFrames();*src;src++) {
563 list.push_back(*src);
578 static inline unsigned int GetChannelCount(CDynLib& dynlib)
580 return dynlib.GetChannelCount();
591 static inline unsigned int GetAudioInputCount(CDynLib& dynlib)
593 return dynlib.GetAudioInputCount();
604 static inline unsigned int GetAudioOutputCount(CDynLib& dynlib)
606 return dynlib.GetAudioOutputCount();
616 static inline unsigned int GetSampleRate(CDynLib& dynlib)
618 return dynlib.GetSampleRate();
626 static inline void SanityCheck(CDynLib& dynlib,
bool a_bCheckFrames =
true)
630 throw std::runtime_error(
"Bad library sampling rate");
632 if (a_bCheckFrames && dynlib.GetChunkSizeInFrames()!=
ChunkFrames) {
633 throw std::runtime_error(
"Bad library frame size");
636 throw std::runtime_error(
"Bad library channel count");
639 throw std::runtime_error(
"Bad library input count");
642 throw std::runtime_error(
"Bad library output count");
652 static inline std::string GetFormatName(CDynLib& dynlib,
const SampleFormat fmt)
654 return std::string(dynlib.GetFormatName(fmt));
663 static inline SampleFormat GetFormatFromName(CDynLib& dynlib,
const std::string& name)
665 return dynlib.GetFormatFromName(name.c_str());
674 static inline unsigned int GetBytesFromFormat(CDynLib& dynlib,
const SampleFormat fmt)
676 return dynlib.GetBytesFromFormat(fmt);
694 _log_cb(severity, std::string(c_msg));
700 static inline void SetLogSeverity(CDynLib& dynlib,
LogSeverity severity)
702 dynlib.SetLogSeverity(severity);
707 static inline void SetLoggerCallback(CDynLib& dynlib,
log_cb_t cb)
710 dynlib.SetLoggerCallback(&_log_cb_c);
713 #if PLUGHOST_HAS_CLOUDBUS
716 CBus(CDynLib& dynlib)
719 if (m_dynlib.NewBus) {
720 m_bus=m_dynlib.NewBus();
725 if (m_bus && m_dynlib.FreeBus) {
726 m_dynlib.FreeBus(m_bus);
730 plughost_CBus *Get()
const {
return m_bus; }
733 plughost_CBus *m_bus;
747 virtual bool Exists(
const std::filesystem::path &name) = 0;
748 virtual bool Remove(
const std::filesystem::path &name) = 0;
749 virtual bool Rename(
const std::filesystem::path &from,
const std::filesystem::path &to) = 0;
750 virtual std::vector<std::filesystem::path>
GetAll() = 0;
751 virtual std::string
Read(
const std::filesystem::path &filename) = 0;
752 virtual bool Write(
const std::filesystem::path &filename,
const std::string &content) =0;
768 if (!params)
throw std::bad_alloc();
784 bool IsOk()
const {
return instance!=
nullptr; }
792 void SetParam(
const std::string& name,
const std::string& value)
795 m_dynlib.
SetParameter(params, name.c_str(), value.c_str());
805 auto c_value=m_dynlib.
GetParameter(params, name.c_str());
806 std::string ret(c_value);
810 #if PLUGHOST_HAS_CLOUDBUS
814 void SetBus(
const CBus& bus) {
816 if (m_dynlib.SetInstanceBus) {
817 m_dynlib.SetInstanceBus(params,bus.Get());
833 if (!preset_manager)
return;
837 plughost_custom_reader,
838 plughost_custom_reader_free,
839 plughost_custom_writer,
840 plughost_custom_exists,
841 plughost_custom_getall,
842 plughost_custom_getall_free,
843 plughost_custom_remove,
844 plughost_custom_rename,
864 bool Create(
const std::string& LoginKey,
const std::string& RadioName,
const std::string& AWS_Access_ID,
const std::string& AWS_Access_Secret,
const std::filesystem::path& save_path,
int json_port = 0,
unsigned int frames_per_chunk=64)
867 std::string l_save_path;
868 if (!save_path.empty()) {
869 l_save_path = save_path.u8string();
872 instance = m_dynlib.
InitProcess3(LoginKey.c_str(), RadioName.c_str(), AWS_Access_ID.c_str(), AWS_Access_Secret.c_str(), l_save_path.c_str(), params, frames_per_chunk);
873 }
else if (frames_per_chunk!=64) {
876 instance = m_dynlib.
InitProcess2(LoginKey.c_str(), RadioName.c_str(), AWS_Access_ID.c_str(), AWS_Access_Secret.c_str(), l_save_path.c_str(), params);
878 if (!instance)
return false;
879 if (!init_metadata.empty()) {
880 for (
auto&& [key,value]: init_metadata) {
881 m_dynlib.
SetMetadata(instance, key.c_str(), value.c_str());
883 init_metadata.clear();
885 update_thread = std::thread([
this, json_port](){
943 m_dynlib.
SetMetadata(instance, key.c_str(), value);
945 init_metadata.push_back( {key, value} );
957 std::vector< std::tuple<std::string,std::string> > values;
961 for (
const char** c_value=c_values; *c_value; ) {
962 std::string key(*c_value);
965 std::string descr(*c_value);
967 values.push_back( {key,descr} );
981 #if PLUGHOST_HAS_WEBSERVER
991 webserver = m_dynlib.
Webserver(http_port,https_port,instance);
1026 if (!instance)
return 0;
1037 if (!instance)
return;
1038 #if PLUGHOST_HAS_WEBSERVER
1041 if (update_thread.joinable()) {
1043 update_thread.join();
1074 return reinterpret_cast< std::array<float,InputSampleSize>&
>(*buf);
1091 return reinterpret_cast< std::array<float,OutputSampleSize>&
>(*buf);
1134 template<
typename T>
1138 std::vector<T> output;
1139 unsigned int out_offset=0;
1140 unsigned int in_offset=0;
1141 unsigned int todo = input.size();
1143 unsigned int left =
AddAudio(&input[in_offset], todo);
1145 output.resize(out_offset + out_avail);
1146 GetAudio(&output[out_offset], out_avail);
1147 out_offset+=out_avail;
1148 in_offset += todo-left;
1166 if (!client)
throw std::bad_alloc();
1185 std::string
ProcessJson(
const std::string &request,
bool *NeedSave =
nullptr)
1189 const char *canswer = m_dynlib.
ProcessJson(client, request.c_str(), &need_save);
1190 if (!canswer)
return {};
1191 std::string answer(canswer);
1194 *NeedSave=(need_save!=0);
1212 return std::make_shared<CClient>(instance, m_dynlib);
1216 template<
typename T>
1217 unsigned int AddAudio(
const T* payload,
unsigned int nFrame)
1222 template<
typename T>
1223 unsigned int GetAudio(T* payload,
unsigned int max_nFrame)
1233 std::thread update_thread;
1234 std::vector< std::pair<std::string,std::string> > init_metadata;
1235 #if PLUGHOST_HAS_WEBSERVER
1247 static char *plughost_custom_reader(
const fs_char *filename,
void* userdata) {
1249 std::string content=preset_loader->
Read(filename);
1250 return strdup(content.c_str());
1252 static void plughost_custom_reader_free(
char *content,
void* userdata) {
1253 if (!content)
return;
1256 static int plughost_custom_writer(
const fs_char *filename,
const char *content,
void* userdata) {
1258 auto res=preset_loader->
Write(filename,content);
1261 static int plughost_custom_exists(
const fs_char *filename,
void* userdata) {
1263 auto res=preset_loader->
Exists(filename);
1266 static fs_char** plughost_custom_getall(
void* userdata) {
1268 auto res=preset_loader->
GetAll();
1270 for (
size_t n=0;n<res.size();n++) {
1273 all[res.size()]=
nullptr;
1276 static void plughost_custom_getall_free(
fs_char** all,
void* userdata) {
1278 for (
fs_char** one=all;*one;one++) {
1283 static int plughost_custom_remove(
const fs_char *filename,
void* userdata) {
1285 auto res=preset_loader->
Remove(filename);
1288 static int plughost_custom_rename(
const fs_char *from,
const fs_char *to,
void* userdata) {
1290 auto res=preset_loader->
Rename(from,to);
Dynamic library interface.
helper::DynFuncHolder< decltype(plughost_StartUpdateThread) > StartUpdateThread
helper::DynFuncHolder< decltype(plughost_ProcessAudio_Planar) > ProcessAudio_Planar
helper::DynFuncHolder< decltype(plughost_ProcessAudio) > ProcessAudio
helper::DynFuncHolder< decltype(plughost_DeleteClient) > DeleteClient
helper::DynFuncHolder< decltype(plughost_AudioConvertFrom) > AudioConvertFrom
helper::DynFuncHolder< decltype(plughost_GetFormatFromName) > GetFormatFromName
helper::DynFuncHolder< decltype(plughost_SetMetadata) > SetMetadata
bool Load(const std::filesystem::path &path=std::filesystem::current_path())
Loads the library.
helper::DynFuncHolder< decltype(plughost_InitProcess) > InitProcess
helper::DynFuncHolder< decltype(plughost_GetBufferOut) > GetBufferOut
helper::DynFuncHolder< decltype(plughost_GetOutputCount) > GetOutputCount
helper::DynFuncHolder< decltype(plughost_GetAudioInputCount) > GetAudioInputCount
helper::DynFuncHolder< decltype(plughost_SetPresetManager) > SetPresetManager
helper::DynFuncHolder< decltype(plughost_TerminateProcess) > TerminateProcess
helper::DynFuncHolder< decltype(plughost_SetLoggerCallback) > SetLoggerCallback
helper::DynFuncHolder< decltype(plughost_GetAudio) > GetAudio
helper::DynFuncHolder< decltype(plughost_FreeMetadataInfos) > FreeMetadataInfos
helper::DynFuncHolder< decltype(plughost_StereoToMono_Planar) > StereoToMono_Planar
helper::DynFuncHolder< decltype(plughost_InitProcess3) > InitProcess3
helper::DynFuncHolder< decltype(plughost_ExitProcess) > ExitProcess
helper::DynFuncHolder< decltype(plughost_GetBufferIn) > GetBufferIn
helper::DynFuncHolder< decltype(plughost_SetLogSeverity) > SetLogSeverity
helper::DynFuncHolder< decltype(plughost_AddPadAudio) > AddPadAudio
helper::DynFuncHolder< decltype(plughost_Webserver) > Webserver
helper::DynFuncHolder< decltype(plughost_StereoToMono) > StereoToMono
helper::DynFuncHolder< decltype(plughost_Webserver_tcp) > Webserver_tcp
helper::DynFuncHolder< decltype(plughost_NewParameters) > NewParameters
helper::DynFuncHolder< decltype(plughost_GetAudioOutputCount) > GetAudioOutputCount
helper::DynFuncHolder< decltype(plughost_GetProcessChunkFrames) > GetProcessChunkFrames
helper::DynFuncHolder< decltype(plughost_GetFormatName) > GetFormatName
helper::DynFuncHolder< decltype(plughost_Webserver_Status) > Webserver_Status
helper::DynFuncHolder< decltype(plughost_GetChunkSizeInFrames) > GetChunkSizeInFrames
helper::DynFuncHolder< decltype(plughost_GetChannelCount) > GetChannelCount
helper::DynFuncHolder< decltype(plughost_GetBytesFromFormat) > GetBytesFromFormat
helper::DynFuncHolder< decltype(plughost_PresetManager_InformChange) > PresetManager_InformChange
helper::DynFuncHolder< decltype(plughost_Webserver_tcp2) > Webserver_tcp2
bool IsOk() const
Check if the library was loaded correctly.
helper::DynFuncHolder< decltype(plughost_GetMetadataInfos) > GetMetadataInfos
helper::DynFuncHolder< decltype(plughost_GetVersion) > GetVersion
helper::DynFuncHolder< decltype(plughost_StopUpdateThread) > StopUpdateThread
helper::DynFuncHolder< decltype(plughost_SetParameter) > SetParameter
helper::DynFuncHolder< decltype(plughost_SaveState) > SaveState
helper::DynFuncHolder< decltype(plughost_AudioMonoToLiveStereo) > AudioMonoToLiveStereo
helper::DynFuncHolder< decltype(plughost_GetEstimatedDelay) > GetEstimatedDelay
helper::DynFuncHolder< decltype(plughost_GetMaxPacketFrame) > GetMaxPacketFrame
helper::DynFuncHolder< decltype(plughost_InitProcess2) > InitProcess2
helper::DynFuncHolder< decltype(plughost_GetPossibleChunkSizeInFrames) > GetPossibleChunkSizeInFrames
helper::DynFuncHolder< decltype(plughost_NewClient) > NewClient
helper::DynFuncHolder< decltype(plughost_GetParameter) > GetParameter
helper::DynFuncHolder< decltype(plughost_FreeParameterValue) > FreeParameterValue
helper::DynFuncHolder< decltype(plughost_AudioMonoFromLiveStereo) > AudioMonoFromLiveStereo
helper::DynFuncHolder< decltype(plughost_FreeParameters) > FreeParameters
helper::DynFuncHolder< decltype(plughost_AddAudio) > AddAudio
helper::DynFuncHolder< decltype(plughost_WaitUpdateThreadReady) > WaitUpdateThreadReady
helper::DynFuncHolder< decltype(plughost_MonoToStereo_Planar) > MonoToStereo_Planar
helper::DynFuncHolder< decltype(plughost_FreeJsonAnswer) > FreeJsonAnswer
helper::DynFuncHolder< decltype(plughost_Webserver_Stop) > Webserver_Stop
helper::DynFuncHolder< decltype(plughost_GetSampleRate) > GetSampleRate
helper::DynFuncHolder< decltype(plughost_MonoToStereo) > MonoToStereo
helper::DynFuncHolder< decltype(plughost_AudioConvertTo) > AudioConvertTo
helper::DynFuncHolder< decltype(plughost_ProcessJson) > ProcessJson
CClient & operator=(const CInstance &)=delete
CClient(plughost_CInstance *instance, CDynLib &dynlib)
CClient(const CInstance &)=delete
std::string ProcessJson(const std::string &request, bool *NeedSave=nullptr)
Process a JSON request and returns the answer.
unsigned int GetEstimatedDelay()
CInstance & operator=(const CInstance &)=delete
bool Create(const std::string &LoginKey, const std::string &RadioName, const std::string &AWS_Access_ID, const std::string &AWS_Access_Secret, const std::filesystem::path &save_path, int json_port=0, unsigned int frames_per_chunk=64)
virtual void OnUpdateThreadStop()
std::array< float, InputSampleSize > & GetBufferIn()
unsigned int AddAudio(const T *payload, unsigned int nFrame)
std::vector< T > ProcessAnyAudio(const std::vector< T > input)
void SetPresetManager(CPresetLoader *preset_manager)
std::shared_ptr< CClient > NewClient()
std::vector< std::tuple< std::string, std::string > > GetMetadataInfos()
std::string GetParam(const std::string &name)
bool StartWebServer(int http_port, int https_port=0)
void SetParam(const std::string &name, const std::string &value)
unsigned int GetAudio(T *payload, unsigned int max_nFrame)
virtual void OnUpdateThreadStart()
void SetMetadata(const std::string &key, const char *value)
CInstance(CDynLib &dynlib)
CInstance(const CInstance &)=delete
unsigned int GetChunkFrames()
void PresetManager_InformChange(const std::filesystem::path &relative_path, PresetChange_Kind change_kind)
std::array< float, OutputSampleSize > & GetBufferOut()
void ProcessAudio_Planar(float const *const *input, float *const *output)
virtual bool IsReadOnly()=0
virtual bool Write(const std::filesystem::path &filename, const std::string &content)=0
virtual bool Exists(const std::filesystem::path &name)=0
virtual std::vector< std::filesystem::path > GetAll()=0
virtual bool Remove(const std::filesystem::path &name)=0
virtual bool Rename(const std::filesystem::path &from, const std::filesystem::path &to)=0
virtual ~CPresetLoader()=default
virtual std::string Read(const std::filesystem::path &filename)=0
Helper to load dynamic library.
CDynLoader & operator=(CDynLoader const &)=delete
DynFuncHolder< T > GetSymbol(const std::string &name)
CDynLoader(CDynLoader &&)=default
static std::filesystem::path GetThisLibraryPath(void)
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)
Helper to wrap a function pointer.
DynFuncHolder(DynFunc_t a_ptr)
enum plughost_SampleFormat plughost_GetFormatFromName(const char *name)
unsigned int plughost_GetOutputCount(struct plughost_CInstance *instance)
unsigned int plughost_GetBytesFromFormat(const enum plughost_SampleFormat fmt)
unsigned int plughost_AddAudio(struct plughost_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum plughost_SampleFormat fmt)
unsigned int plughost_GetMaxPacketFrame(struct plughost_CInstance *instance)
unsigned int plughost_AddPadAudio(struct plughost_CInstance *instance)
unsigned int plughost_GetAudio(struct plughost_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum plughost_SampleFormat fmt)
const char * plughost_GetFormatName(const enum plughost_SampleFormat fmt)
@ F32_NATIVE
32-bit floating-point, native
@ S16_NATIVE
16-bit signed integer, native
@ S32_NATIVE
32-bit signed integer, native
void plughost_DeleteClient(struct plughost_CClientInstance *client)
void plughost_FreeJsonAnswer(const char *json_str)
struct plughost_CClientInstance * plughost_NewClient(struct plughost_CInstance *instance)
int plughost_SaveState(struct plughost_CInstance *instance)
const char * plughost_ProcessJson(struct plughost_CClientInstance *client, const char *json_str, int *need_save)
void plughost_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum plughost_SampleFormat fmt)
void plughost_StereoToMono(const float *input, float *output, size_t nFrame)
void plughost_MonoToStereo(const float *input, float *output, size_t nFrame)
void plughost_AudioMonoToLiveStereo(const float *input, uint8_t *payload)
void plughost_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame)
void plughost_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum plughost_SampleFormat fmt)
void plughost_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame)
void plughost_AudioMonoFromLiveStereo(const uint8_t *payload, float *output)
float * plughost_GetBufferIn(struct plughost_CInstance *instance)
void plughost_ProcessAudio_Planar(struct plughost_CInstance *instance, float const *const *input, float *const *output)
void plughost_ProcessAudio(struct plughost_CInstance *instance, const float *input, float *output)
float * plughost_GetBufferOut(struct plughost_CInstance *instance)
unsigned int plughost_GetEstimatedDelay(struct plughost_CInstance *instance)
unsigned int plughost_GetAudioOutputCount()
#define PLUGHOST_CHANNEL_COUNT
const char * plughost_GetVersion()
unsigned int plughost_GetSampleRate()
#define PLUGHOST_AUDIO_INPUT_COUNT
unsigned int plughost_GetChannelCount()
unsigned int * plughost_GetPossibleChunkSizeInFrames()
#define PLUGHOST_AUDIOFRAME_COUNT
void plughost_SetLogSeverity(enum plughost_LogSeverity severity)
unsigned int plughost_GetAudioInputCount()
#define PLUGHOST_AUDIO_OUTPUT_COUNT
#define PLUGHOST_SAMPLE_RATE
unsigned int plughost_GetChunkSizeInFrames()
void plughost_SetLoggerCallback(plughost_loggerfn logger)
const char * plughost_GetParameter(struct plughost_CParameters *params, const char *name)
void plughost_FreeParameterValue(const char *value)
int plughost_TerminateProcess(struct plughost_CInstance *instance)
struct plughost_CParameters * plughost_NewParameters()
struct plughost_CInstance * plughost_InitProcess(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path)
struct plughost_CInstance * plughost_InitProcess3(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path, const struct plughost_CParameters *parameters, unsigned int frames_per_chunk)
void plughost_ExitProcess(struct plughost_CInstance *instance)
void plughost_FreeParameters(struct plughost_CParameters *params)
void plughost_SetParameter(struct plughost_CParameters *params, const char *name, const char *value)
struct plughost_CInstance * plughost_InitProcess2(const char *LoginKey, const char *RadioName, const char *AWS_Access_ID, const char *AWS_Access_Secret, const char *save_path, const struct plughost_CParameters *parameters)
unsigned int plughost_GetProcessChunkFrames(struct plughost_CInstance *instance)
void plughost_SetPresetManager(struct plughost_CParameters *params, plughost_storage_reader reader, plughost_storage_reader_free, plughost_storage_writer writer, plughost_storage_exists exists, plughost_storage_getall getall, plughost_storage_getall_free getall_free, plughost_storage_remove remove, plughost_storage_rename rename, int IsReadOnly, void *userdata)
plughost_PresetChange_Kind
void plughost_PresetManager_InformChange(struct plughost_CInstance *instance, const fs_char *relative_path, enum plughost_PresetChange_Kind change_kind)
void plughost_StartUpdateThread(struct plughost_CInstance *instance, unsigned int port)
int plughost_WaitUpdateThreadReady(struct plughost_CInstance *instance, int milliseconds)
void plughost_StopUpdateThread(struct plughost_CInstance *instance)
#define SOUND4_WEBSERVER_HTTPS_OK
int plughost_Webserver_Status(uint64_t id)
int plughost_Webserver_Stop(uint64_t id, int timeout_ms)
uint64_t plughost_Webserver_tcp2(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port, const struct plughost_CParameters *parameters)
#define SOUND4_WEBSERVER_HTTP_OK
uint64_t plughost_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port)
#define SOUND4_INVALID_WEBSERVER_ID
uint64_t plughost_Webserver(unsigned int listenport, unsigned int listenport_secure, struct plughost_CInstance *instance)
const size_t OutputChannels
const size_t OutputSampleSize
const size_t InputSampleSize
const size_t InputChannels
plughost_SampleFormat SampleFormat
std::function< void(LogSeverity, const std::string &)> log_cb_t
#define fs_strdup
helper for OS dependant file name copy