SOUND4 IMPACT.CL Library [1.2.7]
Classes | Public Member Functions | Protected Member Functions | List of all members
sound4::impact::dyn::CInstance Class Reference

#include <sound4.impact.cl_dyn.hpp>

Classes

class  CClient
 

Public Member Functions

 CInstance (CDynLib &dynlib)
 
 CInstance (const CInstance &)=delete
 
CInstance & operator= (const CInstance &)=delete
 
 ~CInstance ()
 
bool IsOk () const
 
void SetParam (const std::string &name, const std::string &value)
 
std::string GetParam (const std::string &name)
 
void SetPresetManager (CPresetLoader *preset_manager)
 
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)
 
unsigned int GetChunkFrames ()
 
void PresetManager_InformChange (const std::filesystem::path &relative_path, PresetChange_Kind change_kind)
 
void SetMetadata (const std::string &key, const char *value)
 
void SetMetadataMulti (const std::unordered_map< std::string, const char * > &list)
 
std::vector< std::tuple< std::string, std::string > > GetMetadataInfos ()
 
virtual void OnUpdateThreadStart ()
 
virtual void OnUpdateThreadStop ()
 
bool StartWebServer (int http_port, int https_port=0)
 
void StopWebServer ()
 
int Terminate ()
 
void Stop ()
 
unsigned int GetEstimatedDelay ()
 
std::array< float, InputSampleSize > & GetBufferIn ()
 
std::array< float, OutputSampleSize > & GetBufferOut ()
 
void ProcessAudio ()
 
void ProcessAudio_Planar (float const *const *input, float *const *output)
 
template<typename T >
std::vector< T > ProcessAnyAudio (const std::vector< T > input)
 
std::shared_ptr< CClient > NewClient ()
 

Protected Member Functions

template<typename T >
unsigned int AddAudio (const T *payload, unsigned int nFrame)
 
template<typename T >
unsigned int GetAudio (T *payload, unsigned int max_nFrame)
 

Detailed Description

Instance handling class

Definition at line 790 of file sound4.impact.cl_dyn.hpp.

Constructor & Destructor Documentation

◆ CInstance() [1/2]

sound4::impact::dyn::CInstance::CInstance ( CDynLib &  dynlib)
inline

Creates the instance, with default parameters

Definition at line 795 of file sound4.impact.cl_dyn.hpp.

◆ CInstance() [2/2]

sound4::impact::dyn::CInstance::CInstance ( const CInstance &  )
delete

◆ ~CInstance()

sound4::impact::dyn::CInstance::~CInstance ( )
inline

Destructor, stopping any running tasks

Definition at line 807 of file sound4.impact.cl_dyn.hpp.

Member Function Documentation

◆ AddAudio()

template<typename T >
unsigned int sound4::impact::dyn::CInstance::AddAudio ( const T *  payload,
unsigned int  nFrame 
)
inlineprotected

Definition at line 1289 of file sound4.impact.cl_dyn.hpp.

◆ Create()

bool sound4::impact::dyn::CInstance::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 
)
inline

Creates and initialize the instance, and starts its update thread

See also
impact_InitProcess2
Parameters
LoginKeySOUND4 Login key
RadioNameSOUND4 RadioName
Access_Key_IDSOUND4 AWS access ID
Access_Key_SecretSOUND4 AWS access Secret
save_pathPath where we can load/save the configuration
json_portOptional json listening port
frames_per_chunkThe number of audio frames in each chunk of processing. Must be in the list returned by impact_GetPossibleChunkSizeInFrames, or 0 to set default
Returns
false if failed

Definition at line 895 of file sound4.impact.cl_dyn.hpp.

◆ GetAudio()

template<typename T >
unsigned int sound4::impact::dyn::CInstance::GetAudio ( T *  payload,
unsigned int  max_nFrame 
)
inlineprotected

Definition at line 1295 of file sound4.impact.cl_dyn.hpp.

◆ GetBufferIn()

std::array<float,InputSampleSize>& sound4::impact::dyn::CInstance::GetBufferIn ( )
inline

Gets the input buffer used in ProcessAudio

Input has GetAudioInputCount() * GetChannelCount() channels

