⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 waveout.cs

📁 功能:基于windows mobile 的地图查看器。使用vs2005开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
		//public static extern Wave.MMSYSERR waveOutPause(IntPtr hwo);
#else
        public static Wave.MMSYSERR waveOutPause(IntPtr hwo)
		{
		  return Wave.MMSYSERR.NOERROR;
		}
#endif

		/// <summary>
		/// This function restarts a paused waveform output device.
		/// </summary>
		/// <param name="hwo">Handle to the waveform-audio output device.</param>
		/// <returns>Error condition</returns>
#if SOUND_SUPPORT
		[DllImport ("coredll.dll")]
		public static extern Wave.MMSYSERR waveOutRestart(IntPtr hwo);
#else
        public static Wave.MMSYSERR waveOutRestart(IntPtr hwo)
		{
		  return Wave.MMSYSERR.NOERROR;
		}
#endif

		/// <summary>
		/// Managed implementation of MMTIME structure.  For this demo, this
		/// structure only supports the DWORD union elements used by
		/// waveOutGetPosition.
		/// 
		/// This structure contains timing information for different types of
		/// multimedia data.
		/// </summary>
		public class MMTIME
		{
			/// <summary>
			/// Time format.
			/// </summary>
			public uint wType = 0;

			/// <summary>
			/// Byte, millisecond, sample, or tick count, depending on wType.
			/// </summary>
			public uint cb = 0;

			/// <summary>
			/// Padding because this is actually a union
			/// </summary>
			public uint pad = 0;
		} 

		/// <summary>
		/// Time in milliseconds.
		/// Used by MMTIME.wType
		/// </summary>
		public const uint TIME_MS = 0x0001;

		/// <summary>
		/// Number of waveform-audio samples.
		/// Used by MMTIME.wType
		/// </summary>
		public const uint TIME_SAMPLES = 0x0002;

		/// <summary>
		/// Current byte offset from beginning of the file.
		/// Used by MMTIME.wType
		/// </summary>
		public const uint TIME_BYTES = 0x0004;

		/// <summary>
		/// Ticks within a MIDI stream.
		/// Used by MMTIME.wType
		/// </summary>
		public const uint TIME_TICKS = 0x0020;

		/// <summary>
		/// This function retrieves the current playback position of the
		/// specified waveform output device.
		/// </summary>
		/// <param name="hwo">Handle to the waveform-audio output device.</param>
		/// <param name="pmmt">Pointer to an MMTIME structure.</param>
		/// <param name="cbmmt">Size, in bytes, of the MMTIME structure.</param>
		/// <returns>Error condition</returns>
#if SOUND_SUPPORT
		//[DllImport ("coredll.dll")]
		//public static extern int waveOutGetPosition(IntPtr hwo, MMTIME pmmt, uint cbmmt); 
#else
        public static int waveOutGetPosition(IntPtr hwo, MMTIME pmmt, uint cbmmt)
		{
		  return 0;
		}
#endif

		/// <summary>
		/// Managed implementation of WAVEOUTCAPS structure.  Because this struct
		/// contains an embedded TCHAR array of length 32, it is implemented as
		/// a byte array where each member is accessed with a property.
		/// 
		/// This structure describes the capabilities of a waveform-audio output
		/// device.
		/// </summary>
		public class WAVEOUTCAPS
		{
			/// <summary>
			/// Size of this structure.
			/// </summary>
			const uint WAVEOUTCAPS_SIZE = 84;

			/// <summary>
			/// Implicitly cast to a byte array so it can be used inline.
			/// </summary>
			/// <param name="caps">Instance to be cast</param>
			/// <returns>byte[] representing the class data</returns>
			public static implicit operator byte[](WAVEOUTCAPS caps)
			{
				return caps.m_data;
			}

			/// <summary>
			/// Data that represents the class.
			/// </summary>
			private byte[] m_data = null;

			/// <summary>
			/// Size of the WAVEOUTCAPS structure.
			/// </summary>
			public uint Size { get { return (uint)WAVEOUTCAPS_SIZE; } }

			/// <summary>
			/// Manufacturer identifier for the device driver for the device.
			/// Manufacturer identifiers are defined in Manufacturer and Product
			/// Identifiers.
			/// </summary>
			public ushort wMid { get { return BitConverter.ToUInt16(m_data, 0); } }

			/// <summary>
			/// Product identifier for the device. Product identifiers are defined
			/// in Manufacturer and Product Identifiers.
			/// </summary>
			public ushort wPid { get { return BitConverter.ToUInt16(m_data, 2); } }

			/// <summary>
			/// Version number of the device driver for the device. The high-order
			/// byte is the major version number, and the low-order byte is the
			/// minor version number.
			/// </summary>
			public uint vDriverVersion { get { return BitConverter.ToUInt32(m_data, 4); } }

			/// <summary>
			/// Specifies the standard formats that are supported.  See Wave.cs
			/// </summary>
			public uint dwFormats { get { return BitConverter.ToUInt32(m_data, 72); } }

			/// <summary>
			/// Number specifying whether the device supports mono (1) or stereo
			/// (2) output.
			/// </summary>
			public ushort wChannels { get { return BitConverter.ToUInt16(m_data, 76); } }

			/// <summary>
			/// Packing.
			/// </summary>
			public ushort wReserved1 { get { return BitConverter.ToUInt16(m_data, 78); } }

			/// <summary>
			/// Specifies the optional functionality supported by the device.
			/// See Wave.cs.
			/// </summary>
			public uint dwSupport { get { return BitConverter.ToUInt16(m_data, 80); } }

			/// <summary>
			/// Create an instance of WAVEOUTCAPS by allocating data storage.
			/// </summary>
			public WAVEOUTCAPS()
			{
				m_data = new byte[WAVEOUTCAPS_SIZE];
			}

			/// <summary>
			/// String that contains the product name.
			/// </summary>
			public string szPname
			{
				get
				{
					char[] bytes = new char[32];
					for (int i = 0; i < 32; i++)
					{
						bytes[i] = (char)BitConverter.ToUInt16(m_data, i * 2 + 8);
					}

					return new string(bytes);
				}
			}
		}
 
		/// <summary>
		/// This function queries a specified waveform device to determine its
		/// capabilities.
		/// </summary>
		/// <param name="uDeviceID">Identifier of the waveform-audio output device.
		/// It can be either a device identifier or a Handle to an open waveform-
		/// audio output device.</param>
		/// <param name="pwoc">Pointer to a WAVEOUTCAPS structure to be filled
		/// with information about the capabilities of the device.</param>
		/// <param name="cbwoc">Size, in bytes, of the WAVEOUTCAPS structure.</param>
		/// <returns>Error condition</returns>
#if SOUND_SUPPORT
		[DllImport ("coredll.dll")]
		public static extern Wave.MMSYSERR waveOutGetDevCaps(uint uDeviceID, byte[] pwoc, uint cbwoc);
#else
        public static Wave.MMSYSERR waveOutGetDevCaps(uint uDeviceID, byte[] pwoc, uint cbwoc)
		{
		  return Wave.MMSYSERR.NOERROR;
		}
#endif
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -