home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio 4.94 - Over 11,000 Files
/
audio-11000.iso
/
msdos
/
sndbords
/
proaudio
/
pcmtools
/
pcmtools.arj
/
LOADPCM.ARJ
/
PCM.DOC
< prev
next >
Wrap
Text File
|
1992-08-27
|
8KB
|
232 lines
PCM - TSR Providing PCM Access
Syntax
pcm
Options
None
Operation
Run the TSR "pcm.com" in order to provide access to PCM functions via
interrupt 94h. The program intercepts interrupt 9 in order to hot-key
background sound play.
Although programming by linking to the static libraries is simple,
this TSR provides additional functionality:
during load, the Hardware State Table is initialized.
retrieve the address of the DMA buffer (if set)
perform all initialization automatically (Function 8004)
perform custom initialization automatically (Function 8011)
internal User Functions
background sound play using extended memory
Use "setdma.exe" to fix an area of memory for DMA transfers.
Programmers may want to alter "setdma" to access UMB's so the DMA
buffer is completely out of conventional memory.
Use of the interrupt 94h interface is similar to that for "fm.com".
Entry
si = function number
es:bx = points to data buffer specific to function
Exit
ax = return integer or boolean value
dx:ax = return long value or far address
Note: this document and its associated programs are subject to change
at any time and is being distributed for informational purposes only.
Example in C - set "testpcm.c"
Functions
Description of Function
SI ES:BX points to Buffer Containing...
Returned in AX (int) or DX:AX (void far *)
0 InitMVSound() - initialize the Hardware State Table
N/A
char far * NULL if failed, else Hardware State Table address
1 InitPCM() - initialize PCM State Tables
N/A
int 0 if failed, else Library Version Number
2 PCMInfo() - set samplerate and mono/stereo
struct pcminfo {long samplerate; int stereoflag};
int 0 if okay, -1 if Samplerate Out of Range
3 DMABuffer() - set DMA buffer address, size and partitions
struct dmabuf {char far * dmabuf, int bufkbsize, partitions;};
char far * NULL if failed, else succeeded
4 UserFunc() - set up callback routine for DMA interrupts
void far (*userfunction)();
void far * NULL if failed, else succeeded
5 PCMPlay() - play
N/A
int 0 if successful, else failed
6 PCMRecord() - record
N/A
int 0 if successful, else failed
7 PausePCM() - pause playback or record
N/A
N/A
8 ResumePCM() - resume paused playback or record
N/A
N/A
9 StopPCM() - stop playback or record
N/A
N/A
A RemovePCM() - remove PCM hook to IRQ, clear internal DMA vars
N/A
N/A
C FindDMABuffer() - find area from memory within 64K block
struct fdmabuf {char huge *dmabuf; int bufkbsize};
char far *dmabuf NULL if failed, else Valid DMA address
8000 Retrieve Current DMA Address
N/A
char far *dmabuf NULL if none, else Current DMA address
8001 Retrieve Current DMA Size and Divisions
N/A
AX= Current DMA Size, DX= Current DMA Divisions
8004 Make Ready For Play Mono at 11025Hz using B000:0 as 32K/2 DMA Buffer
N/A
N/A
8011 Make Ready For Play using User Specified Parameters
struct pcmstate *{}; All Parms for PCMInfo, DMABuffer, UserFunc
struct pcmstate *{}; See Below for structure definition
8012 Load Sound for Background Play
struct extstate *{}; All Parms for sound and access to XMS
N/A
8013 Return Bitfield Describing Background Sound Slot Usage
N/A
ax= bitfield of sounds used, dx= max sound slots (8)
8014 Fill Structure for Specified Sound Slot
struct extstate *{}; desired sound number in field member
struct extstate *{}; structure filled with internal info
8015 Set/Get/Unset Internal DMA Buffer
struct dmabuf *{}; if dmaoff != -1, set internal to contents
struct dmabuf *{}; if dmaoff == -1, set contents to internal
8016 Simulate LeftShift-RightShift-# Keystroke
ax= 1 through 8 desired slot #
N/A
Parameter Definitions
The "pcminfo" structure holds the Sample Rate and Mono/Stereo Flag.
The Sample Rate can vary from 100 to 88200 Hz Mono output, or 200 to
44100 Hz for Stereo.
struct pcminfo /* Passed to PCMInfo() */
{
long samplerate; /* 100 - 88200 (100 - 44100 for stereo) */
int stereoflag; /* 0 = mono, 1 = stereo */
};
The "dmabuf" structure contains the address of memory to be used as
the DMA Load/Unload Buffer, the Size of this Buffer in KB, and the
Number of Partitions it is to be split into. This buffer must not wrap
around a 64KB block (the address should never get to ????:FFFF+ 1).
struct dmabuf /* Passed to DMABuffer() */
{
char far *dmabuf; /* address of DMA buffer */
int bufkbsize; /* size of DMA buffer in KB */
int partitions; /* number of partitions */
};
The "fdmabuf" structure contains a "huge" pointer to an area of memory
that is at least twice as large as the associated "kbsize" parameter,
which specifies the desired size of memory in KB.
struct fdmabuf /* Passed to FindDMABuffer() */
{
char huge *dmabuf; /* address of memory allocated */
int bufkbsize; /* size of memory in KB */
};
The "userfunc" parameter is the address of a routine that is to be
called every time the PCM hardware has completed the output/input
of a partition of the DMA buffer. Typically this routine decrements
a "flag" (see pcmstate.stat, below) which is monitored in the main
program, allowing it to read/write data during PCM playback/record.
void (far *userfunc)(); /* address of callback routine
The "pcmstate" structure is used to completely initialize the DMA and PCM
state with user-supplied parameters, and includes space for the return
values as well as a default DMA interrupt function that decrements the
int pointed to by pcmstate.stat, and one that reads/writes files in the
background using the pcmstate.fh file handle.
struct pcmstate
{
char far *f00r; /* hardware state table returned from InitMVSound */
int f01r; /* library code version returned from InitPCM */
long f02c1; /* samplerate passed to PCMInfo */
int f02c2; /* mono/stero flag passed to PCMInfo */
int f02r; /* -1 returned by PCMInfo if error, else (?) */
void (far *f04c)(); /* address of interrupt function or index to internals */
void far *f04r; /* 0 returned by UserFunc if error, else (?) */
char huge *f11c1; /* not used at present FindDMABuffer */
int f11c2; /* not used at present FindDMABuffer */
void far *f11r; /* not used at present FindDMABuffer */
char far *f03c1; /* DMA buffer passed to DMABuffer */
int f03c2; /* size of DMA buffer in kilobytes passed to DMABuffer */
int f03c3; /* number of partitions of DMA buffer passed to DMABuffer */
char far *f03r; /* 0 returned by DMABuffer if error, else (?) */
int f10r; /* returned by RemovePCM */
int f05r; /* returned by PCMPlay */
int f07r; /* returned by PausePCM */
int far *stat; /* "volatile int" address decremented each DMA pass */
int fh ; /* file handle for input/output file (not implemented) */
int sbsize; /* calculated size of each partition in bytes */
};
struct extstate
{
uint snum; /* sound slot number */
uint xmsh; /* XMS handle */
ulong xmss; /* XMS memory size */
ulong rate; /* samplerate of sound */
uint chan; /* number of sound channels */
uint comp; /* code for compression */
uint dsiz; /* bitsize of sample data */
};
Copyright (c) 1992. Media Vision, Inc. All Rights Reserved.
Programmer: Bart Crane