source: sbliveos2/trunk/drv16/stream.hpp@ 145

Last change on this file since 145 was 142, checked in by ktk, 25 years ago

Import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: stream.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
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"
35
36extern PQUEUEHEAD pStreamList; // List head for Streams.Defined in STREAM.CPP.
37
38// stream types
39#define STREAM_READ AUDIOHW_READ_DEVICE
40#define STREAM_WRITE AUDIOHW_WRITE_DEVICE
41#define STREAM_WAVE_CAPTURE AUDIOHW_WAVE_CAPTURE
42#define STREAM_WAVE_PLAY AUDIOHW_WAVE_PLAY
43#define STREAM_MPU401_CAPTURE AUDIOHW_MPU401_CAPTURE
44#define STREAM_MPU401_PLAY AUDIOHW_MPU401_PLAY
45
46// stream states
47#define STREAM_STOPPED 0x00000000
48#define STREAM_STREAMING 0x00000001
49#define STREAM_PAUSED 0x00000002
50#define STREAM_IDLE 0x00000004
51#define STREAM_NOT_IDLE 0xFFFFFFFB
52
53// input sources
54#define INPUT_LINEIN 0
55#define INPUT_MIC 1
56#define INPUT_MIXER 2
57
58typedef ULONG (__far __cdecl *PFN_SHD) (void __far *);
59
60class STREAM;
61class AUDIOHW;
62class EVENT;
63
64class STREAM : public QUEUEELEMENT {
65public:
66 HSTREAM hstream;
67 PFN_SHD pfnSHD;
68 ULONG ulSysFileNum;
69 QUEUEHEAD qhInProcess;
70 QUEUEHEAD qhDone;
71 QUEUEHEAD qhEvent;
72 ULONG ulStreamType; // the stream type see above
73 ULONG ulStreamState; // the current state to the stream see above
74 ULONG ulStreamId;
75
76 int fIncrementCounter; // true if the current time should be incremented on every tick
77
78 ULONG EnableEvent(PDDCMDCONTROL pControl);
79 ULONG DisableEvent(PDDCMDCONTROL pControl);
80 ULONG PauseStreamTime(void);
81 ULONG ResumeStreamTime(void);
82 virtual ULONG Register(PDDCMDREGISTER);
83 void DeRegister(void);
84 virtual ULONG Write(PSTREAMBUF, unsigned);
85 virtual ULONG Read(PSTREAMBUF, unsigned) = 0;
86 virtual ULONG GetCurrentTime(void) = 0;
87 virtual void SetCurrentTime(ULONG time) = 0;
88 virtual ULONG StartStream(void) = 0;
89 virtual ULONG StopStream(PCONTROL_PARM) = 0;
90 virtual ULONG PauseStream(PCONTROL_PARM) = 0;
91 virtual ULONG ResumeStream(void) = 0;
92
93 virtual void SetInputSrc(int src);
94 virtual void SetInputGain(ULONG gain);
95 virtual void SetVolume(ULONG volume);
96 virtual void SetBalance(ULONG balance);
97 virtual BOOL SetMasterVol(ULONG volume);
98
99 void SetNextEvent(void);
100 STREAM(ULONG streamtype, USHORT filesysnum);
101 virtual ~STREAM(void);
102
103protected:
104 ULONG ulCurrentTime;
105 PAUDIOHW pahw; // pointer to the hardware object for this stream
106 void ReturnBuffer(void); // returns one buffer
107 void ReturnBuffers(void); // returns all buffers
108 void ProcessEvents(void);
109
110 ULONG balance;
111 ULONG volume;
112 ULONG inputsrc;
113 ULONG inputgain;
114static ULONG mastervol;
115};
116typedef STREAM *PSTREAM;
117
118
119PSTREAM FindActiveStream(ULONG StreamType);
120// Returns the pointer to the Active STREAM object with the given stream type
121
122PSTREAM FindActiveStream(ULONG StreamType, ULONG streamid);
123// Returns the pointer to the Active STREAM object with the given stream type
124
125PSTREAM FindStream(HSTREAM hStream);
126// Returns the pointer to the STREAM object with the given stream handle
127
128PSTREAM FindStream_fromFile(ULONG ulSysFileNum);
129// Returns the pointer to the STREAM object with the given system file handle
130
131#endif
Note: See TracBrowser for help on using the repository browser.