Example #1
0
        public void Soft()
        {
            try
            {
                Thread t = new Thread(new ThreadStart(delegate()
                {
                    Haptics.HapticsNote[] _hapticsNotes = new Haptics.HapticsNote[1];
                    _hapticsNotes[0].magnitude          = 20;

                    _hapticsNotes[0].startingMagnitude = 0;
                    _hapticsNotes[0].startTimeDuration = 0;

                    _hapticsNotes[0].duration = 100;

                    _hapticsNotes[0].endTimeDuration = 0;
                    _hapticsNotes[0].endingMagnitude = 0;

                    _hapticsNotes[0].style  = Haptics.NoteStyle.Sharp;
                    _hapticsNotes[0].period = 2;

                    Haptics.PlayNotes(handle, 1, _hapticsNotes, false, null);
                }));
                t.Start();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message, "Haptic.Soft");
            }
        }
Example #2
0
        private void TimerHit(object state)
        {
            Haptics.HapticsNote[] _hapticsNotes = new Haptics.HapticsNote[1];
            _hapticsNotes[0].magnitude = 20;

            _hapticsNotes[0].startingMagnitude = 0;
            _hapticsNotes[0].startTimeDuration = 0;

            _hapticsNotes[0].duration = 50;

            _hapticsNotes[0].endTimeDuration = 0;
            _hapticsNotes[0].endingMagnitude = 0;

            _hapticsNotes[0].style  = Haptics.NoteStyle.Sharp;
            _hapticsNotes[0].period = 50;

            Haptics.PlayNotes(handle, 1, _hapticsNotes, false, null);
        }
        public bool Play()
        {
            bool result = true;

#if SAMSUNG
            m_hapticsNotes[0].magnitude = 255;
            SmiResultCode r = Haptics.PlayNotes(m_hapticsHandle, 1, m_hapticsNotes, false, m_defaultHapticsNotification);

            return(r == SmiResultCode.Success);
#endif
            return(result);

            ////if (NativeMethods.VibratePlay(0, IntPtr.Zero, uint.MaxValue, uint.MaxValue) != 0)
            //if (NativeMethods.VibratePlay(0, IntPtr.Zero, 1, NativeMethods.INFINITE) != 0)
            //{
            //    return false;
            //}
            //return true;
        }