home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / mvdoc / loadpcm.doc < prev    next >
Text File  |  1993-03-04  |  8KB  |  267 lines

  1. PCMFUN.COM    - TSR for PCM Playback
  2. LOADPCM - Load File into Extended Memory for Background Play
  3.  
  4.  
  5. Explanation
  6.  
  7. "loadpcm.exe" is a program used in conjunction with "pcmfun.com" to 
  8. allow you to play back PCM files in the background, through .bat
  9. files, or by keypress. 
  10.  
  11. Basically, the program allocates extended memory using "himem.sys"
  12. or another compatible XMS provider, loads the sound file into this
  13. memory, then communicates with the TSR informing it of its location, 
  14. handle, samplerate, size, etc.  It also allows you to specify the 
  15. location and size of the DMA buffer.
  16.  
  17.     The DMA buffer is defaulted to B000:0000, which is the
  18.     monochrome screen memory, in order to eliminate the impact
  19.     on conventional memory.
  20.  
  21.     Sophisticated users will be able to determine a location
  22.     in the UMB, used by emm386.exe and other memory managers,
  23.     to "block off" and so use as the DMA buffer.
  24.  
  25.         device=emm386.exe /XE000:EFFF
  26.         C:> loadpcm E000:0 4096 64
  27.  
  28. The program pcmfun.com is used as a TSR to provide PCM playback and
  29. record capabilities.  Used in conjunction with loadpcm.exe, you can 
  30. load sound files into extended memory, then play them back at any 
  31. time by holding down both the left and right shift keys while pressing
  32. any of the many other standard keyboard letters.
  33.  
  34.     The program intercepts L-Shift/R-Shift/Scancode{2-65}.
  35.  
  36. The TSR "pcmfun.com" handles 16-bit, stereo, 44.1Khz PCM files, and 
  37. modifies the data according to the capabilities of the sound card.
  38.  
  39. loadpcm.exe understands .wav files, and will load generic PCM files.
  40.  
  41. The program will also allocate XMS memory for a "record buffer", 
  42. which is activated by L-Shift/R-Shift/ESCAPE to toggle on/off, and
  43. will save this data from the command line.
  44.  
  45. Syntax
  46.  
  47.     pcmfun -i
  48.         This program checks for its own presence, then
  49.         installs into interrupt 94h if it is not found.    
  50.  
  51.     loadpcm dmaaddress paragraphs divisions
  52.  
  53.         This specifies the internal DMA buffer to use.
  54.         The default is to use B000:0000 for 1024 paragraphs
  55.         and 64 divisions.  Example:
  56.  
  57.             loadpcm B000 1024 64
  58.  
  59.     loadpcm {1-64} sound.wav
  60.  
  61.         This will load the file "sound.wav" for that number.
  62.  
  63.     loadpcm {1-64}s sound.wav
  64.  
  65.         This will load the file "sound.wav" for that number,
  66.         but specifies to use the SoundBlaster side of the board.
  67.  
  68.     loadpcm s
  69.  
  70.         This will display the sound numbers used and available.
  71.  
  72.     loadpcm {1-64}
  73.  
  74.         This will information for the specified sound number.
  75.  
  76.     loadpcm {1-64} -d
  77.  
  78.         This will free that particular sound number from memory.
  79.         Note: XMS memory is not freed for a particular handle
  80.         until all sound numbers with that handle have been freed.
  81.  
  82.     loadpcm D
  83.  
  84.         This will delete all of the extended memory used.
  85.  
  86.     keyx {0-255}
  87.  
  88.         This will simulate a LeftShift-RightShift-KEY keypress.
  89.  
  90.     pcmfun -u
  91.  
  92.         This will unload the TSR from memory, as well as free
  93.         all extended memory for all sound numbers.
  94.  
  95.     loadpcm 0 ####
  96.  
  97.         This will allocate ####*16 bytes of XMS for a 
  98.         "record" buffer, activated by L-Shift/R-Shift/ESC.
  99.  
  100.     loadpcm 0 filename.ext
  101.  
  102.         This will prompt to write out the file "filename.ext"
  103.         with the contents of the XMS "record" buffer.  It
  104.         then resets this buffer to start again.
  105.  
  106.  
  107. Examples
  108.  
  109.     C:> pcmfun -i
  110.     94h- Digital Audio   installed.
  111.     09h- Keyboard        installed.
  112.     10h- Video services  installed.
  113.     29h- Fast Putchar()  installed.
  114.     08h- Hardware Timer  installed.
  115.  
  116.         This installs the TSR.
  117.  
  118.     C:> loadpcm B000 2048 16
  119.  
  120.         This tells PCM.COM to use the monochrome monitor
  121.         video memory as the DMA buffer, for 32K.  The default
  122.         is 1024 paragraphs (16K) and 64 divisions.
  123.  
  124.     C:> loadpcm S
  125.     DMABUFFER: B000:0000    2048   16
  126.  
  127.         This causes the program to retrieve the DMA buffer
  128.         information for display, in this case memory at
  129.         B000:0000 for a size of 2048 paragraphs (800h) or
  130.         8000h (32768) bytes, split into 16 divisions.
  131.  
  132.     C:> loadpcm 1 mmelody.wav
  133.     1: PAS H: A916  O:  0    S: 73560  R: 22050 C: 1  D: 8      rsstupid.wav.
  134.  
  135.         This command loads the sound file "mmelody.wav" to    
  136.         be played back using the Leftshift-Rightshift-1 keys
  137.         on the PAS side of the board.
  138.  
  139.     C:> loadpcm 1 mmelody.wav
  140.     1 is being used, free it and replace <y/n>? y
  141.     1: PAS H: A916  O:  0    S:998640  R: 44100 C: 1  D: 8       mmelody.wav.
  142.  
  143.         This illustrates how the program will free the XMS
  144.         memory in use before loading another sound into a
  145.         channel already in use.
  146.  
  147.     C:> loadpcm 1
  148.     1: PAS H: A916  O:  0    S:998640  R: 44100 C: 1  D: 8       mmelody.wav.
  149.  
  150.         This command displays the internal information for
  151.         the specified sound number.  In this case, the file
  152.         is stored using XMS handle A92A, for a size of almost
  153.         a megabyte, played back at 44100Hz in mono, and is 
  154.         output on the PAS side of the board.
  155.  
  156.     C:> loadpcm 2
  157.     0: H:    0  O:    0  S:     0  R:     0 C: 0  D: 0                  .
  158.     
  159.  
  160.         This shows the output of a channel not loaded.
  161.  
  162.     C:> loadpcm 2s goofoff.wav
  163.     1:  SB H: A916  O: 998640 S:  33000 R: 11205 C:1  D: 16      goofoff.wav.
  164.  
  165.         This command loads the sound file "goofoff.wav" to    
  166.         be played back using the Leftshift-Rightshift-1 keys
  167.         on the SB side of the board.  Note that it is a 16-bit
  168.         file, and that the TSR will process it down to 8-bit
  169.         during playback.
  170.  
  171.     C:> pcmfun
  172.     94h- Digital Audio   Not installed - already resident.
  173.     09h- Keyboard        Not installed - already resident.
  174.     10h- Video services  Not installed - already resident.
  175.     29h- Fast Putchar()  Not installed - already resident.
  176.     08h- Hardware Timer  Not installed - already resident.
  177.  
  178.         This shows the output of pcmfun.com when attempting 
  179.         to load the TSR more than once.
  180.  
  181.     C:> keyx 1
  182.  
  183.         This simulates the pressing of LShift-RShift-1, 
  184.         and so can be used in .bat files to start a 
  185.         sound playing during a program load.
  186.  
  187.     C:> stat
  188.     PCM is playing 
  189.  
  190.         This reports on the current activity status of 
  191.         the TSR, indicating that the PAS is playing.
  192.  
  193.  
  194. BAT File Usage
  195.  
  196. When used from a .bat file, the returned "errorlevel" can be checked
  197. to ensure proper program loading and operation.
  198.  
  199.     C:> loadpcm s
  200.     ...
  201.     C:> if errorlevel 2     echo Error: no XMS handler present.
  202.     C:> if errorlevel 1    echo Error: PCM.COM not loaded.
  203.  
  204.     C:> loadpcm 8
  205.     C:> if errorlevel 255    echo Syntax error.
  206.     C:> if errorlevel 8    echo Sound 8 in use.
  207.     C:> if not errorlevel 8    echo Sound 8 available.
  208.  
  209.     C:> loadpcm S
  210.     ...
  211.     C:> if errorlevel 1     echo DMA Buffer is not set - dangerous!
  212.     C:> if not errorlevel 1    echo DMA Buffer is set.
  213.  
  214.     C:> loadpcm 10 \wav\sound.wav
  215.     C:> if errorlevel 255    echo Sound number out of range.
  216.     C:> loadpcm 0 \wav\sound.wav
  217.     C:> if errorlevel 255    echo Sound number out of range.
  218.  
  219.  
  220.     C:> loadpcm 3 \wav\sound.wav
  221.     ...
  222.     C:> if errorlevel 6    echo Error: no XMS memory available.
  223.     C:> if errorlevel 5    echo Error: insufficient conventional memory.
  224.     C:> if errorlevel 4    echo Error: 8- and 16-bit sound files only.
  225.     C:> if errorlevel 3    echo Error: bad sound file.
  226.     C:> if errorlevel 2    echo Error: can not open file.
  227.     C:> if errorlevel 1    echo Warning: Existing sound not replaced.
  228.  
  229.         This series of commands illustrates how to check on
  230.         the status of background-sound availability in a .bat
  231.         file (note that if the errorlevel is 2, then the "if 
  232.         errorlevel == 1" is also true, and so the above will not 
  233.         work as desired (Microsoft(!))).
  234.  
  235. Testing
  236.  
  237. This program has been running for days at a time, with all timers,
  238. random, etc. sounds active, while calculating prime numbers, during
  239. my normal development, or even while recording on the PAS!
  240.  
  241. Requirements
  242.  
  243. MediaVision Pro Audio Spectrum or ThunderBoard or 
  244. Creative Technologies Sound Blaster (any model)
  245.  
  246. himem.sys (or compatible int 2F handler)
  247.  
  248. available XMS memory 
  249.  
  250. Limitations
  251.  
  252. Monochrome screen memory is too slow for 16-bit, 44100Hz files.  The
  253. program "setdma.exe" can be used to allocate a 16K buffer to serve as
  254. the DMA buffer ("freedma.exe" is used to deallocate this memory)  (See
  255. "sfdma.zip" on the Media Vision BBS).
  256.  
  257.  
  258. Miscellaneous
  259.  
  260. The programs can be renamed as desired.  You may receive the program
  261. "loadpcm.exe" named as "lp.exe".
  262.  
  263.  
  264. Copyright (c) 1992.  Media Vision, Inc.  All Rights Reserved.
  265. Programmer: Bart Crane
  266.  
  267.