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 >
Wrap
Text File
|
1993-03-04
|
8KB
|
267 lines
PCMFUN.COM - TSR for PCM Playback
LOADPCM - Load File into Extended Memory for Background Play
Explanation
"loadpcm.exe" is a program used in conjunction with "pcmfun.com" to
allow you to play back PCM files in the background, through .bat
files, or by keypress.
Basically, the program allocates extended memory using "himem.sys"
or another compatible XMS provider, loads the sound file into this
memory, then communicates with the TSR informing it of its location,
handle, samplerate, size, etc. It also allows you to specify the
location and size of the DMA buffer.
The DMA buffer is defaulted to B000:0000, which is the
monochrome screen memory, in order to eliminate the impact
on conventional memory.
Sophisticated users will be able to determine a location
in the UMB, used by emm386.exe and other memory managers,
to "block off" and so use as the DMA buffer.
device=emm386.exe /XE000:EFFF
C:> loadpcm E000:0 4096 64
The program pcmfun.com is used as a TSR to provide PCM playback and
record capabilities. Used in conjunction with loadpcm.exe, you can
load sound files into extended memory, then play them back at any
time by holding down both the left and right shift keys while pressing
any of the many other standard keyboard letters.
The program intercepts L-Shift/R-Shift/Scancode{2-65}.
The TSR "pcmfun.com" handles 16-bit, stereo, 44.1Khz PCM files, and
modifies the data according to the capabilities of the sound card.
loadpcm.exe understands .wav files, and will load generic PCM files.
The program will also allocate XMS memory for a "record buffer",
which is activated by L-Shift/R-Shift/ESCAPE to toggle on/off, and
will save this data from the command line.
Syntax
pcmfun -i
This program checks for its own presence, then
installs into interrupt 94h if it is not found.
loadpcm dmaaddress paragraphs divisions
This specifies the internal DMA buffer to use.
The default is to use B000:0000 for 1024 paragraphs
and 64 divisions. Example:
loadpcm B000 1024 64
loadpcm {1-64} sound.wav
This will load the file "sound.wav" for that number.
loadpcm {1-64}s sound.wav
This will load the file "sound.wav" for that number,
but specifies to use the SoundBlaster side of the board.
loadpcm s
This will display the sound numbers used and available.
loadpcm {1-64}
This will information for the specified sound number.
loadpcm {1-64} -d
This will free that particular sound number from memory.
Note: XMS memory is not freed for a particular handle
until all sound numbers with that handle have been freed.
loadpcm D
This will delete all of the extended memory used.
keyx {0-255}
This will simulate a LeftShift-RightShift-KEY keypress.
pcmfun -u
This will unload the TSR from memory, as well as free
all extended memory for all sound numbers.
loadpcm 0 ####
This will allocate ####*16 bytes of XMS for a
"record" buffer, activated by L-Shift/R-Shift/ESC.
loadpcm 0 filename.ext
This will prompt to write out the file "filename.ext"
with the contents of the XMS "record" buffer. It
then resets this buffer to start again.
Examples
C:> pcmfun -i
94h- Digital Audio installed.
09h- Keyboard installed.
10h- Video services installed.
29h- Fast Putchar() installed.
08h- Hardware Timer installed.
This installs the TSR.
C:> loadpcm B000 2048 16
This tells PCM.COM to use the monochrome monitor
video memory as the DMA buffer, for 32K. The default
is 1024 paragraphs (16K) and 64 divisions.
C:> loadpcm S
DMABUFFER: B000:0000 2048 16
This causes the program to retrieve the DMA buffer
information for display, in this case memory at
B000:0000 for a size of 2048 paragraphs (800h) or
8000h (32768) bytes, split into 16 divisions.
C:> loadpcm 1 mmelody.wav
1: PAS H: A916 O: 0 S: 73560 R: 22050 C: 1 D: 8 rsstupid.wav.
This command loads the sound file "mmelody.wav" to
be played back using the Leftshift-Rightshift-1 keys
on the PAS side of the board.
C:> loadpcm 1 mmelody.wav
1 is being used, free it and replace <y/n>? y
1: PAS H: A916 O: 0 S:998640 R: 44100 C: 1 D: 8 mmelody.wav.
This illustrates how the program will free the XMS
memory in use before loading another sound into a
channel already in use.
C:> loadpcm 1
1: PAS H: A916 O: 0 S:998640 R: 44100 C: 1 D: 8 mmelody.wav.
This command displays the internal information for
the specified sound number. In this case, the file
is stored using XMS handle A92A, for a size of almost
a megabyte, played back at 44100Hz in mono, and is
output on the PAS side of the board.
C:> loadpcm 2
0: H: 0 O: 0 S: 0 R: 0 C: 0 D: 0 .
This shows the output of a channel not loaded.
C:> loadpcm 2s goofoff.wav
1: SB H: A916 O: 998640 S: 33000 R: 11205 C:1 D: 16 goofoff.wav.
This command loads the sound file "goofoff.wav" to
be played back using the Leftshift-Rightshift-1 keys
on the SB side of the board. Note that it is a 16-bit
file, and that the TSR will process it down to 8-bit
during playback.
C:> pcmfun
94h- Digital Audio Not installed - already resident.
09h- Keyboard Not installed - already resident.
10h- Video services Not installed - already resident.
29h- Fast Putchar() Not installed - already resident.
08h- Hardware Timer Not installed - already resident.
This shows the output of pcmfun.com when attempting
to load the TSR more than once.
C:> keyx 1
This simulates the pressing of LShift-RShift-1,
and so can be used in .bat files to start a
sound playing during a program load.
C:> stat
PCM is playing
This reports on the current activity status of
the TSR, indicating that the PAS is playing.
BAT File Usage
When used from a .bat file, the returned "errorlevel" can be checked
to ensure proper program loading and operation.
C:> loadpcm s
...
C:> if errorlevel 2 echo Error: no XMS handler present.
C:> if errorlevel 1 echo Error: PCM.COM not loaded.
C:> loadpcm 8
C:> if errorlevel 255 echo Syntax error.
C:> if errorlevel 8 echo Sound 8 in use.
C:> if not errorlevel 8 echo Sound 8 available.
C:> loadpcm S
...
C:> if errorlevel 1 echo DMA Buffer is not set - dangerous!
C:> if not errorlevel 1 echo DMA Buffer is set.
C:> loadpcm 10 \wav\sound.wav
C:> if errorlevel 255 echo Sound number out of range.
C:> loadpcm 0 \wav\sound.wav
C:> if errorlevel 255 echo Sound number out of range.
C:> loadpcm 3 \wav\sound.wav
...
C:> if errorlevel 6 echo Error: no XMS memory available.
C:> if errorlevel 5 echo Error: insufficient conventional memory.
C:> if errorlevel 4 echo Error: 8- and 16-bit sound files only.
C:> if errorlevel 3 echo Error: bad sound file.
C:> if errorlevel 2 echo Error: can not open file.
C:> if errorlevel 1 echo Warning: Existing sound not replaced.
This series of commands illustrates how to check on
the status of background-sound availability in a .bat
file (note that if the errorlevel is 2, then the "if
errorlevel == 1" is also true, and so the above will not
work as desired (Microsoft(!))).
Testing
This program has been running for days at a time, with all timers,
random, etc. sounds active, while calculating prime numbers, during
my normal development, or even while recording on the PAS!
Requirements
MediaVision Pro Audio Spectrum or ThunderBoard or
Creative Technologies Sound Blaster (any model)
himem.sys (or compatible int 2F handler)
available XMS memory
Limitations
Monochrome screen memory is too slow for 16-bit, 44100Hz files. The
program "setdma.exe" can be used to allocate a 16K buffer to serve as
the DMA buffer ("freedma.exe" is used to deallocate this memory) (See
"sfdma.zip" on the Media Vision BBS).
Miscellaneous
The programs can be renamed as desired. You may receive the program
"loadpcm.exe" named as "lp.exe".
Copyright (c) 1992. Media Vision, Inc. All Rights Reserved.
Programmer: Bart Crane