home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / mmintr.zip / mmintro.asc next >
Text File  |  1994-02-13  |  5KB  |  241 lines

  1. OS/2 Multimedia Basics
  2.  
  3. The multimedia support that comes with OS/2 2.1 (called MMPM/2)
  4. allows any OS/2 program (including REXX command files) to play
  5. movies, audio files and MIDI files.  MMPM/2 uses the Media
  6. Control Interface (or MCI) to provide a device-independent means
  7. of controlling multimedia devices.  If you are familiar with the
  8. Windows(TM) MCI interface, OS/2's MCI is somewhat similar,
  9. although it contains a lot more function to make your
  10. programming life easier.
  11.  
  12.  
  13.  
  14. This document is aimed primarily at the new MMPM/2 programmer or
  15. those who'd like to ensure that their application properly
  16. exploits MMPM/2. 
  17.  
  18. Device Sharing
  19.  
  20. If you have a programming background in other multimedia
  21. environments (i.e. DOS, Windows etc.), you realize that you must
  22. go through a lot of processing in order to attempt to share the
  23. multimedia devices your program uses.  Fortunately, MMPM/2
  24. handles all of these sharing issues for you, if your program
  25. must follow these steps:
  26.  
  27.  
  28.  
  29. Open the device with the MCI_OPEN_SHAREABLE flag (or use
  30. MCI_RELEASEDEVICE) to make the device shareable
  31.  
  32. Process the MM_MCIPASSDEVICE message.
  33.  
  34.  
  35.  
  36. The first requirement is rather easy.  Simply use the
  37. MCI_OPEN_SHAREABLE flag on the MCI_OPEN message.
  38.  
  39.  
  40.  
  41. The second requirement is to process MM_MCIPASSDEVICE.  This
  42. message will either indicate that you have control over, or lost
  43. control of the multimedia device.  If you get the 
  44. MM_MCIPASSDEVICE message informing you that you lost use of the
  45. device, your application must do an MCI_ACQUIREDEVICE before
  46. issuing another MCI command.  
  47.  
  48.  
  49.  
  50. The MMPM/2 toolkit contains two programs which illustrate the
  51. use of this command:
  52.  
  53.  
  54.  
  55. The recorder sample
  56.  
  57. Clock example
  58.  
  59.  
  60.  
  61. Multi-Instance Drivers
  62.  
  63.  
  64.  
  65. MMPM/2 uses multi-instance audio and video drivers in order to
  66. perform the device sharing.  The statement below is a pretty
  67. concise definition of what multi-instance means:
  68.  
  69.  
  70.  
  71. Multi-instance: the ability for more than one OS/2 application
  72. at once to open the sound card.  This is important if you want
  73. to do any serious activity with multimedia.  For instance, a
  74. multi-instance driver will allow you to open the digital audio
  75. editor and hear system sounds or open a MIDI application. 
  76. Without this, you must close each application down before
  77. starting another (very inconvenient).
  78.  
  79.  
  80.  
  81. From the programmer's perspective, multi-instance means the
  82. following things:
  83.  
  84.  
  85.  
  86. If you support device sharing, you support multi-instance.
  87.  
  88.  
  89.  
  90. Multimedia Awareness
  91.  
  92.  
  93.  
  94. If your application is not totally dependent on MMPM/2, you
  95. probably want to be able to run even if the user has not
  96. installed multimedia support.  If you link directly to MMPM2.LIB
  97. and multimedia is not installed, then your application will trap
  98. when it is run.  To work around this problem, you should take
  99. the following steps:
  100.  
  101.  
  102.  
  103. Do a DosLoadModule on MDM.DLL (or MMIO.DLL if you are calling
  104. MMIO functions).
  105.  
  106. Do a DosQueryProcAddr address on the function you want to call
  107. (i.e. mciSendString) and save this as a function pointer.
  108.  
  109. Use the function pointer obtained in step two for your
  110. multimedia calls.
  111.  
  112.  
  113.  
  114. Unique OS/2 MCI Commands
  115.  
  116.  
  117.  
  118. The following MCI commands are unique to MMPM/2 and can really
  119. maximize this 32-bit environment:
  120.  
  121.  
  122.  
  123. MCI_SETPOSITIONADVISE.  Allows your application to be notified
  124. on a recurring basis about the current media position.
  125.  
  126. MCI_SETCUEPOINT.  Allows notification at specified media
  127. positions.
  128.  
  129. MCI_UNDO/MCI_REDO/MCI_CUT/MCI_COPY/MCI_PASTE.  MMPM/2 offers
  130. unlimited undo/redo operations and easy to use clipboard
  131. controls.
  132.  
  133. MCI_AQUIREDEVICE/MCI_RELEASEDEVICE.  Allows sharing of devices.
  134.  
  135. MCI_CONNECTOR command to allow access to a full-function
  136. amp-mxier
  137.  
  138.  
  139.  
  140. The following MCI flags are unique to MMPM/2 and can really
  141. maximize this 32-bit environment:
  142.  
  143.  
  144.  
  145. MCI_OPEN_PLAYLIST.  Allows you to play memory buffers from MCI.
  146.  
  147. MCI_NOTIFY.  Allows your commands to operate on a separate
  148. thread.
  149.  
  150. MMIO (and I/O Procedures)
  151.  
  152.  
  153.  
  154. All MCI drivers (and therefore all MCI programs) use the
  155. Multimedia I/O interface to communicate with the file system.
  156.  
  157.  
  158.  
  159. This provides the following advantages:
  160.  
  161.  
  162.  
  163. File format independence
  164.  
  165. Automatic format recognition
  166.  
  167. Smaller program code.
  168.  
  169.  
  170.  
  171. If your program will be accessing multimedia files directly, it
  172. is recommended that you use the MMIO interface to process the
  173. files.
  174.  
  175.  
  176.  
  177. Sources of Information
  178.  
  179. For information on multimedia performance and OS/2:
  180.  
  181.  
  182.  
  183. See the OS/2 Developer's Connection Issue #3.
  184.  
  185. See OS/2 Developer, Multimedia Special Issue (May/June 1994).
  186.  
  187.  
  188.  
  189. Generic multimedia overviews):
  190.  
  191.  
  192.  
  193. The first two OS/2 Developer's Connection CDs.
  194.  
  195. Many back issues of OS/2 Developer.
  196.  
  197. Byte --August 1993.  "Under the Hood:  Multimedia
  198. Infrastructures".
  199.  
  200.  
  201.  
  202. Audio overview (playing from memory buffers).
  203.  
  204.  
  205.  
  206. See the Electronic OS/2 Developer (vol. 2, Issue 1).
  207.  
  208. See the OS/2 Developer's Connection Issue #3.
  209.  
  210. See OS/2 Developer, Multimedia Special Issue (May/June)
  211.  
  212.  
  213.  
  214. Software Motion Video Architecture
  215.  
  216.  
  217.  
  218. Dr. Dobbs Multimedia Special Editon--1993
  219.  
  220.  
  221.  
  222. Toolkit and Header Files
  223.  
  224. OS/2 2.1 Toolkit CD-ROM
  225.  
  226. Developer's Connection CD-ROM
  227.  
  228. C-Set++ CD-ROM
  229.  
  230.  
  231.  
  232. Online Help
  233.  
  234. MMPM/2 section of OS2DF1 on CompuServe
  235.  
  236. COMP.OS.OS2.MULTIMEDIA, COMP.OS.OS2.PROGRAMMER.MISC or
  237. COMP.OS.OS2.PROGRAMMER on Internet.
  238.  
  239.  
  240.  
  241.