| 1 | /* $Id: audiohw.hpp,v 1.1 2000/04/23 14:55:15 ktk Exp $ */
|
|---|
| 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 Audiohw object
|
|---|
| 16 | * @version %I%
|
|---|
| 17 | * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
|
|---|
| 18 | * <stack context>.
|
|---|
| 19 | * @history
|
|---|
| 20 | *
|
|---|
| 21 | */
|
|---|
| 22 | #ifndef AUDIOHW_INCLUDED
|
|---|
| 23 | #define AUDIOHW_INCLUDED
|
|---|
| 24 |
|
|---|
| 25 | #ifndef OS2_INCLUDED
|
|---|
| 26 | #define INCL_NOPMAPI
|
|---|
| 27 | #include <os2.h>
|
|---|
| 28 | #endif
|
|---|
| 29 | #ifndef AUDIO_CAPABILITY
|
|---|
| 30 | #include <audio.h> // PAUDIO_CAPS
|
|---|
| 31 | #endif
|
|---|
| 32 | #include "queue.hpp"
|
|---|
| 33 |
|
|---|
| 34 | // Audio Hardware Device Types values for usDeviceType
|
|---|
| 35 | #define AUDIOHW_INVALID_DEVICE (~0)
|
|---|
| 36 | #define AUDIOHW_READ_DEVICE 0x0000
|
|---|
| 37 | #define AUDIOHW_WRITE_DEVICE 0x0001
|
|---|
| 38 | #define AUDIOHW_WAVE_CAPTURE 0x0010
|
|---|
| 39 | #define AUDIOHW_WAVE_PLAY 0x0011
|
|---|
| 40 | #define AUDIOHW_FMSYNTH_CAPTURE 0x0020
|
|---|
| 41 | #define AUDIOHW_FMSYNTH_PLAY 0x0021
|
|---|
| 42 | #define AUDIOHW_MPU401_CAPTURE 0x0040
|
|---|
| 43 | #define AUDIOHW_MPU401_PLAY 0x0041
|
|---|
| 44 | #define AUDIOHW_TIMER 0x0080
|
|---|
| 45 |
|
|---|
| 46 | #define NUM_HARDWARE_DEVICE_TYPES 32
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | // Rudi: Dolby AC3 support
|
|---|
| 50 |
|
|---|
| 51 | #ifndef DATATYPE_AC3
|
|---|
| 52 | #define DATATYPE_AC3 0xac3 //DATATYPE_MPEG1AUDIO
|
|---|
| 53 | #endif
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | extern PQUEUEHEAD pAudioHWList;
|
|---|
| 57 |
|
|---|
| 58 | class AUDIOHW;
|
|---|
| 59 | class STREAM;
|
|---|
| 60 |
|
|---|
| 61 | class AUDIOHW : public QUEUEELEMENT {
|
|---|
| 62 | protected:
|
|---|
| 63 | AUDIOHW(USHORT devicetype) :
|
|---|
| 64 | usDeviceType (devicetype)
|
|---|
| 65 | {pAudioHWList->PushOnTail(this);};
|
|---|
| 66 |
|
|---|
| 67 | public:
|
|---|
| 68 | const USHORT usDeviceType;
|
|---|
| 69 | virtual int Start(STREAM *stream) = 0; // Start the operation
|
|---|
| 70 | virtual int Stop(STREAM *stream) = 0; // Stop the operation
|
|---|
| 71 | virtual int Pause(STREAM *stream) = 0; // Pause the operation
|
|---|
| 72 | virtual int Resume(STREAM *stream) = 0; // Resume the operation
|
|---|
| 73 | virtual void DevCaps(PAUDIO_CAPS pCaps) = 0;
|
|---|
| 74 | };
|
|---|
| 75 | typedef AUDIOHW *PAUDIOHW;
|
|---|
| 76 |
|
|---|
| 77 | // Globally Scoped function that returns the pointer to a particular
|
|---|
| 78 | // hardware device.
|
|---|
| 79 | PAUDIOHW GetHardwareDevice(USHORT Devicetype);
|
|---|
| 80 |
|
|---|
| 81 | // Globally Scoped function to setup a hardware data type
|
|---|
| 82 | void SetHardwareType(USHORT HardwareType, USHORT DataType, USHORT Operation, USHORT LDev);
|
|---|
| 83 |
|
|---|
| 84 | // Globally Scoped function associate hardware types to the type of data files
|
|---|
| 85 | // they can play or record....
|
|---|
| 86 | USHORT GetHardwareType(USHORT DataType, USHORT Operation, USHORT LDev);
|
|---|
| 87 |
|
|---|
| 88 | // Hardware Index Class
|
|---|
| 89 | // MMPM/2 when sends an Audio Ioctl Init or Audio Ioctl Capability to the
|
|---|
| 90 | // driver,it includes a Data Type (see AUDIO.H and OS2MEDEF.H). The driver needs
|
|---|
| 91 | // to associate the data type with the hardware class that process it. The
|
|---|
| 92 | // the hardware_index class holds information that identifies which hardware
|
|---|
| 93 | // classes can handle a particular data type and what operations (play or
|
|---|
| 94 | // record) it can provide for that data type
|
|---|
| 95 | class hardware_index {
|
|---|
| 96 | public:
|
|---|
| 97 | USHORT DeviceType; // The audiohw data type (see above)
|
|---|
| 98 | USHORT LogicalDevice; // The strategy entry this request came from.
|
|---|
| 99 | // MMPM/2 will not send requests for 2 like devices
|
|---|
| 100 | // the same driver, but it can be "fooled" into
|
|---|
| 101 | // thinking there are 2 drivers each capable of
|
|---|
| 102 | // 1 of said devices..
|
|---|
| 103 | USHORT DeviceDataType; // the DataType fro MMPM/2 (see AUDIO.H/OS2MEDEF.H)
|
|---|
| 104 | USHORT DeviceOperation; // the operation type (see AUDIO.H
|
|---|
| 105 | // AUDIO_INIT.ulOperation)
|
|---|
| 106 | };
|
|---|
| 107 |
|
|---|
| 108 | #endif
|
|---|