Ejemplo n.º 1
0
        /// <summary>
        /// Plays a sound through the Linea device
        /// </summary>
        /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
        /// <param name="Device">The targeted device.</param>
        /// <param name="Volume">The sound volume.</param>
        /// <param name="Tones">An even-length array of integers, where the odd elements are frequencies and the even elements are durations.</param>
        public static bool PlayLineaSound(Linea Device, int Volume, int[] Tones)
        {
            //An error object that may be created if the "play sound" attempt is unsuccessful.
            NSError Error;

            //Attempts to play the sound, providing the volume, the tones, and an output error.
            bool Success = Device.PlaySound(Volume, Tones, out Error);

            //Writing the error if one occurred.
            if (Error != null)
            {
                Console.WriteLine(Error.LocalizedDescription);
            }

            return(Success);
        }