20#if defined(__unix__) || defined(__APPLE__)
29 #include <libloaderapi.h>
31 #error "Unsupported OS"
39 #include <stringapiset.h>
42 #define fs_strdup wcsdup
44 #pragma warning(disable : 4996)
48 #define fs_strdup strdup
90 using DynFunc_t =
void *;
92 using DynFunc_t = FARPROC;
95 DynFunc_t m_ptr = NULL;
99 operator bool()
const {
return (m_ptr!=NULL); }
100 bool IsOk()
const {
return m_ptr!=NULL; }
101 operator T* ()
const {
return reinterpret_cast<T*
>(m_ptr); }
111 using DynLib_t =
void *;
113 using DynLib_t = HMODULE;
121 if (
this != &other) {
Close(); m_lib = other.m_lib; other.m_lib = NULL; }
127 operator bool()
const {
128 return (m_lib!=NULL);
131 return (m_lib!=NULL);
136 #ifndef __SANITIZE_ADDRESS__
142 bool Load(
const std::filesystem::path& dynlib)
145 m_lib=dlopen(dynlib.c_str(), RTLD_NOW|RTLD_LOCAL);
148 template <
typename T>
149 DynFuncHolder<T>
GetSymbol(
const std::string& name) {
150 auto ptr=dlsym(m_lib, name.c_str());
152 throw std::runtime_error(
"Missing function in library");
154 return DynFuncHolder<T>(ptr);
156 template <
typename T>
158 auto ptr=dlsym(m_lib, name.c_str());
159 return DynFuncHolder<T>(ptr);
164 auto rp=realpath(
info.dli_fname, NULL);
166 #if defined(__unix__)
167 rp=realpath(
"/proc/self/exe", NULL);
168 #elif defined(__APPLE__)
173 std::filesystem::path p(rp);
188 #if defined(SOUND4_CALL_FREELIBRARYANDEXITTHREAD)
190 #elif defined(SOUND4_CALL_FREELIBRARY)
196 template <
typename T>
200 throw std::runtime_error(
"Missing function in library");
204 template <
typename T>
217 return std::filesystem::path(
path);
287#if IMPACTFM_HAS_WEBSERVER
313#if IMPACTFM_HAS_CLOUDBUS
323#if IMPACTFM_HAS_WEBSERVER
349 bool Load(
const std::filesystem::path& path = {}) {
350 std::string filename;
351 #if defined(__APPLE__)
352 filename=
"libsound4.impactfm.cl.dylib";
353 #elif defined(__unix__)
354 filename=
"libsound4.impactfm.cl.so";
356 filename=
"sound4.impactfm.cl.dll";
360 if (!path.empty() && !m_lib.
Load(path / filename)) {
362 }
else if (!m_lib.
IsOk()) {
366 if (!m_lib.
IsOk() && thisdir.filename()==
"bin") {
367 auto libdir = thisdir.parent_path() /
"lib";
368 m_lib.
Load(libdir / filename);
373 m_lib.
Load(thisdir / filename);
378 auto p = std::filesystem::current_path(ec);
380 m_lib.
Load(p / filename);
433#if IMPACTFM_HAS_WEBSERVER
445 }
catch (std::runtime_error& ) {
463#if IMPACTFM_HAS_CLOUDBUS
465 NewBus = m_lib.
GetSymbol<
decltype(impactfm_NewBus ) >(
"impactfm_NewBus" );
466 FreeBus = m_lib.
GetSymbol<
decltype(impactfm_FreeBus ) >(
"impactfm_FreeBus" );
467 SetInstanceBus = m_lib.
GetSymbol<
decltype(impactfm_SetInstanceBus ) >(
"impactfm_SetInstanceBus" );
473#if IMPACTFM_HAS_WEBSERVER
492 }
catch (std::runtime_error& ) {
558 if (
wstr.empty())
return {};
570 if (
str.empty())
return std::wstring();
750 std::vector<unsigned int> list;
753 list.push_back(*src);
822 throw std::runtime_error(
"Bad library sampling rate");
825 throw std::runtime_error(
"Bad library frame size");
828 throw std::runtime_error(
"Bad library channel count");
831 throw std::runtime_error(
"Bad library input count");
834 throw std::runtime_error(
"Bad library output count");
889 _log_cb(severity, std::string(c_msg));
908#if IMPACTFM_HAS_CLOUDBUS
916 CBus(CDynLib& dynlib)
919 if (m_dynlib.NewBus) {
920 m_bus=m_dynlib.NewBus();
925 if (m_bus && m_dynlib.FreeBus) {
926 m_dynlib.FreeBus(m_bus);
930 impactfm_CBus *Get()
const {
return m_bus; }
933 impactfm_CBus *m_bus;
948 virtual bool Exists(
const std::filesystem::path &name) = 0;
949 virtual bool Remove(
const std::filesystem::path &name) = 0;
950 virtual bool Rename(
const std::filesystem::path &from,
const std::filesystem::path &to) = 0;
951 virtual std::vector<std::filesystem::path>
GetAll() = 0;
952 virtual std::string
Read(
const std::filesystem::path &filename) = 0;
953 virtual bool Write(
const std::filesystem::path &filename,
const std::string &content) =0;
971 if (!params)
throw std::bad_alloc();
987 bool IsOk()
const {
return instance!=
nullptr; }
997 void SetParam(
const std::string& name,
const std::string& value)
1000 m_dynlib.
SetParameter(params, name.c_str(), value.c_str());
1011 auto c_value=m_dynlib.
GetParameter(params, name.c_str());
1012 std::string ret(c_value);
1016#if IMPACTFM_HAS_CLOUDBUS
1025 void SetBus(
const CBus& bus) {
1027 if (m_dynlib.SetInstanceBus) {
1028 m_dynlib.SetInstanceBus(params,bus.
Get());
1045 if (!preset_manager)
return;
1084 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=64)
1087 std::string l_save_path;
1088 if (!save_path.empty()) {
1089 #if (__cplusplus<202002L)
1090 l_save_path = save_path.u8string();
1092 l_save_path = (
const char*)save_path.u8string().c_str();
1096 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);
1097 }
else if (frames_per_chunk!=64) {
1100 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);
1102 if (!instance)
return false;
1103 if (!init_metadata.empty()) {
1104 for (
auto&& [key,value]: init_metadata) {
1105 m_dynlib.
SetMetadata(instance, key.c_str(), value.c_str());
1107 init_metadata.clear();
1109 update_thread = std::thread([
this, json_port](){
1167 m_dynlib.
SetMetadata(instance, key.c_str(), value);
1169 init_metadata.push_back( {key, value} );
1188 typedef const char* pchar;
1189 pchar* keyvalue=
new pchar[2*list.size()+1];
1191 for (
auto&& [key,value]: list) {
1192 keyvalue[2*n+0]=key.c_str();
1193 keyvalue[2*n+1]=value;
1196 keyvalue[2*n+0]=
nullptr;
1202 for (
auto&& [key,value]: list) {
1207 for (
auto&& [key,value]: list) {
1209 init_metadata.push_back( {key, value} );
1222 std::vector< std::tuple<std::string,std::string> > values;
1226 for (
const char** c_value=c_values; *c_value; ) {
1227 std::string key(*c_value);
1230 std::string descr(*c_value);
1232 values.push_back( {key,descr} );
1250#if IMPACTFM_HAS_WEBSERVER
1268 webserver = m_dynlib.
Webserver(http_port,https_port,instance);
1313 char* c_contenttype=
nullptr;
1314 char* c_content=
nullptr;
1316 contenttype=c_contenttype;
1333 if (!instance)
return 0;
1342 if (!instance)
return;
1343#if IMPACTFM_HAS_WEBSERVER
1346 if (update_thread.joinable()) {
1348 update_thread.join();
1385 return reinterpret_cast< std::array<float,InputSampleSize>&
>(*buf);
1403 return reinterpret_cast< std::array<float,OutputSampleSize>&
>(*buf);
1441 template<
typename T>
1445 std::vector<T> output;
1446 unsigned int out_offset=0;
1447 unsigned int in_offset=0;
1448 unsigned int todo = input.size();
1450 unsigned int left =
AddAudio(&input[in_offset], todo);
1452 output.resize(out_offset + out_avail);
1453 GetAudio(&output[out_offset], out_avail);
1454 out_offset+=out_avail;
1455 in_offset += todo-left;
1473 if (!client)
throw std::bad_alloc();
1492 std::string
ProcessJson(
const std::string &request,
bool *NeedSave =
nullptr)
1496 const char *canswer = m_dynlib.
ProcessJson(client, request.c_str(), &need_save);
1497 if (!canswer)
return {};
1498 std::string answer(canswer);
1501 *NeedSave=(need_save!=0);
1519 return std::make_shared<CClient>(instance, m_dynlib);
1565 template<
typename T>
1566 unsigned int AddAudio(
const T* payload,
unsigned int nFrame)
1571 template<
typename T>
1572 unsigned int GetAudio(T* payload,
unsigned int max_nFrame)
1582 std::thread update_thread;
1583 std::vector< std::pair<std::string,std::string> > init_metadata;
1584#if IMPACTFM_HAS_WEBSERVER
1643 bool IsOK()
const {
return (m_cvt!=
nullptr); }
1680 std::string content=preset_loader->
Read(filename);
1681 return strdup(content.c_str());
1684 if (!content)
return;
1689 auto res=preset_loader->
Write(filename,content);
1694 auto res=preset_loader->
Exists(filename);
1699 auto res=preset_loader->
GetAll();
1701 for (
size_t n=0;n<res.size();n++) {
1702 all[n]=fs_strdup(res[n].c_str());
1704 all[res.size()]=
nullptr;
1709 for (
fs_char** one=all;*one;one++) {
1716 auto res=preset_loader->
Remove(filename);
1721 auto res=preset_loader->
Rename(from,to);
sound4cl_CBus * Get() const
void ConvertFrom(const uint8_t *payload, float *output)
void ConvertTo(const float *input, uint8_t *payload)
virtual ~CAudioConverter()
Destroy the CAudioConverter object.
CAudioConverter(CDynLib &dynlib)
Construct a new empty CAudioConverter object.
bool Configure(SampleFormat fmt, size_t nFrame, size_t payl_ch, size_t payl_ch_offset, impactfm_ConverterTargetMode target_mode)
Dynamic library interface.
helper::DynFuncHolder< decltype(impactfm_SetPresetManager) > SetPresetManager
helper::DynFuncHolder< decltype(impactfm_GetAudioConverter) > GetAudioConverter
helper::DynFuncHolder< decltype(impactfm_TerminateProcess) > TerminateProcess
helper::DynFuncHolder< decltype(impactfm_ProcessJson) > ProcessJson
helper::DynFuncHolder< decltype(impactfm_GetMaxPacketFrame) > GetMaxPacketFrame
helper::DynFuncHolder< decltype(impactfm_GetBytesFromFormat) > GetBytesFromFormat
helper::DynFuncHolder< decltype(impactfm_GetPossibleChunkSizeInFrames) > GetPossibleChunkSizeInFrames
helper::DynFuncHolder< decltype(impactfm_GetFormatName) > GetFormatName
helper::DynFuncHolder< decltype(impactfm_Webserver) > Webserver
bool Load(const std::filesystem::path &path={})
Loads the library.
helper::DynFuncHolder< decltype(impactfm_InitProcess3) > InitProcess3
helper::DynFuncHolder< decltype(impactfm_AudioConvertFrom) > AudioConvertFrom
helper::DynFuncHolder< decltype(impactfm_GetAudioOutputCount) > GetAudioOutputCount
helper::DynFuncHolder< decltype(impactfm_MonoToStereo) > MonoToStereo
helper::DynFuncHolder< decltype(impactfm_GetSampleRate) > GetSampleRate
helper::DynFuncHolder< decltype(impactfm_DeleteClient) > DeleteClient
helper::DynFuncHolder< decltype(impactfm_SaveState) > SaveState
helper::DynFuncHolder< decltype(impactfm_ProcessAudio) > ProcessAudio
helper::DynFuncHolder< decltype(impactfm_SetInstanceTracingProcessActivity) > SetInstanceTracingProcessActivity
helper::DynFuncHolder< decltype(impactfm_GetEstimatedDelay) > GetEstimatedDelay
helper::DynFuncHolder< decltype(impactfm_ExitProcess) > ExitProcess
helper::DynFuncHolder< decltype(impactfm_WaitUpdateThreadReady) > WaitUpdateThreadReady
helper::DynFuncHolder< decltype(impactfm_ProcessAudio_Planar) > ProcessAudio_Planar
helper::DynFuncHolder< decltype(impactfm_SetMetadata) > SetMetadata
helper::DynFuncHolder< decltype(impactfm_NewClient) > NewClient
helper::DynFuncHolder< decltype(impactfm_AudioMonoToLiveStereo) > AudioMonoToLiveStereo
helper::DynFuncHolder< decltype(impactfm_AddPadAudio) > AddPadAudio
helper::DynFuncHolder< decltype(impactfm_Webserver_GetAppHealth) > Webserver_GetAppHealth
helper::DynFuncHolder< decltype(impactfm_FreeParameters) > FreeParameters
helper::DynFuncHolder< decltype(impactfm_MonoToStereo_Planar) > MonoToStereo_Planar
helper::DynFuncHolder< decltype(impactfm_GetParameter) > GetParameter
helper::DynFuncHolder< decltype(impactfm_Webserver_SetAppHealth) > Webserver_SetAppHealth
helper::DynFuncHolder< decltype(impactfm_GetFormatFromName) > GetFormatFromName
helper::DynFuncHolder< decltype(impactfm_InitProcess) > InitProcess
helper::DynFuncHolder< decltype(impactfm_AudioConverter_To) > AudioConverter_To
helper::DynFuncHolder< decltype(impactfm_GetChunkSizeInFrames) > GetChunkSizeInFrames
helper::DynFuncHolder< decltype(impactfm_StereoToMono_Planar) > StereoToMono_Planar
helper::DynFuncHolder< decltype(impactfm_Webserver_Status) > Webserver_Status
helper::DynFuncHolder< decltype(impactfm_GetBufferIn) > GetBufferIn
helper::DynFuncHolder< decltype(impactfm_GetAudioInputCount) > GetAudioInputCount
helper::DynFuncHolder< decltype(impactfm_GetVersion) > GetVersion
helper::DynFuncHolder< decltype(impactfm_FreeJsonAnswer) > FreeJsonAnswer
helper::DynFuncHolder< decltype(impactfm_FreeParameterValue) > FreeParameterValue
helper::DynFuncHolder< decltype(impactfm_StopUpdateThread) > StopUpdateThread
helper::DynFuncHolder< decltype(impactfm_Webserver_FreeString) > Webserver_FreeString
helper::DynFuncHolder< decltype(impactfm_SetInstanceTracing) > SetInstanceTracing
helper::DynFuncHolder< decltype(impactfm_StereoToMono) > StereoToMono
helper::DynFuncHolder< decltype(impactfm_NewParameters) > NewParameters
bool IsOk() const
Check if the library was loaded correctly.
helper::DynFuncHolder< decltype(impactfm_GetAudio) > GetAudio
helper::DynFuncHolder< decltype(impactfm_SetLogSeverity) > SetLogSeverity
helper::DynFuncHolder< decltype(impactfm_PresetManager_InformChange) > PresetManager_InformChange
helper::DynFuncHolder< decltype(impactfm_StartUpdateThread) > StartUpdateThread
helper::DynFuncHolder< decltype(impactfm_AudioConverter_From) > AudioConverter_From
helper::DynFuncHolder< decltype(impactfm_InitProcess2) > InitProcess2
helper::DynFuncHolder< decltype(impactfm_AddAudio) > AddAudio
helper::DynFuncHolder< decltype(impactfm_SetLoggerCallback) > SetLoggerCallback
helper::DynFuncHolder< decltype(impactfm_GetChannelCount) > GetChannelCount
helper::DynFuncHolder< decltype(impactfm_GetProcessChunkFrames) > GetProcessChunkFrames
helper::DynFuncHolder< decltype(impactfm_GetBufferOut) > GetBufferOut
helper::DynFuncHolder< decltype(impactfm_Webserver_Stop) > Webserver_Stop
helper::DynFuncHolder< decltype(impactfm_Webserver_tcp2) > Webserver_tcp2
helper::DynFuncHolder< decltype(impactfm_GetOutputCount) > GetOutputCount
helper::DynFuncHolder< decltype(impactfm_SetParameter) > SetParameter
helper::DynFuncHolder< decltype(impactfm_AudioMonoFromLiveStereo) > AudioMonoFromLiveStereo
helper::DynFuncHolder< decltype(impactfm_FreeAudioConverter) > FreeAudioConverter
helper::DynFuncHolder< decltype(impactfm_SetMetadataMulti) > SetMetadataMulti
helper::DynFuncHolder< decltype(impactfm_AudioConvertTo) > AudioConvertTo
helper::DynFuncHolder< decltype(impactfm_GetMetadataInfos) > GetMetadataInfos
helper::DynFuncHolder< decltype(impactfm_FreeMetadataInfos) > FreeMetadataInfos
helper::DynFuncHolder< decltype(impactfm_Webserver_tcp) > Webserver_tcp
CClient & operator=(const CInstance &)=delete
CClient(impactfm_CInstance *instance, CDynLib &dynlib)
std::string ProcessJson(const std::string &request, bool *NeedSave=nullptr)
Process a JSON request and returns the answer.
CClient(const CInstance &)=delete
void ProcessAudio_Planar(float const *const *input, float *const *output)
CInstance(const CInstance &)=delete
std::array< float, InputSampleSize > & GetBufferIn()
void SetPresetManager(CPresetLoader *preset_manager)
void PresetManager_InformChange(const std::filesystem::path &relative_path, PresetChange_Kind change_kind)
std::string GetParam(const std::string &name)
virtual void OnUpdateThreadStart()
void StopWebServer(int timeout_ms=1000)
unsigned int GetChunkFrames()
void GetWebServerAppHealth(int &httpcode, std::string &contenttype, std::string &content)
void SetMetadataMulti(const std::unordered_map< std::string, const char * > &list)
CInstance(CDynLib &dynlib)
unsigned int GetAudio(T *payload, unsigned int max_nFrame)
void SetParam(const std::string &name, const std::string &value)
unsigned int AddAudio(const T *payload, unsigned int nFrame)
std::vector< std::tuple< std::string, std::string > > GetMetadataInfos()
void SetInstanceTracing(TraceLoggingHProvider tracing_provider, GUID activity_guid={})
std::vector< T > ProcessAnyAudio(const std::vector< T > input)
std::array< float, OutputSampleSize > & GetBufferOut()
bool StartWebServer(int http_port, int https_port=0)
std::shared_ptr< CClient > NewClient()
void SetMetadata(const std::string &key, const char *value)
unsigned int GetEstimatedDelay()
CInstance & operator=(const CInstance &)=delete
void SetInstanceTracingProcessActivity(GUID activity_guid)
void SetWebServerAppHealth(int httpcode, const std::string &contenttype, const std::string &content)
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=64)
virtual void OnUpdateThreadStop()
Custom preset handler helper.
virtual ~CPresetLoader()=default
virtual std::vector< std::filesystem::path > GetAll()=0
virtual bool Write(const std::filesystem::path &filename, const std::string &content)=0
virtual bool IsReadOnly()=0
virtual bool Exists(const std::filesystem::path &name)=0
virtual bool Remove(const std::filesystem::path &name)=0
virtual std::string Read(const std::filesystem::path &filename)=0
virtual bool Rename(const std::filesystem::path &from, const std::filesystem::path &to)=0
Helper to load dynamic library.
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 &&other) noexcept
CDynLoader & operator=(CDynLoader &&other) noexcept
CDynLoader & operator=(CDynLoader const &)=delete
DynFuncHolder< T > GetSymbol_safe(const std::string &name)
static std::filesystem::path GetThisLibraryPath(void)
Helper to wrap a function pointer.
DynFuncHolder(DynFunc_t a_ptr)
unsigned int impactfm_AddAudio(struct impactfm_CInstance *instance, const uint8_t *payload, unsigned int nFrame, enum impactfm_SampleFormat fmt)
unsigned int impactfm_GetMaxPacketFrame(struct impactfm_CInstance *instance)
unsigned int impactfm_GetAudio(struct impactfm_CInstance *instance, uint8_t *payload, unsigned int max_nFrame, enum impactfm_SampleFormat fmt)
const char * impactfm_GetFormatName(const enum impactfm_SampleFormat fmt)
unsigned int impactfm_AddPadAudio(struct impactfm_CInstance *instance)
unsigned int impactfm_GetOutputCount(struct impactfm_CInstance *instance)
unsigned int impactfm_GetBytesFromFormat(const enum impactfm_SampleFormat fmt)
enum impactfm_SampleFormat impactfm_GetFormatFromName(const char *name)
void impactfm_FreeJsonAnswer(const char *json_str)
const char * impactfm_ProcessJson(struct impactfm_CClientInstance *client, const char *json_str, int *need_save)
int impactfm_SaveState(struct impactfm_CInstance *instance)
struct impactfm_CClientInstance * impactfm_NewClient(struct impactfm_CInstance *instance)
void impactfm_DeleteClient(struct impactfm_CClientInstance *client)
void impactfm_StereoToMono(const float *input, float *output, size_t nFrame)
void impactfm_AudioConvertFrom(const uint8_t *payload, float *output, size_t nSpl, enum impactfm_SampleFormat fmt)
void impactfm_MonoToStereo(const float *input, float *output, size_t nFrame)
void impactfm_MonoToStereo_Planar(const float *input, float *outputL, float *outputR, size_t nFrame)
impactfm_ConverterTargetMode
void impactfm_StereoToMono_Planar(const float *inputL, const float *inputR, float *output, size_t nFrame)
struct impactfm_CAudioConverter * impactfm_GetAudioConverter(enum impactfm_SampleFormat fmt, size_t nFrame, size_t payl_ch, size_t payl_ch_offset, enum impactfm_ConverterTargetMode target_mode)
void impactfm_AudioConverter_From(struct impactfm_CAudioConverter *converter, const uint8_t *payload, float *output)
void impactfm_AudioConverter_To(struct impactfm_CAudioConverter *converter, const float *input, uint8_t *payload)
void impactfm_AudioConvertTo(const float *input, uint8_t *payload, size_t nSpl, enum impactfm_SampleFormat fmt)
void impactfm_AudioMonoToLiveStereo(const float *input, uint8_t *payload)
void impactfm_AudioMonoFromLiveStereo(const uint8_t *payload, float *output)
void impactfm_FreeAudioConverter(struct impactfm_CAudioConverter *converter)
unsigned int impactfm_GetEstimatedDelay(struct impactfm_CInstance *instance)
float * impactfm_GetBufferOut(struct impactfm_CInstance *instance)
float * impactfm_GetBufferIn(struct impactfm_CInstance *instance)
void impactfm_ProcessAudio_Planar(struct impactfm_CInstance *instance, float const *const *input, float *const *output)
void impactfm_ProcessAudio(struct impactfm_CInstance *instance, const float *input, float *output)
#define IMPACTFM_AUDIOFRAME_COUNT
#define IMPACTFM_AUDIO_OUTPUT_COUNT
#define IMPACTFM_CHANNEL_COUNT
void impactfm_SetLoggerCallback(impactfm_loggerfn logger)
unsigned int impactfm_GetChannelCount()
unsigned int impactfm_GetAudioInputCount()
unsigned int * impactfm_GetPossibleChunkSizeInFrames()
const char * impactfm_GetVersion()
unsigned int impactfm_GetChunkSizeInFrames()
unsigned int impactfm_GetAudioOutputCount()
#define IMPACTFM_SAMPLE_RATE
unsigned int impactfm_GetSampleRate()
#define IMPACTFM_AUDIO_INPUT_COUNT
void impactfm_SetLogSeverity(enum impactfm_LogSeverity severity)
void impactfm_SetParameter(struct impactfm_CParameters *params, const char *name, const char *value)
void impactfm_FreeParameterValue(const char *value)
struct impactfm_CInstance * impactfm_InitProcess3(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path, const struct impactfm_CParameters *parameters, unsigned int frames_per_chunk)
struct impactfm_CInstance * impactfm_InitProcess2(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path, const struct impactfm_CParameters *parameters)
int impactfm_TerminateProcess(struct impactfm_CInstance *instance)
void impactfm_ExitProcess(struct impactfm_CInstance *instance)
struct impactfm_CParameters * impactfm_NewParameters()
const char * impactfm_GetParameter(struct impactfm_CParameters *params, const char *name)
void impactfm_FreeParameters(struct impactfm_CParameters *params)
unsigned int impactfm_GetProcessChunkFrames(struct impactfm_CInstance *instance)
struct impactfm_CInstance * impactfm_InitProcess(const char *LoginKey, const char *RadioName, const char *Access_Key_ID, const char *Access_Key_Secret, const char *save_path)
impactfm_PresetChange_Kind
void impactfm_SetPresetManager(struct impactfm_CParameters *params, impactfm_storage_reader reader, impactfm_storage_reader_free, impactfm_storage_writer writer, impactfm_storage_exists exists, impactfm_storage_getall getall, impactfm_storage_getall_free getall_free, impactfm_storage_remove remove, impactfm_storage_rename rename, int IsReadOnly, void *userdata)
void impactfm_PresetManager_InformChange(struct impactfm_CInstance *instance, const fs_char *relative_path, enum impactfm_PresetChange_Kind change_kind)
void impactfm_SetInstanceTracing(struct impactfm_CParameters *params, TraceLoggingHProvider tracing_provider, GUID activity_guid)
void impactfm_SetInstanceTracingProcessActivity(struct impactfm_CInstance *instance, GUID activity_guid)
void impactfm_StopUpdateThread(struct impactfm_CInstance *instance)
int impactfm_WaitUpdateThreadReady(struct impactfm_CInstance *instance, int milliseconds)
void impactfm_StartUpdateThread(struct impactfm_CInstance *instance, unsigned int port)
int impactfm_Webserver_Status(uint64_t id)
uint64_t impactfm_Webserver(unsigned int listenport, unsigned int listenport_secure, struct impactfm_CInstance *instance)
void impactfm_Webserver_GetAppHealth(struct impactfm_CInstance *instance, int *httpcode, char **contenttype, char **content)
#define SOUND4_WEBSERVER_HTTPS_OK
uint64_t impactfm_Webserver_tcp(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port)
int impactfm_Webserver_Stop(uint64_t id, int timeout_ms)
#define SOUND4_WEBSERVER_HTTP_OK
void impactfm_Webserver_FreeString(char *str)
uint64_t impactfm_Webserver_tcp2(unsigned int listenport, unsigned int listenport_secure, const char *socket_ip, unsigned int socket_port, const struct impactfm_CParameters *parameters)
#define SOUND4_INVALID_WEBSERVER_ID
void impactfm_Webserver_SetAppHealth(struct impactfm_CInstance *instance, int httpcode, const char *contenttype, const char *content)
static void MonoToStereo_Planar(CDynLib &dynlib, const float *input, float *outputL, float *outputR, size_t nFrame)
static void MonoToStereo(CDynLib &dynlib, const float *input, float *output, size_t nFrame)
static void AudioMonoFromLiveStereo(CDynLib &dynlib, const uint8_t *payload, float *output)
static void StereoToMono(CDynLib &dynlib, const float *input, float *output, size_t nFrame)
static void AudioMonoToLiveStereo(CDynLib &dynlib, const float *input, uint8_t *payload)
static void AudioConvertFrom(CDynLib &dynlib, const uint8_t *payload, float *output, size_t nSpl, impactfm_SampleFormat fmt)
static std::wstring UTF8ToWString(const std::string &str)
static void AudioConvertTo(CDynLib &dynlib, const float *input, uint8_t *payload, size_t nSpl, impactfm_SampleFormat fmt)
static void StereoToMono_Planar(CDynLib &dynlib, const float *inputL, const float *inputR, float *output, size_t nFrame)
static std::string WStringToUTF8(const std::wstring &wstr)
static constexpr const char * process_shortname
static void SetLogSeverity(CDynLib &dynlib, LogSeverity severity)
const size_t InputSampleSize
const size_t OutputChannels
static void SanityCheck(CDynLib &dynlib, bool a_bCheckFrames=true)
static void _log_cb_c(impactfm_LogSeverity severity, const char *c_msg)
std::function< void(LogSeverity, const std::string &)> log_cb_t
const size_t InputChannels
static void SetLoggerCallback(CDynLib &dynlib, log_cb_t cb)
static unsigned int GetBytesFromFormat(CDynLib &dynlib, const SampleFormat fmt)
static constexpr const char * process_name
static SampleFormat GetFormatFromName(CDynLib &dynlib, const std::string &name)
static std::string GetFormatName(CDynLib &dynlib, const SampleFormat fmt)
const size_t OutputSampleSize
static unsigned int GetChunkSizeInFrames()
static unsigned int GetSampleRate()
static unsigned int GetChannelCount()
static unsigned int GetAudioInputCount()
static unsigned int GetAudioOutputCount()
static std::string GetVersion()
static std::vector< unsigned int > GetPossibleChunkSizeInFrames()
@ S32_NATIVE
32-bit signed integer, native
@ F32_NATIVE
32-bit floating-point, native
@ S16_NATIVE
16-bit signed integer, native
struct _tlgProvider_t const * TraceLoggingHProvider
static int impactfm_custom_writer(const fs_char *filename, const char *content, void *userdata)
static int impactfm_custom_rename(const fs_char *from, const fs_char *to, void *userdata)
static void impactfm_custom_getall_free(fs_char **all, void *userdata)
static void impactfm_custom_reader_free(char *content, void *userdata)
static int impactfm_custom_exists(const fs_char *filename, void *userdata)
static fs_char ** impactfm_custom_getall(void *userdata)
static char * impactfm_custom_reader(const fs_char *filename, void *userdata)
static int impactfm_custom_remove(const fs_char *filename, void *userdata)
static int impactfm_custom_writer(const fs_char *filename, const char *content, void *userdata)
static int impactfm_custom_rename(const fs_char *from, const fs_char *to, void *userdata)
static void impactfm_custom_getall_free(fs_char **all, void *userdata)
static void impactfm_custom_reader_free(char *content, void *userdata)
static int impactfm_custom_exists(const fs_char *filename, void *userdata)
static fs_char ** impactfm_custom_getall(void *userdata)
static char * impactfm_custom_reader(const fs_char *filename, void *userdata)
static int impactfm_custom_remove(const fs_char *filename, void *userdata)