Exemplo n.º 1
0
        private unsafe void CreateAndPlayHaptic(UInt32 deviceId)
        {
            var   nodes      = fetchAllNodes(deviceId);
            float timeOffset = 0.15f;

            Interop.HLVR_Timeline *timeline = null;
            Interop.HLVR_Timeline_Create(&timeline);

            for (int i = 0; i < nodes.Count; i++)
            {
                UInt32[] singleLoc = new UInt32[1] {
                    nodes[i]
                };
                Interop.HLVR_Event *haptic = null;
                Interop.HLVR_Event_Create(&haptic, Interop.HLVR_EventType.DiscreteHaptic);
                Interop.HLVR_Event_SetUInt32s(haptic, Interop.HLVR_EventKey.Target_Nodes_UInt32s, singleLoc, 1);
                Interop.HLVR_Event_SetInt(haptic, Interop.HLVR_EventKey.DiscreteHaptic_Waveform_Int, (int)Interop.HLVR_Waveform.Click);
                Interop.HLVR_Timeline_AddEvent(timeline, timeOffset * i, haptic);
                Interop.HLVR_Event_Destroy(haptic);
            }


            Interop.HLVR_Effect *effect = null;
            Interop.HLVR_Effect_Create(&effect);

            Interop.HLVR_Timeline_Transmit(timeline, _pluginPtr, effect);
            Interop.HLVR_Effect_Play(effect);

            Interop.HLVR_Timeline_Destroy(timeline);
            Interop.HLVR_Effect_Destroy(effect);
        }
Exemplo n.º 2
0
 private void DisableAudio(object sender, EventArgs args)
 {
     unsafe
     {
         UInt32[] chests = new UInt32[2] {
             4000000, 5000000
         };
         Interop.HLVR_Event *enable = null;
         Interop.HLVR_Event_Create(&enable, Interop.HLVR_EventType.EndAnalogAudio);
         Interop.HLVR_Event_SetUInt32s(enable, Interop.HLVR_EventKey.Target_Regions_UInt32s, chests, (uint)chests.Length);
         Interop.HLVR_System_PushEvent(_pluginPtr, enable);
         Interop.HLVR_Event_Destroy(enable);
     }
 }