Haptic
Interfaces#
IHapticDynamicPlayable#
TsSDK::IHapticDynamicPlayable
Dynamic playables is a haptic playables with possibility to change channels that will generate haptic feedback in any time, including during the playback.
Methods
AddChannel#
void AddChannel(IMapping2dElectricChannel channel);
Adds electric channel to dynamic playable.
Parameters
channel: IMapping2dElectricChannel
Handle of the electric channel that can be accessed from IMapping2d.ElectricChannels
See also: IMapping2d, IMapping2d.ElectricChannels, IMapping2dElectricChannel
RemoveChannel#
void RemoveChannel(IMapping2dElectricChannel channel);
Removes electric channel from dynamic playable.
Parameters
channel: IMapping2dElectricChannel
Handle of the electric channel that can be accessed from IMapping2d.ElectricChannels
See also: IMapping2d, IMapping2d.ElectricChannels, IMapping2dElectricChannel
IHapticMaterialPlayable#
TsSDK::IHapticMaterialPlayable
Haptic material playables is a combination of HapticEffect and IHapticDynamicPlayable haptic playables with possibility to change channels and their impact value.
Methods
SetChannelImpact#
void SetChannelImpact(IMapping2dElectricChannel channel, float impact);
Sets impact value on previously added channel.
Parameters
channel: IMapping2dElectricChannel
Channel used to set impact
impact: float
Channel impact parameter that takes values in the range [0:1]
IHapticPlayable#
TsSDK::IHapticPlayable
Provides base access to control haptic playable playback and to change its state.
Properties
Device — IDevice (read-only)
Device on which the playable was created.
Id — ulong (read-only)
Playable unique identifier.
IsPlaying — bool (read-only)
Playable playing state.
IsPaused — bool (read/write)
Playable paused state.
IsMuted — bool (read/write)
Playable muted state.
IsLooped — bool (read/write)
Playable looped state.
Multipliers — IEnumerable< TsHapticParamMultiplier > (read/write)
Playable multipliers are used to get or control haptic output parameters multiplication coefficient.
TimeMs — ulong (read/write)
Playable local time in milliseconds.
DurationMs — ulong (read-only)
Playable duration in milliseconds.
Methods
Play#
void Play();
Plays playable.
Stop#
void Stop();
Stops playable.
Remove#
void Remove();
Completely removes playable instance from the haptic player.
SetMultiplier#
void SetMultiplier(TsHapticParamMultiplier multiplier);
Sets playable haptic parameter multiplier value.
IHapticPlayer#
TsSDK::IHapticPlayer
Haptic player provides aggregated access to the haptic playback.
Properties
IsRunning — bool (read-only)
Player running state.
IsPaused — bool (read/write)
Player paused state.
IsMuted — bool (read/write)
Player muted state.
TimeMs — ulong (read-only)
Player time in milliseconds.
MasterMultipliers — IEnumerable< TsHapticParamMultiplier > (read/write)
Haptic multipliers are used to get or control haptic output parameters multiplication coefficient.
GlobalPower — float (read/write)
Global haptic power is used to control overall device haptic power value.
Methods
GetMasterMultiplier#
float GetMasterMultiplier(TsHapticParamType paramType);
Returns haptic master multiplier value by specified parameter type.
Returns: float
Multiplier value that takes the values from the range 0 to 1
SetMasterMultiplier#
void SetMasterMultiplier(TsHapticParamType paramType, float value);
Sets haptic master multiplier value on specified parameter type.
Parameters
paramType: TsHapticParamType
Parameter type used to set multiplier
value: float
Multiplier value that takes the values from the range 0 to 1
Stop#
void Stop();
Stops player.
CreatePlayable#
IHapticPlayable CreatePlayable(IHapticAsset hapticAsset, bool isLooped);
Creates haptic playable from haptic asset.
Parameters
hapticAsset: IHapticAsset
HapticAsset that is playable created from
isLooped: bool
Is loop flag set for playable by default
Returns: IHapticPlayable
IHapticPlayable Playable instance
CreateTouch#
IHapticDynamicPlayable CreateTouch(TsHapticParam[] parameters, IntPtr[] channels, UInt64 duration);
Creates touch playable from touch parameters.
Parameters
parameters: TsHapticParam[]
Touch haptic parameters array
channels: IntPtr[]
Channel handles array
duration: UInt64
Touch duration in milliseconds
Returns: IHapticDynamicPlayable
IHapticDynamicPlayable Playable instance for future playback
IsPlayableExists#
bool IsPlayableExists(IHapticPlayable playable);
Returns true if playable currently exists in player in any state, otherwise false.
Parameters
playable: IHapticPlayable
Returns: bool
Play#
void Play(IHapticPlayable playable);
Plays playable.
Stop#
void Stop(IHapticPlayable playable);
Stops playable.
IsPlaying#
bool IsPlaying(IHapticPlayable playable);
Returns playable playing state.
Returns: bool
Remove#
void Remove(IHapticPlayable playable);
Completely removes playable instance from the haptic player.
AddImpact#
void AddImpact(IHapticMaterialPlayable material, IMapping2dElectricChannel channel, float impact, long durationMs);
Adds channel to the material playable if not exist and sets or updates its impact for a given lifetime in milliseconds.
Parameters
material: IHapticMaterialPlayable
Material used to set impact
channel: IMapping2dElectricChannel
Channel used to set impact
impact: float
Channel impact parameter that takes values in the range [0:1]
durationMs: long
Duration of impact in milliseconds
RemoveImpact#
void RemoveImpact(IHapticMaterialPlayable material, IMapping2dElectricChannel channel);
Removes impact from the material playable.
Parameters
material: IHapticMaterialPlayable
Material used to remove impact
channel: IMapping2dElectricChannel
Channel used to remove impact
GetPlayable#
IHapticPlayable GetPlayable(IHapticAsset asset);
Returns IHapticPlayable from the current device by given haptic asset .
Returns: IHapticPlayable
IHapticPlayable Haptic playable object instance
ClearPlayables#
void ClearPlayables();
Removes all haptic playables from the haptic player.
Data structures#
TsHapticParam#
Haptic parameter struct.
Fields
type TsHapticParamType
Haptic parameter type.
value UInt64
Haptic parameter value.
TsHapticParamMultiplier#
Haptic parameter multiplier struct.
Used to control haptic output parameters by multiplication coefficient
Fields
type TsHapticParamType
Haptic parameter type.
value float
Haptic parameter multiplier value (between 0 and 1)
Enumerations#
TsHapticParamType#
Haptic parameter type.
Members
Undefined 0
Period 1
Amplitude 2
PulseWidth 3
Temperature 4
TsHapticTouchVersion#
Haptic touch version.
Members
Undefined 0
Touch_4_5
Touch_4_6
Touch_4_7
Touch_5_0
Glove_1_0
Glove_1_2
