[142] | 1 | /* $Id: stream.hpp 178 2001-04-30 21:08:00Z 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 STREAM_INCLUDED
|
---|
| 23 | #define STREAM_INCLUDED
|
---|
| 24 |
|
---|
| 25 | #ifndef OS2_INCLUDED
|
---|
| 26 | #define INCL_NOPMAPI
|
---|
| 27 | #include <os2.h>
|
---|
| 28 | #endif
|
---|
| 29 | #include <os2me.h>
|
---|
| 30 | #include <shdd.h>
|
---|
| 31 |
|
---|
| 32 | #include "strategy.h"
|
---|
| 33 | #include "audiohw.hpp"
|
---|
| 34 | #include "strmbuff.hpp"
|
---|
[178] | 35 | #include <daudio.h>
|
---|
[142] | 36 |
|
---|
| 37 | extern PQUEUEHEAD pStreamList; // List head for Streams.Defined in STREAM.CPP.
|
---|
| 38 |
|
---|
| 39 | // stream types
|
---|
| 40 | #define STREAM_READ AUDIOHW_READ_DEVICE
|
---|
| 41 | #define STREAM_WRITE AUDIOHW_WRITE_DEVICE
|
---|
| 42 | #define STREAM_WAVE_CAPTURE AUDIOHW_WAVE_CAPTURE
|
---|
| 43 | #define STREAM_WAVE_PLAY AUDIOHW_WAVE_PLAY
|
---|
| 44 | #define STREAM_MPU401_CAPTURE AUDIOHW_MPU401_CAPTURE
|
---|
| 45 | #define STREAM_MPU401_PLAY AUDIOHW_MPU401_PLAY
|
---|
| 46 |
|
---|
| 47 | // stream states
|
---|
| 48 | #define STREAM_STOPPED 0x00000000
|
---|
| 49 | #define STREAM_STREAMING 0x00000001
|
---|
| 50 | #define STREAM_PAUSED 0x00000002
|
---|
| 51 | #define STREAM_IDLE 0x00000004
|
---|
| 52 | #define STREAM_NOT_IDLE 0xFFFFFFFB
|
---|
| 53 |
|
---|
| 54 | // input sources
|
---|
| 55 | #define INPUT_LINEIN 0
|
---|
| 56 | #define INPUT_MIC 1
|
---|
| 57 | #define INPUT_MIXER 2
|
---|
| 58 |
|
---|
| 59 | typedef ULONG (__far __cdecl *PFN_SHD) (void __far *);
|
---|
| 60 |
|
---|
| 61 | class STREAM;
|
---|
| 62 | class AUDIOHW;
|
---|
| 63 | class EVENT;
|
---|
| 64 |
|
---|
| 65 | class STREAM : public QUEUEELEMENT {
|
---|
| 66 | public:
|
---|
| 67 | HSTREAM hstream;
|
---|
| 68 | PFN_SHD pfnSHD;
|
---|
| 69 | ULONG ulSysFileNum;
|
---|
| 70 | QUEUEHEAD qhInProcess;
|
---|
| 71 | QUEUEHEAD qhDone;
|
---|
| 72 | QUEUEHEAD qhEvent;
|
---|
| 73 | ULONG ulStreamType; // the stream type see above
|
---|
| 74 | ULONG ulStreamState; // the current state to the stream see above
|
---|
| 75 | ULONG ulStreamId;
|
---|
| 76 |
|
---|
| 77 | int fIncrementCounter; // true if the current time should be incremented on every tick
|
---|
| 78 |
|
---|
| 79 | ULONG EnableEvent(PDDCMDCONTROL pControl);
|
---|
| 80 | ULONG DisableEvent(PDDCMDCONTROL pControl);
|
---|
| 81 | ULONG PauseStreamTime(void);
|
---|
| 82 | ULONG ResumeStreamTime(void);
|
---|
| 83 | virtual ULONG Register(PDDCMDREGISTER);
|
---|
[167] | 84 | virtual void DeRegister(void);
|
---|
[178] | 85 | virtual ULONG Write(PSTREAMBUF, ULONG, BOOL fLooping = 0);
|
---|
| 86 | virtual void SetLooping(BOOL fLooping);
|
---|
[142] | 87 | virtual ULONG Read(PSTREAMBUF, unsigned) = 0;
|
---|
| 88 | virtual ULONG GetCurrentTime(void) = 0;
|
---|
[166] | 89 | virtual ULONG GetCurrentPos(void) = 0;
|
---|
[178] | 90 | virtual ULONG GetCurrentWritePos(void) = 0;
|
---|
[142] | 91 | virtual void SetCurrentTime(ULONG time) = 0;
|
---|
| 92 | virtual ULONG StartStream(void) = 0;
|
---|
| 93 | virtual ULONG StopStream(PCONTROL_PARM) = 0;
|
---|
| 94 | virtual ULONG PauseStream(PCONTROL_PARM) = 0;
|
---|
| 95 | virtual ULONG ResumeStream(void) = 0;
|
---|
| 96 |
|
---|
[178] | 97 | BOOL isActive() { return ulStreamState == STREAM_STREAMING; };
|
---|
[142] | 98 |
|
---|
[178] | 99 | virtual BOOL SetProperty(int type, ULONG value, ULONG reserved = 0);
|
---|
| 100 | virtual ULONG GetProperty(int type);
|
---|
| 101 |
|
---|
[142] | 102 | void SetNextEvent(void);
|
---|
| 103 | STREAM(ULONG streamtype, USHORT filesysnum);
|
---|
| 104 | virtual ~STREAM(void);
|
---|
| 105 |
|
---|
| 106 | protected:
|
---|
| 107 | ULONG ulCurrentTime;
|
---|
| 108 | PAUDIOHW pahw; // pointer to the hardware object for this stream
|
---|
[166] | 109 | virtual void ReturnBuffer(void); // returns one buffer
|
---|
[142] | 110 | void ReturnBuffers(void); // returns all buffers
|
---|
| 111 | void ProcessEvents(void);
|
---|
| 112 |
|
---|
| 113 | ULONG balance;
|
---|
| 114 | ULONG volume;
|
---|
| 115 | ULONG inputsrc;
|
---|
| 116 | ULONG inputgain;
|
---|
| 117 | static ULONG mastervol;
|
---|
| 118 | };
|
---|
| 119 | typedef STREAM *PSTREAM;
|
---|
| 120 |
|
---|
| 121 |
|
---|
| 122 | PSTREAM FindActiveStream(ULONG StreamType);
|
---|
| 123 | // Returns the pointer to the Active STREAM object with the given stream type
|
---|
| 124 |
|
---|
| 125 | PSTREAM FindActiveStream(ULONG StreamType, ULONG streamid);
|
---|
| 126 | // Returns the pointer to the Active STREAM object with the given stream type
|
---|
| 127 |
|
---|
| 128 | PSTREAM FindStream(HSTREAM hStream);
|
---|
| 129 | // Returns the pointer to the STREAM object with the given stream handle
|
---|
| 130 |
|
---|
| 131 | PSTREAM FindStream_fromFile(ULONG ulSysFileNum);
|
---|
| 132 | // Returns the pointer to the STREAM object with the given system file handle
|
---|
| 133 |
|
---|
| 134 | #endif
|
---|