ExperimentalSkineticSDK
This class is used as the experimental API interface.
#include <ExperimentalSkineticSDK.h>
Public Functions
Name | |
---|---|
ExperimentalSkineticSDK(SkineticSDK * skineticSdk) Instantiate a new ExperimentalSkineticSDK instance. | |
~ExperimentalSkineticSDK() =default ExperimentalSkineticSDK destructor. | |
void | enableLegacyBackend(bool enable) Enable legacy backend. |
int | connectAsh(ski_output_t outputType, uint32_t serialNumber, const char * loopbackInterface) Initialize an asynchronous connection to a Skinetic device and use the ASH-fx library for haptic generation. |
int | connectAudio(ski_audio_preset_t audioPreset, ski_audio_settings_t & audioSettings) Initialize an asynchronous connection to an audio device using the provided settings. |
int | connectAshAudio(ski_audio_preset_t audioPreset, ski_audio_settings_t & audioSettings, const char * loopbackInterface) Initialize an asynchronous connection to an audio device and use the ASH-fx library for haptic generation. |
void | setAshVolume(float volume) Set the volume of the ASH-generated haptic track. |
float | getAshVolume() Get the volume of the ASH-generated haptic track. |
int | setAshPreset(int preset_index) Set the mode of generation for the ASH-fx library. |
int | getAshPreset() Get the current mode of generation for the ASH-fx library. |
int | listAshPresets(const char **& presetNames, int & nbPreset) Get names of available ASH-fx generation modes (presets). |
int | getOutputDevicesNames(const char **& devicesNames, int & nbDevices) Get names of available output devices. |
int | getLoopbackDevicesNames(const char **& devicesNames, int & nbDevices) Get names of available input loopback devices. |
int | getOutputDeviceAPIs(const char * outputName, const char **& APIs, int & nb_APIs) Get available APIs for a given output device identified by name. |
int | getOutputDeviceInfo(const char outputName, const char API, int & maxChannels, float & defaultLowLatency, float & defaultHighLatency) Get settings extremum values of the output device identified by name and API. |
int | getSupportedStandardSampleRates(const char outputName, const char API, uint32_t *& sampleRates, int & nbSampleRates) Get all supported standard sample rates for the output device identified by name and API. |
Public Functions Documentation
function ExperimentalSkineticSDK
explicit ExperimentalSkineticSDK(
SkineticSDK * skineticSdk
)
Instantiate a new ExperimentalSkineticSDK instance.
Parameters:
- skineticSdk SkineticSDK instance to bound to.
When instantiating a SkineticSDK, an ExperimentalSkineticSDK instance is automatically bound to it and can be accessed with using ExperimentalAPI().
function ~ExperimentalSkineticSDK
~ExperimentalSkineticSDK() =default
ExperimentalSkineticSDK destructor.
function enableLegacyBackend
void enableLegacyBackend(
bool enable
)
Enable legacy backend.
Parameters:
- enable set to true to enable, false otherwise.
If boolean is set to true, the legacy backend is used instead of the default backend. The backend is changed upon next scan or connection.
When switching backend, the scan result is emptied.
function connectAsh
int connectAsh(
ski_output_t outputType,
uint32_t serialNumber,
const char * loopbackInterface
)
Initialize an asynchronous connection to a Skinetic device and use the ASH-fx library for haptic generation.
Parameters:
- outputType type of connection.
- serialNumber serial number of the Skinetic device to connect to.
- loopbackInterface input loopback interface.
Return: 0 on success, an Error otherwise.
The ASH-fx library generates haptic signals based on the audio of the targeted input loopback interface. The loopback interfaces can be queried by calling getLoopbackDevicesNames(). Setting loopbackInterface to NULL selects the default audio output device of the system.
function connectAudio
int connectAudio(
ski_audio_preset_t audioPreset,
ski_audio_settings_t & audioSettings
)
Initialize an asynchronous connection to an audio device using the provided settings.
Parameters:
- audioPreset preset of audio device.
- audioSettings audio stream configuration to use.
Return: 0 on success, an Error code on failure.
If audioPreset is set to anything else other than ski_audioPreset_t::eCustomDevice, the provided settings are ignored and the ones corresponding to the preset are used instead.
Notice that this connection is not compatible with the legacy backend.
function connectAshAudio
int connectAshAudio(
ski_audio_preset_t audioPreset,
ski_audio_settings_t & audioSettings,
const char * loopbackInterface
)
Initialize an asynchronous connection to an audio device and use the ASH-fx library for haptic generation.
Parameters:
- audioPreset preset of audio device (for output).
- audioSettings audio stream configuration to use (for output).
- loopbackInterface input loopback interface.
Return: 0 on success, an Error code on failure.
The ASH-fx library generates haptic signals based on the audio of the targeted input loopback interface. The loopback interfaces can be queried by calling getLoopbackDevicesNames(). Setting loopbackInterface to NULL selects the default audio output device of the system.
If audioPreset is set to anything else other than ski_audioPreset_t::eCustomDevice, the provided settings are ignored and the ones corresponding to the preset are used instead.
function setAshVolume
void setAshVolume(
float volume
)
Set the volume of the ASH-generated haptic track.
Parameters:
- volume normalized haptic volume.
The volume is normalized and ranged between [0; 1]. Values above 1 can be used but might produce clipping.
function getAshVolume
float getAshVolume()
Get the volume of the ASH-generated haptic track.
Return: the normalized haptic volume.
function setAshPreset
int setAshPreset(
int preset_index
)
Set the mode of generation for the ASH-fx library.
Parameters:
- preset_index index of the preset to use. The list of available presets can be listed with listAshPresets().
Return: 0 on success, an Error code on failure.
function getAshPreset
int getAshPreset()
Get the current mode of generation for the ASH-fx library.
Return: the current preset index.
function listAshPresets
static int listAshPresets(
const char **& presetNames,
int & nbPreset
)
Get names of available ASH-fx generation modes (presets).
Parameters:
- presetNames array of const char*.
- nbPreset number of char* in the array.
Return: 0 if the vector has been set successfully, an Error otherwise.
This function will set the pointer array of const char *, as well as the size of the array as they are passed by reference.
function getOutputDevicesNames
static int getOutputDevicesNames(
const char **& devicesNames,
int & nbDevices
)
Get names of available output devices.
Parameters:
- devicesNames array of const char*.
- nbDevices number of char* in the array.
Return: 0 if the vector has been set successfully, an Error otherwise.
If no device is available, the array will contain "noDevice". This function will set the pointer array of const char *, as well as the size of the array as they are passed by reference.
function getLoopbackDevicesNames
static int getLoopbackDevicesNames(
const char **& devicesNames,
int & nbDevices
)
Get names of available input loopback devices.
Parameters:
- devicesNames array of const char*.
- nbDevices number of char* in the array.
Return: 0 if the vector has been set successfully, an Error otherwise.
This will work only on Windows with the WASAPI API. Each input loopback device correspond to a real output device.
If no device is available, the array will contain "noDevice". This function will set the pointer array of const char *, as well as the size of the array as they are passed by reference.
function getOutputDeviceAPIs
static int getOutputDeviceAPIs(
const char * outputName,
const char **& APIs,
int & nb_APIs
)
Get available APIs for a given output device identified by name.
Parameters:
- outputName name of the output.
- APIs pointer to array of const char*.
- nb_APIs number of char* in the array.
Return: 0 if the vector has been set successfully, an Error otherwise.
If no API is available, the array will contain "noAPI". This function will set the pointer array of const char *, as well as the size of the array as they are passed by reference.
function getOutputDeviceInfo
static int getOutputDeviceInfo(
const char * outputName,
const char * API,
int & maxChannels,
float & defaultLowLatency,
float & defaultHighLatency
)
Get settings extremum values of the output device identified by name and API.
Parameters:
- outputName name of the output.
- API name of the API.
- max_channels max number of channel
- default_low_latency minimum latency of the output device
- default_high_latency maximum latency of the output device
Return: 0 if the values have been set successfully, an Error otherwise.
function getSupportedStandardSampleRates
static int getSupportedStandardSampleRates(
const char * outputName,
const char * API,
uint32_t *& sampleRates,
int & nbSampleRates
)
Get all supported standard sample rates for the output device identified by name and API.
Parameters:
- outputName name of the output.
- API name of the API.
- sampleRates pointer to array of uint.
- nb_sampleRates number of uint in the array.
Return: 0 if the vector has been set successfully, an Error otherwise.
This function will set the pointer array of float, as well as the size of the array as they are passed by reference. If the outputName or the API are not valid, an error is returned and the array is filled with all standard sample rates.
Updated on 2024-07-11 at 09:47:11 +0000