1 | /* $Id: audiohw.hpp 142 2000-04-23 14:55:46Z ktk $ */
|
---|
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 ulDeviceType
|
---|
35 | #define AUDIOHW_INVALID_DEVICE 0xFFFFFFFF
|
---|
36 | #define AUDIOHW_READ_DEVICE 0x00000000
|
---|
37 | #define AUDIOHW_WRITE_DEVICE 0x00000001
|
---|
38 | #define AUDIOHW_WAVE_CAPTURE 0x00000010
|
---|
39 | #define AUDIOHW_WAVE_PLAY 0x00000011
|
---|
40 | #define AUDIOHW_FMSYNTH_CAPTURE 0x00000020
|
---|
41 | #define AUDIOHW_FMSYNTH_PLAY 0x00000021
|
---|
42 | #define AUDIOHW_MPU401_CAPTURE 0x00000040
|
---|
43 | #define AUDIOHW_MPU401_PLAY 0x00000041
|
---|
44 | #define AUDIOHW_TIMER 0x00000080
|
---|
45 |
|
---|
46 | #define NUM_HARDWARE_DEVICE_TYPES 32
|
---|
47 |
|
---|
48 | extern PQUEUEHEAD pAudioHWList;
|
---|
49 |
|
---|
50 | class AUDIOHW;
|
---|
51 | class STREAM;
|
---|
52 |
|
---|
53 | class AUDIOHW : public QUEUEELEMENT {
|
---|
54 | protected:
|
---|
55 | AUDIOHW(ULONG devicetype) :
|
---|
56 | ulDeviceType (devicetype)
|
---|
57 | {pAudioHWList->PushOnTail(this);};
|
---|
58 |
|
---|
59 | public:
|
---|
60 | const ULONG ulDeviceType;
|
---|
61 | virtual int Start(STREAM *stream) = 0; // Start the operation
|
---|
62 | virtual int Stop(STREAM *stream) = 0; // Stop the operation
|
---|
63 | virtual int Pause(STREAM *stream) = 0; // Pause the operation
|
---|
64 | virtual int Resume(STREAM *stream) = 0; // Resume the operation
|
---|
65 | virtual void DevCaps(PAUDIO_CAPS pCaps) = 0;
|
---|
66 | };
|
---|
67 | typedef AUDIOHW *PAUDIOHW;
|
---|
68 |
|
---|
69 | // Globally Scoped function that returns the pointer to a particular
|
---|
70 | // hardware device.
|
---|
71 | PAUDIOHW GetHardwareDevice(ULONG Devicetype);
|
---|
72 |
|
---|
73 | // Globally Scoped function to setup a hardware data type
|
---|
74 | void SetHardwareType(ULONG HardwareType, USHORT DataType, USHORT Operation, USHORT LDev);
|
---|
75 |
|
---|
76 | // Globally Scoped function associate hardware types to the type of data files
|
---|
77 | // they can play or record....
|
---|
78 | ULONG GetHardwareType(USHORT DataType, USHORT Operation, USHORT LDev);
|
---|
79 |
|
---|
80 | // Hardware Index Class
|
---|
81 | // MMPM/2 when sends an Audio Ioctl Init or Audio Ioctl Capability to the
|
---|
82 | // driver,it includes a Data Type (see AUDIO.H and OS2MEDEF.H). The driver needs
|
---|
83 | // to associate the data type with the hardware class that process it. The
|
---|
84 | // the hardware_index class holds information that identifies which hardware
|
---|
85 | // classes can handle a particular data type and what operations (play or
|
---|
86 | // record) it can provide for that data type
|
---|
87 | class hardware_index {
|
---|
88 | public:
|
---|
89 | ULONG DeviceType; // The audiohw data type (see above)
|
---|
90 | USHORT LogicalDevice; // The strategy entry this request came from.
|
---|
91 | // MMPM/2 will not send requests for 2 like devices
|
---|
92 | // the same driver, but it can be "fooled" into
|
---|
93 | // thinking there are 2 drivers each capable of
|
---|
94 | // 1 of said devices..
|
---|
95 | USHORT DeviceDataType; // the DataType frim MMPM/2 (see AUDIO.H/OS2MEDEF.H)
|
---|
96 | USHORT DeviceOperation; // the operation type (see AUDIO.H
|
---|
97 | // AUDIO_INIT.ulOperation)
|
---|
98 | };
|
---|
99 |
|
---|
100 | #endif
|
---|