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.

262 lines
6.6 KiB

  1. Conversion of mci midi sequencer.
  2. Originals on \\sysuk1\data\win31mm\src\sonic\mciseq
  3. List utility
  4. ------------
  5. LIST H 1238 - List management definitions
  6. LIST C 5648 - Memory management
  7. SUPPORT C ** NEW FOR NT ** (replace .asm etc).
  8. Common header file
  9. ------------------
  10. MMSYS H 7810 - Common definitions for MCI and SEQ
  11. MCI processing
  12. --------------
  13. MCISEQ H 5410 - Definitions for MCI part of driver
  14. MCICMDS C 23354 - Commands from mciDriverEntry - msXxx
  15. MCISEQ C 36751 - DriverProc -> mciDriverEntry
  16. CALLBACK C 2147 - Sequencer callback
  17. FORMATS C 10845 - Time formats
  18. -- Convert to passing around MMTIME structures ?
  19. Sequencer
  20. ---------
  21. MMSEQI H 13524 - Definitions local to mmseq.c (internal sequencer)
  22. MMSEQ C 63220 - midiSeqMessage - the sequencer
  23. MMSEQ D 3116 - Doc
  24. UTIL C 21200 - callback, track and timer helpers for sequencer
  25. Other bits (not reqd for NT)
  26. ----------------------------
  27. TASK ASM 2856 - interface to mmTask (why ?)
  28. CRIT ASM 1895 - critical sections
  29. MCISEQ DEF 304 - def file
  30. DATA FLOW
  31. ==================================================================
  32. MCI (MMSYS.H) SEQ
  33. midiSeqMessage
  34. (SEQ_...)
  35. --------------------->
  36. MIDISEQINFO
  37. MIDISEQOPEN
  38. MIDISEQHDR
  39. MIDISEQCALLBACK
  40. (MIDISEQ_...)
  41. DONE -> TaskSignal - TO stream task
  42. DONEPLAY -> TaskSignal - TO stream task
  43. RESET -> StreamTrackReset -> TaskSignal
  44. <---------------------
  45. MIDISEQERR_...
  46. <---------------------
  47. ==================================================================
  48. Notes :
  49. mciGetDriverData returns a pointer to the stream - SeqStreamType so
  50. the stream is equated to a logical device.
  51. GETMOTWORD = 'Get Motorola word' (!)
  52. Within the timer interrupt routine use the critical section to get
  53. the other side of the mutual exclusion.
  54. SERIALIZATION : A critical section is used which is held over calls
  55. to mciDriverEntry and in the sequencer tasks but released when
  56. getting messages (blocking) or temporarily while yielding.
  57. STRUCTURE
  58. =========
  59. DRV_... + MCI_... messages
  60. (mciseq.c!DriverEntry)
  61. |
  62. V
  63. MCI messages :
  64. (mciseq.c!mciDriverEntry)
  65. MCI_OPEN_DRIVER
  66. mcicmds.c!msOpen
  67. MCI_CLOSE_DRIVER
  68. mcicmds.c!msClose
  69. MCI_PLAY
  70. mcicmds.c!msPlay
  71. MCI_PAUSE
  72. MCI_STOP
  73. mmseq.c!midiSeqMessage SEQ_SETPORTOFF
  74. MCI_SEEK
  75. mcicmds.c!msSeek
  76. MCI_STATUS
  77. mcicmds.c!msStatus
  78. MCI_GETDEVCAPS
  79. mcicmds.c!msGetDevCaps
  80. MCI_INFO
  81. mcicmds.c!msInfo
  82. MCI_SET
  83. mcicmds.c!msSet
  84. Rest unsupported
  85. MMSEQ messages :
  86. (mmseq.c!midiSeqMessage)
  87. SEQ_OPEN
  88. ....................................................................
  89. Tasking structure :
  90. -------------------
  91. Application task :
  92. mcicmds.c!msOpen
  93. |
  94. V
  95. mciseq.c!msOpenStream -> mmTaskCreate with routine mciStreamCycle
  96. |
  97. V
  98. TaskSignal
  99. PostAppMessage
  100. .
  101. . WTM_QUITTASK, WTM_DONEPLAY, WTM_FILLBUFFER
  102. .
  103. Sequencer task :
  104. GetMessage
  105. TaskBlock
  106. |
  107. V
  108. mciseq.c!mciStreamCycle
  109. |
  110. V
  111. mmseq.c!midiSeqMessage - SEQ_TRACKDATA, SEQ_SETPORTOFF
  112. | SEQ_GETINFO
  113. V
  114. NewTrackData
  115. mciStreamCycle just keeps the buffers for the current stream stoked up.
  116. Thus : there is 1 (extra) task PER LOGICAL DEVICE.
  117. There is 1 SEQ structure per task and 1 stream structure per task (which
  118. contains an HMIDISEQ handle hSeq to the SEQ structure). The SEQ
  119. structure remembers the HTASK.
  120. The SeqStreamType structure is the per-stream data on the MCI side.
  121. This is unfortunately shared between application and stream tasks.
  122. There is no need to inhibit threading between sequencer tasks, only
  123. between the main task and associated sequencer tasks.
  124. Use of Yield etc :
  125. mciseq.c!msOpenStream - appears to have a spurious yield near the start
  126. mcicmds.c!msOpen - calls Yield to allow the stream task to start
  127. properly. We need to force this to happen now. Note that this
  128. is subtle because multiple people might be running - so we
  129. probably need a special event per task.
  130. mcicmds.c!msPlay - sits in a loop at the moment ! Need the event
  131. again.
  132. mmseq NEVER yields or blocks
  133. mciseq.c!mciStreamCycle :
  134. TaskBlock near start when finished init - other side of
  135. Yield in msOpen. Also later Blocks again for more work.
  136. This is the other side of msPlay ?
  137. mmTaskYeild - probably unnecessary since nothing was kicked off ?
  138. ......................................................................
  139. MIDISEQ_DONE
  140. Timers :
  141. ========
  142. util.c!OneShotTimer has pointer to NPSEQ structure passed to it.
  143. |
  144. --> mmseq.c!TimerIntRoutine
  145. |
  146. |
  147. util.c!MIDICallback
  148. Conversion Issues
  149. tasking
  150. File format
  151. Seems OK because :
  152. 1. mmio... is used to get at the chunks
  153. 2. The data is in big-endian format and macros are used which will
  154. work for either format (GETMODWORD, GETMOTDWORD etc).
  155. file access
  156. OK - via MMIO
  157. parameter sizes
  158. api
  159. build
  160. globals
  161. list.c - arrayOfLists
  162. window messages
  163. alignment / structure packing / structure overlays
  164. Comments :
  165. ==========
  166. 1. This code is essentially uncommented. On the positive side the
  167. structure is reasonably clean (though overcomplex and relying
  168. on 'messages' (untyped calls) rather than subroutine calls which
  169. means many bugs will get by the compiler into runtime code.
  170. BUGS
  171. ====
  172. Pointer to MMIOPROC in mcicmds.c should be pointer to pointer to.