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.

149 lines
4.3 KiB

  1. /****************************************************************************
  2. MODULE: HAU_MIDI.CPP
  3. Tab stops 5 9
  4. Copyright 1995, 1996, Microsoft Corporation, All Rights Reserved.
  5. PURPOSE: Methods for Jolt Midi device command Protocol
  6. FUNCTIONS: Classes methods
  7. Author(s): Name:
  8. ---------- ----------------
  9. MEA Manolito E. Adan
  10. Revision History:
  11. -----------------
  12. Version Date Author Comments
  13. ------- ------ ----- -------------------------------------------
  14. 1.0 02-Apr-96 MEA Original
  15. 19-Sep-96 MEA Removed ES1.0 specific code
  16. 05-Dec-96 MEA Removed ALLACK debug switch
  17. 1.1 17-Mar-97 MEA DX-FF mode
  18. 14-Apr-97 MEA Added support for RTC spring
  19. 21-Mar-99 waltw Removed unreferenced ModifyEnvelopeParams,
  20. ModifyEffectParams, MapEnvelope, CMD_ModifyParamByIndex,
  21. CMD_Download_RTCSpring
  22. ****************************************************************************/
  23. #include <windows.h>
  24. #include <mmsystem.h>
  25. #include <assert.h>
  26. #include "hau_midi.hpp"
  27. #include "midi.hpp"
  28. #include "midi_obj.hpp"
  29. #include "dx_map.hpp"
  30. #include "sw_objec.hpp"
  31. #include "ffd_swff.hpp"
  32. #include "joyregst.hpp"
  33. #include "FFDevice.h"
  34. #include "CritSec.h"
  35. /****************************************************************************
  36. Declaration of externs
  37. ****************************************************************************/
  38. /****************************************************************************
  39. Declaration of variables
  40. ****************************************************************************/
  41. //
  42. // Globals specific to hau_midi
  43. //
  44. #ifdef _DEBUG
  45. extern char g_cMsg[160];
  46. #endif
  47. //
  48. // --- EFFECT_CMDs
  49. //
  50. // *** ---------------------------------------------------------------------***
  51. // Function: CMD_SetIndex
  52. // Purpose: Sets the autoincrementing Index for MODIFY_CMD
  53. // Parameters:
  54. // IN int nIndex - Index value 0 - 15
  55. // IN DNHANDLE DnloadID - Effect ID in stick
  56. //
  57. // Returns: SUCCESS if successful command sent, else
  58. // SFERR_INVALID_OBJECT
  59. // SFERR_NO_SUPPORT
  60. // SFERR_INVALID_PARAM
  61. // Algorithm:
  62. //
  63. // Comments:
  64. // Byte 0 = EFFECT_CMD + Channel #
  65. // D7 D6 D5 D4 D3 D2 D1 D0
  66. // -- -- -- -- -- -- -- --
  67. // Byte 1 = SET_INDEX+index 0 1 i i i i 0 0
  68. // Byte 2 = EffectID (7 bits) 0 E E E E E E E
  69. //
  70. // *** ---------------------------------------------------------------------***
  71. HRESULT CMD_SetIndex(
  72. IN int nIndex,
  73. IN DNHANDLE DnloadID)
  74. {
  75. ASSUME_NOT_REACHED();
  76. return SUCCESS;
  77. }
  78. // *** ---------------------------------------------------------------------***
  79. // Function: CMD_ModifyParam
  80. // Purpose: Modifies an Effect parameter
  81. // Parameters:
  82. // IN WORD dwNewParam - 14 bit (signed) parameter value
  83. //
  84. // Returns: SUCCESS if successful command sent, else
  85. // SFERR_INVALID_OBJECT
  86. // SFERR_NO_SUPPORT
  87. // SFERR_INVALID_PARAM
  88. // Algorithm:
  89. //
  90. // Comments:
  91. // Byte 0 = MODIFY_CMD + Channel #
  92. // D7 D6 D5 D4 D3 D2 D1 D0
  93. // -- -- -- -- -- -- -- --
  94. // Byte 1 = Low 7 bits data 0 v v v v v v v
  95. // Byte 2 = High 7 bits data 0 v v v v v v v
  96. //
  97. // *** ---------------------------------------------------------------------***
  98. HRESULT CMD_ModifyParam(
  99. IN WORD wNewParam)
  100. {
  101. ASSUME_NOT_REACHED();
  102. return SUCCESS;
  103. /*
  104. HRESULT hRet;
  105. BYTE cByte1, cByte2;
  106. cByte1 = wNewParam & 0x7f;
  107. cByte2 = (BYTE) ((wNewParam >> 7) & 0x7f);
  108. hRet = g_pJoltMidi->MidiSendShortMsg(MODIFY_CMD, cByte1, cByte2);
  109. if (SUCCESS != hRet)
  110. return (g_pJoltMidi->LogError(SFERR_DRIVER_ERROR,
  111. DRIVER_ERROR_MIDI_OUTPUT));
  112. // Note: ModifyParam used to not require an ACK/NACK
  113. ACKNACK AckNack = {sizeof(ACKNACK)};
  114. // hRet = g_pJoltMidi->GetAckNackData(SHORT_MSG_TIMEOUT, &AckNack);
  115. hRet = g_pJoltMidi->GetAckNackData(FALSE, &AckNack, g_ForceFeedbackDevice.GetAckNackMethod(REGBITS_MODIFYPARAM));
  116. // :
  117. if (SUCCESS != hRet) return (SFERR_DRIVER_ERROR);
  118. if (ACK != AckNack.dwAckNack)
  119. return (g_pJoltMidi->LogError(SFERR_DEVICE_NACK, AckNack.dwErrorCode));
  120. return (hRet);
  121. */
  122. }
  123. //
  124. // --- SYSTEM_CMDs
  125. //
  126. //
  127. // --- System Exclusive Commands
  128. //