static public SmiResultCode PlayNotes(int handle, uint noteCount, HapticsNote[] notes, bool repeat, Notification callback) { CallbackItem item = new CallbackItem(); c_Notification cN = new c_Notification(Haptics.NotificationCallbakHandler); item.callback = callback; item.handle = handle; item.notesArray = notes; item.c_callback = cN; // reserve callback until callback is done lock (_locker) { // protect the _list inside of critical section _list.Add(item); } SmiResultCode result = c_PlayNotes(handle, noteCount, notes, repeat, cN); //System.Console.WriteLine("@PlayNotes handle = " + handle); //System.Console.WriteLine("@PlayNotes noteCount = " + noteCount); //System.Console.WriteLine("@PlayNotes repeat = " + repeat); //System.Console.WriteLine("@PlayNotes result = " + result); return(result); }
public static SmiResultCode GetCapabilities(ref Capabilities capability) { c_Capabilities c = new c_Capabilities(); SmiResultCode result = c_GetCapabilities(ref c); if (result == SmiResultCode.Success) { capability.maxPeriod = c.maxPeriod; capability.minPeriod = c.minPeriod; capability.noteStyle = c.noteStyle; capability.pauseResume = c.pauseResume; capability.periodicPlay = c.periodicPlay; capability.startEndMag = c.startEndMag; } return(result); }
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; }