Engine Control
Articles
Init
bool Init();
Initializes the different components and modules of the Interhaptics Engine. This function should be called before any other API function is used.
Returns: Always returns true, even if a module is not properly initialized.
Quit
void Quit();
Cleans up the different components and modules of the Interhaptics Engine. This function should be called before the application is quit.
AddHM
int AddHM(const char* _content);
- Adds the content of a .haps file to the Interhaptics Engine for future use.
Parameters
- _content: JSON content of the .haps file to be loaded. It needs to follow the Interhaptics .haps format.
Returns: The ID of the haptic effect if loading is successful, or -1 if loading failed.
AddParametricEffect
int AddParametricEffect(double* _amplitude, int _amplitudeSize, double* _pitch, int _pitchSize, double _pitchMin, double _pitchMax, double* _transient, int _transientSize, bool _isLooping);
- Creates a haptic effect by processing parameters such as amplitude, pitch, and transients. This function generates a haptic effect based on the given input parameters and can optionally loop iy.
Parameters
- double _amplitude:* An array of amplitude values. The array should be formatted as Time -- Value pairs, where each Value is between 0 and 1.
- int _amplitudeSize: The size of the amplitude array.
- double _pitch*: An array of pitch values. The array should be formatted as Time -- Value pairs, where each Value is between 0 and 1.
- int _pitchSize: The size of the pitch array.
- double _freqMin: The minimum value for the frequency range.
- double _freqMax: The maximum value for the frequency range.
- double _transient*: An array of transient values. The array should be formatted as Time -- Amplitude -- Pitch triplets, with both Amplitude and Pitch values ranging between 0 and 1.
- int _transientSize: The size of the transient array.
- bool _isLooping: Indicates whether the audio effect should loop.
Returns
- ID of the haptic effect created.
UpdateHM
bool UpdateHM(int _hMaterialID, const char* _content);
Replaces the content of an already loaded haptic effect. This function is useful when the ID of the haptic effect needs to be persistent.
Parameters
- _hMaterialID: ID of the haptic effect to be replaced.
- _content: JSON content of the .haps file to be loaded. It needs to follow the Interhaptics .haps format.
Returns: true if the effect was properly updated, false otherwise.
GetGlobalIntensity
double GetGlobalIntensity();
- Gets the global rendering intensity factor for the whole engine.
Returns: The global intensity. -1 if mixer is not initialized.
SetGlobalIntensity
void SetGlobalIntensity(double _intensity);
- Sets the global rendering intensity factor for the whole engine.
Parameters
- _intensity: Positive value. 0 is nothing. Base value is 1.