Each sample is a native 32-bit floating-point number where 1.0 is full scale. Channels are interlaced, so the buffers are [L0,R0,L1,R1,...,Ln,Rn] (L=Left, R=Right)

In case of multiple audio input/output, buffer is [aL0,aR0,bL0,bR0,...,aLn,aRn,bLn,bRn]

Definition at line 1142 of file sound4.impact.cl_dyn.hpp.

◆ GetBufferOut()

std::array<float,OutputSampleSize>& sound4::impact::dyn::CInstance::GetBufferOut ( )
inline

Gets the output buffer used in ProcessAudio

Output has GetAudioOutputCount() * GetChannelCount() channels

Each sample is a native 32-bit floating-point number where 1.0 is full scale. Channels are interlaced, so the buffers are [L0,R0,L1,R1,...,Ln,Rn] (L=Left, R=Right)

In case of multiple audio input/output, buffer is [aL0,aR0,bL0,bR0,...,aLn,aRn,bLn,bRn]

Definition at line 1159 of file sound4.impact.cl_dyn.hpp.

◆ GetChunkFrames()

unsigned int sound4::impact::dyn::CInstance::GetChunkFrames ( )
inline

Get the number of audio frames in each chunk of processing.

The value reflects the frames_per_chunk parameter passed to Create

Returns
the number of audio frames in each chunk of processing

Definition at line 938 of file sound4.impact.cl_dyn.hpp.

◆ GetEstimatedDelay()

unsigned int sound4::impact::dyn::CInstance::GetEstimatedDelay ( )
inline

Gets an estimated delay of current processing

See also
impact_GetEstimatedDelay

Definition at line 1126 of file sound4.impact.cl_dyn.hpp.

◆ GetMetadataInfos()

std::vector< std::tuple<std::string,std::string> > sound4::impact::dyn::CInstance::GetMetadataInfos ( )
inline

Get information on known metadata keys.

Returns
a list of {key,description} of known metadata used in process and extensions.

Definition at line 1027 of file sound4.impact.cl_dyn.hpp.

◆ GetParam()

std::string sound4::impact::dyn::CInstance::GetParam ( const std::string &  name)
inline

Gets a parameter value

See also
impact_GetParameter

Definition at line 833 of file sound4.impact.cl_dyn.hpp.

◆ IsOk()

bool sound4::impact::dyn::CInstance::IsOk ( ) const
inline

Returns true if an instance has been created and not stopped.

Definition at line 815 of file sound4.impact.cl_dyn.hpp.

◆ NewClient()

std::shared_ptr<CClient> sound4::impact::dyn::CInstance::NewClient ( )
inline

Creates a low-level JSON client

See also
JSON syntax
Returns
a new client to communicate with the processing

Definition at line 1281 of file sound4.impact.cl_dyn.hpp.

◆ OnUpdateThreadStart()

virtual void sound4::impact::dyn::CInstance::OnUpdateThreadStart ( )
inlinevirtual

Definition at line 1049 of file sound4.impact.cl_dyn.hpp.

◆ OnUpdateThreadStop()

virtual void sound4::impact::dyn::CInstance::OnUpdateThreadStop ( )
inlinevirtual

Definition at line 1051 of file sound4.impact.cl_dyn.hpp.

◆ operator=()

CInstance& sound4::impact::dyn::CInstance::operator= ( const CInstance &  )
delete

◆ PresetManager_InformChange()

void sound4::impact::dyn::CInstance::PresetManager_InformChange ( const std::filesystem::path &  relative_path,
PresetChange_Kind  change_kind 
)
inline

Inform that a change happened in the storage. This must be used only in conjonction with SetPresetManager

Parameters
relative_pathThe path which changed, relative to the root storage
change_kindWhat happened to this path

Definition at line 952 of file sound4.impact.cl_dyn.hpp.

◆ ProcessAnyAudio()

template<typename T >
std::vector<T> sound4::impact::dyn::CInstance::ProcessAnyAudio ( const std::vector< T >  input)
inline

Process audio (different formats, less optimized)

Supports for int16_t, int32_t and float (32) in native endianness

