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

Last change on this file since 176 was 167, checked in by sandervl, 24 years ago

update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: stream.hpp 167 2001-03-22 23:33:12Z 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"
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 virtual void DeRegister(void);
84 virtual ULONG Write(PSTREAMBUF, ULONG);
85 virtual ULONG Read(PSTREAMBUF, unsigned) = 0;
86 virtual ULONG GetCurrentTime(void) = 0;
87 virtual ULONG GetCurrentPos(void) = 0;
88 virtual void SetCurrentTime(ULONG time) = 0;
89 virtual ULONG StartStream(void) = 0;
90 virtual ULONG StopStream(PCONTROL_PARM) = 0;
91 virtual ULONG PauseStream(PCONTROL_PARM) = 0;
92 virtual ULONG ResumeStream(void) = 0;
93
94 virtual void SetInputSrc(int src);
95 virtual void SetInputGain(ULONG gain);
96 virtual void SetVolume(ULONG volume);
97 ULONG GetVolume() { return volume; };
98 virtual void SetBalance(ULONG balance);
99 virtual BOOL SetMasterVol(ULONG volume);
100
101 void SetNextEvent(void);
102 STREAM(ULONG streamtype, USHORT filesysnum);
103 virtual ~STREAM(void);
104
105protected:
106 ULONG ulCurrentTime;
107 PAUDIOHW pahw; // pointer to the hardware object for this stream
108 virtual void ReturnBuffer(void); // returns one buffer
109 void ReturnBuffers(void); // returns all buffers
110 void ProcessEvents(void);
111
112 ULONG balance;
113 ULONG volume;
114 ULONG inputsrc;
115 ULONG inputgain;
116static ULONG mastervol;
117};
118typedef STREAM *PSTREAM;
119
120
121PSTREAM FindActiveStream(ULONG StreamType);
122// Returns the pointer to the Active STREAM object with the given stream type
123
124PSTREAM FindActiveStream(ULONG StreamType, ULONG streamid);
125// Returns the pointer to the Active STREAM object with the given stream type
126
127PSTREAM FindStream(HSTREAM hStream);
128// Returns the pointer to the STREAM object with the given stream handle
129
130PSTREAM FindStream_fromFile(ULONG ulSysFileNum);
131// Returns the pointer to the STREAM object with the given system file handle
132
133#endif
Note: See TracBrowser for help on using the repository browser.