[142] | 1 | /* $Id: waudio.hpp 181 2001-05-09 17:44:25Z sandervl $ */
|
---|
| 2 |
|
---|
| 3 | /* SCCSID = %W% %E% */
|
---|
| 4 | /****************************************************************************
|
---|
| 5 | * *
|
---|
| 6 | * Copyright (c) IBM Corporation 1994 - 1997. *
|
---|
| 7 | * *
|
---|
| 8 | * The following IBM OS/2 source code is provided to you solely for the *
|
---|
| 9 | * the purpose of assisting you in your development of OS/2 device drivers. *
|
---|
| 10 | * You may use this code in accordance with the IBM License Agreement *
|
---|
| 11 | * provided in the IBM Device Driver Source Kit for OS/2. *
|
---|
| 12 | * *
|
---|
| 13 | ****************************************************************************/
|
---|
| 14 | /**@internal %W%
|
---|
| 15 | * Defines, class definations and prototypes for
|
---|
| 16 | * @version %I%
|
---|
| 17 | * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
|
---|
| 18 | * <stack context>.
|
---|
| 19 | * @history
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 | #ifndef WAUDIO_INCLUDED
|
---|
| 23 | #define WAUDIO_INCLUDED
|
---|
| 24 |
|
---|
| 25 | #ifndef OS2_INCLUDED
|
---|
| 26 | #define INCL_NOPMAPI
|
---|
| 27 | #include <os2.h>
|
---|
| 28 | #include <os2medef.h>
|
---|
| 29 | #include <audio.h>
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
| 32 | #include "audiohw.hpp"
|
---|
| 33 | #include "irq.hpp"
|
---|
| 34 |
|
---|
[181] | 35 | #include <daudio.h>
|
---|
| 36 |
|
---|
[142] | 37 | // defines used to define the PCM, MULAW, and ALAW tables used by
|
---|
| 38 | // virtual void DevCaps(PAUDIO_CAPS pCaps)
|
---|
| 39 | #define NUMFREQS 4
|
---|
| 40 | #define BPSTYPES 2
|
---|
| 41 | #define MONOSTEREO 2
|
---|
| 42 |
|
---|
| 43 | #define DMA_BUFFER_SIZE (ULONG)0x4000
|
---|
| 44 |
|
---|
| 45 | // FREQ_TABLE_TYPE class is specific to CS4232 it holds a particular sample
|
---|
| 46 | // rate and the calue that is required to be written into Clock select bits
|
---|
| 47 | // indexed register 8 bits 0-3) but this class can be easly update for other
|
---|
| 48 | // devices
|
---|
| 49 | class FREQ_TABLE_TYPE {
|
---|
| 50 | public:
|
---|
| 51 | ULONG freq;
|
---|
| 52 | UCHAR clock_select;
|
---|
| 53 | };
|
---|
| 54 | // The WaveConfigInfo Class
|
---|
| 55 | // Built the the WAVESTREAM class, at Audio Ioctl Init time, the WaveConfigInfo
|
---|
| 56 | // is used to suppply the WAVEAUDIO class with information about a particular
|
---|
| 57 | // instance and the WAVEAUDIO calss also returns information to the WAVESTREAM
|
---|
| 58 | // class it needs to calculate the stream time and keep the device quiet if
|
---|
| 59 | // the stream runs out of data.. All values supplyed by the WAVESTREAM are
|
---|
| 60 | // noted as Input and values returned by the WAVEAUDIO class are noted as
|
---|
| 61 | // Output.
|
---|
| 62 | class WaveConfigInfo {
|
---|
| 63 | public:
|
---|
| 64 | ULONG ulSampleRate; // Samples Per Second Input
|
---|
| 65 | ULONG ulBitsPerSample; // Number of Bits in a Sample Input
|
---|
| 66 | ULONG ulNumChannels; // Number of Channels (mono or stereo) Input
|
---|
| 67 | ULONG ulDataType; // type of data (PCM, MuLaw, ALaw etc) Input
|
---|
| 68 | ULONG ulPCMConsumeRate; // number of bytes consumed/produced per sec Output
|
---|
| 69 | ULONG ulBytesPerIRQ; // Number of bytes consumed/produced per IRQ Output
|
---|
| 70 | USHORT usSilence; // Value that produces silence Output
|
---|
| 71 | };
|
---|
| 72 | typedef WaveConfigInfo * PWAVECONFIGINFO;
|
---|
| 73 |
|
---|
| 74 | class STREAM;
|
---|
| 75 |
|
---|
| 76 | class WAVEAUDIO : public AUDIOHW {
|
---|
| 77 | public:
|
---|
| 78 | virtual int Pause(STREAM *stream); // Pause the operation
|
---|
| 79 | virtual int Resume(STREAM *stream); // Resume the operation
|
---|
| 80 |
|
---|
| 81 | // Report the Device Capabilities to MMPM/2
|
---|
| 82 | // This member function is called from
|
---|
| 83 | // IoctlAudioInit() (IOCTL.CPP) and is the
|
---|
| 84 | // only MMPM/2 specific call made into the
|
---|
| 85 | // WAUDIO Class.
|
---|
| 86 | virtual void DevCaps(PAUDIO_CAPS pCaps);
|
---|
[181] | 87 | virtual void DevCaps(LPDAUDIO_CAPS pCaps);
|
---|
[142] | 88 | // configure the device for an operation
|
---|
| 89 | virtual void ConfigDev(STREAM *stream, PWAVECONFIGINFO pConfigInfo);
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | protected:
|
---|
| 93 | WAVEAUDIO(ULONG devicetype) :
|
---|
| 94 | AUDIOHW(devicetype)
|
---|
| 95 | {};
|
---|
| 96 |
|
---|
| 97 | UCHAR _ucClockData; // The Clock Select Data on the CS4232 this data
|
---|
| 98 | // is written into bits 0-3 of the FS and Playback
|
---|
| 99 | // Data Format Reg (indexed reg 8)
|
---|
| 100 | UCHAR _ucFormatData; // The Data Format bits on the CS4232 this corresponds
|
---|
| 101 | // to bits 4-7 indexed registers 8 (playback) and
|
---|
| 102 | // 28 (capture)
|
---|
| 103 | USHORT _usCountData; // The count register data (indexed registers 14 and
|
---|
| 104 | // 15 or 30 and 31)
|
---|
| 105 | void _vSetup(void); // Common setup code called by both the WAVEPLAY and
|
---|
| 106 | // WAVEREC constructors
|
---|
| 107 |
|
---|
| 108 | private:
|
---|
| 109 | USHORT _usfind_matching_sample_rate(PULONG pulSampleRate);
|
---|
| 110 |
|
---|
| 111 | };
|
---|
| 112 | typedef WAVEAUDIO *PWAVEAUDIO;
|
---|
| 113 |
|
---|
| 114 | #endif
|
---|