You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7 KiB

  1. using System;
  2. using System.Runtime.InteropServices;
  3. using System.Security;
  4. namespace Apewer.Internals.Interop
  5. {
  6. [SecuritySafeCritical]
  7. internal class WinMM
  8. {
  9. #region WinMM
  10. internal const int MMIO_FINDRIFF = 32;
  11. internal const int WAVE_FORMAT_PCM = 1;
  12. internal const int WAVE_FORMAT_ADPCM = 2;
  13. internal const int WAVE_FORMAT_IEEE_FLOAT = 3;
  14. internal const int MMIO_READ = 0;
  15. internal const int MMIO_ALLOCBUF = 65536;
  16. internal const int SND_SYNC = 0;
  17. internal const int SND_ASYNC = 1;
  18. internal const int SND_NODEFAULT = 2;
  19. internal const int SND_MEMORY = 4;
  20. internal const int SND_LOOP = 8;
  21. internal const int SND_PURGE = 64;
  22. internal const int SND_FILENAME = 131072;
  23. internal const int SND_NOSTOP = 16;
  24. [DllImport("winmm.dll")]
  25. public static extern long mciGetCreatorTask(long wDeviceID);
  26. [DllImport("winmm.dll")]
  27. public static extern long mciGetDeviceID(string lpstrName);
  28. [DllImport("winmm.dll", SetLastError = true)]
  29. public static extern long mciSendString(string lpstrCommand, ref string lpstrReturnString, int uReturnLength, IntPtr hwndCallback);
  30. [DllImport("WinMm.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]
  31. public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
  32. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  33. public static extern IntPtr mmioOpen(string fileName, IntPtr not_used, int flags);
  34. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  35. public static extern int mmioAscend(IntPtr hMIO, MMCKINFO lpck, int flags);
  36. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  37. public static extern int mmioDescend(IntPtr hMIO, [MarshalAs(UnmanagedType.LPStruct)] MMCKINFO lpck, [MarshalAs(UnmanagedType.LPStruct)] MMCKINFO lcpkParent, int flags);
  38. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  39. public static extern int mmioRead(IntPtr hMIO, [MarshalAs(UnmanagedType.LPArray)] byte[] wf, int cch);
  40. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  41. public static extern int mmioClose(IntPtr hMIO, int flags);
  42. [DllImport("winmm.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
  43. public static extern bool PlaySound(byte[] soundName, IntPtr hmod, int soundFlags);
  44. [DllImport("winmm.dll", CharSet = CharSet.Auto)]
  45. public static extern bool PlaySound([MarshalAs(UnmanagedType.LPWStr)] string soundName, IntPtr hmod, int soundFlags);
  46. [DllImport("winmm.dll")]
  47. public static extern long sndPlaySound(string lpszSoundName, long uFlags);
  48. #endregion
  49. }
  50. }