Attention
the return count is independent from the input count due to IMPACT_AUDIOFRAME_COUNT
Template Parameters
Tthe C type for one audio sample
Parameters
inputaudio to process
Returns
processed audio

Definition at line 1207 of file sound4.impact.cl_dyn.hpp.

◆ ProcessAudio()

void sound4::impact::dyn::CInstance::ProcessAudio ( )
inline

Process one audio chunk, from GetBufferIn() to GetBufferOut()

See also
impact_ProcessAudio

Definition at line 1170 of file sound4.impact.cl_dyn.hpp.

◆ ProcessAudio_Planar()

void sound4::impact::dyn::CInstance::ProcessAudio_Planar ( float const *const *  input,
float *const *  output 
)
inline

Process one audio chunk, but with planar audio

Each sample is a native 32-bit floating-point number where 1.0 is full scale. Channels are NOT interlaced, so the buffers are arrays of planar audio : [ [L0,L1,...,Ln] , [R0,R1,...,Rn] ] (L=Left, R=Right)

In case of multiple audio input/output, buffer are [ [aL...], [aR...], [bL...], [bR...], ... ]

See also
impact_ProcessAudio_Planar
Parameters
inputhas GetAudioInputCount() * GetChannelCount() channels
outputhas GetAudioOutputCount() * GetChannelCount() channels

Definition at line 1189 of file sound4.impact.cl_dyn.hpp.

◆ SetMetadata()

void sound4::impact::dyn::CInstance::SetMetadata ( const std::string &  key,
const char *  value 
)
inline

Adds the specific metadata to the process.

It can come from any thread, and will be used as soon as possible. Setting a null value erase the metadata, which is different from setting an empty string.

Parameters
keythe metadata key If key contains a dot (like wm.KEY), it will be sent only to the matching plugin (ie wm here) without the prefix (ie KEY here) Use empty prefix for routing to main only.
valuethe metadata value or nullptr to erase it.

Definition at line 970 of file sound4.impact.cl_dyn.hpp.

◆ SetMetadataMulti()

void sound4::impact::dyn::CInstance::SetMetadataMulti ( const std::unordered_map< std::string, const char * > &  list)
inline

Adds multiple metadata to the process.

This works like CInstance::SetMetadata but with multiple metadata at once.

See also
CInstance::SetMetadata
Parameters
lista map of key/value pair.

Definition at line 991 of file sound4.impact.cl_dyn.hpp.

◆ SetParam()

void sound4::impact::dyn::CInstance::SetParam ( const std::string &  name,
const std::string &  value 
)
inline

Set a parameter value

Must be done before Create

See also
impact_SetParameter

Definition at line 823 of file sound4.impact.cl_dyn.hpp.

◆ SetPresetManager()

void sound4::impact::dyn::CInstance::SetPresetManager ( CPresetLoader *  preset_manager)
inline

Sets a custom preset manager Optional, this overrides the save_path in Create

See also
impact_SetPresetManager

Must be done before Create

Parameters
preset_managerThe custom preset manager

Definition at line 862 of file sound4.impact.cl_dyn.hpp.

◆ StartWebServer()

bool sound4::impact::dyn::CInstance::StartWebServer ( int  http_port,
int  https_port = 0 
)
inline

Starts a Web server on requested ports

See also
impact_Webserver

Definition at line 1059 of file sound4.impact.cl_dyn.hpp.

◆ Stop()

void sound4::impact::dyn::CInstance::Stop ( )
inline

Stops the instance and its web server and its update thread.

See also
impact_ExitProcess,
impact_StopUpdateThread and
impact_Webserver_Stop

Definition at line 1107 of file sound4.impact.cl_dyn.hpp.

◆ StopWebServer()

void sound4::impact::dyn::CInstance::StopWebServer ( )
inline

Stops the Web server

See also
impact_Webserver_Stop

Definition at line 1081 of file sound4.impact.cl_dyn.hpp.

◆ Terminate()

int sound4::impact::dyn::CInstance::Terminate ( )
inline

Terminate the processing. This is useful only with file processing, to get the final status.

See also
impact_TerminateProcess

Definition at line 1096 of file sound4.impact.cl_dyn.hpp.


The documentation for this class was generated from the following file: