Leaked source code of windows server 2003
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.

98 lines
3.0 KiB

  1. /****************************************************************************
  2. MODULE: MIDI_OUT.CPP
  3. Tab stops 5 9
  4. Copyright 1995, 1996, Microsoft Corporation, All Rights Reserved.
  5. PURPOSE: Uses a low-level callback function to get timestamped
  6. MIDI output. The callback function sets an Event to indicate
  7. to wake up a blocked object.
  8. FUNCTIONS:
  9. Author(s): Name:
  10. ---------- ----------------
  11. MEA Manolito E. Adan
  12. Revision History:
  13. -----------------
  14. Version Date Author Comments
  15. ------- ------ ----- -------------------------------------------
  16. 1.0 10-Jan-97 MEA original
  17. ****************************************************************************/
  18. #include <windows.h>
  19. #include <mmsystem.h>
  20. #include <stdio.h>
  21. #include "midi_obj.hpp"
  22. /****************************************************************************
  23. Declaration of externs
  24. ****************************************************************************/
  25. #ifdef _DEBUG
  26. extern char g_cMsg[160];
  27. #endif
  28. // Prototypes
  29. void CALLBACK midiOutputHandler(HMIDIOUT, UINT, DWORD, DWORD, DWORD);
  30. // ----------------------------------------------------------------------------
  31. // Function: midiOutputHandler
  32. // Purpose:
  33. // Parameters: hMidiIn - Handle for the associated output device.
  34. // wMsg - One of the MIM_***** messages.
  35. // dwInstance - Points to CALLBACKINSTANCEDATA structure.
  36. // dwParam1 - MIDI data.
  37. // dwParam2 - Timestamp (in milliseconds)
  38. //
  39. // Returns: none
  40. // Algorithm:
  41. // Comments:
  42. // Low-level callback function to handle MIDI output.
  43. // Installed by midiOutOpen(). The Output handler checks for MM_MOM_DONE
  44. // message and wakes up the thread waiting for completion of MIDI SysEx
  45. // output. Note: Normal Short messages don't get notification!!!
  46. // This function is accessed at interrupt time, so it should be as
  47. // fast and efficient as possible. You can't make any
  48. // Windows calls here, except PostMessage(). The only Multimedia
  49. // Windows call you can make are timeGetSystemTime(), midiOutShortMsg().
  50. // ----------------------------------------------------------------------------
  51. void CALLBACK midiOutputHandler(
  52. IN HMIDIOUT hMidiOut,
  53. IN UINT wMsg,
  54. IN DWORD dwInstance,
  55. IN DWORD dwParam1,
  56. IN DWORD dwParam2)
  57. {
  58. CJoltMidi *pJoltMidi = (CJoltMidi *) dwInstance;
  59. assert(pJoltMidi);
  60. BOOL bRet;
  61. switch(wMsg)
  62. {
  63. case MOM_OPEN:
  64. #ifdef _DEBUG
  65. OutputDebugString("midiOutputHandler: MOM_OPEN.\n");
  66. #endif
  67. break;
  68. case MM_MOM_DONE:
  69. #ifdef _DEBUG
  70. OutputDebugString("midiOutputHandler: MM_MOM_DONE\n");
  71. #endif
  72. // Notify task waiting on this object to trigger
  73. bRet = SetEvent(pJoltMidi->MidiOutputEventHandleOf());
  74. assert(bRet);
  75. break;
  76. default:
  77. #ifdef _DEBUG
  78. OutputDebugString("midiOutputHandler: default case.\n");
  79. #endif
  80. break;
  81. }
  82. }